HI,

Based On The Information Below Write A Data Driven test
Script
Edit Box 1 Should take Value From Num1 Column
Edit Box 2 Should take Value From Num2 Column
Click On Add Button,
Get The Value Of Exp res Column,
Get Value From Actual Result Edit Box ,
Compare Two Values, Write Pass / Fail Value Into Result
Column

Thanks In Advance... Kavitha

Input.Xls
Num1 Num2 Exp res Act res Result
10 30 40 40 Pass
50 40 90 90.5 -
- - - - -
- - - - -
- - - - -

Answer Posted / nath .t

this example add the first two columns(Example Num1 and
Num2), added value stored in Act res column and take the
Exp res value, compare the two values and put result in
result column as pass or fail.

before execution:
example: Input.Xls
Num1 Num2 Exp res Act res Result
10 30 40 - -
50 40 90 - -
- - - - -
- - - - -
- - - - -

Set oExObj = createobject("Excel.Application")
Set oWb = oExObj.workbooks.open("C:\input.xls")
Set sheet = oWb.worksheets(1)
row = sheet.usedrange.rows.count
col = sheet.usedrange.columns.count
For i = 2 to row step 1
col1 = 0
For j = 1 to col-3 step 1
colvalue = sheet.cells(i, j)
col1 = col1 + cint(colvalue)
Next
sheet.cells(i,4)=col1
If cint(col1) = cint(sheet.cells(i, 3)) Then
sheet.cells(i, 5) = "Pass"
else
sheet.cells(i, 5) = "Fail"
End If
Next
oWb.save
oExObj.quit
Set oWb = nothing
Set oExObj = nothing

after execution:Input.Xls

Num1 Num2 Exp res Act res Result
10 30 40 40 Pass
50 40 100 90 Fail
- - - - -
- - - - -
- - - - -

Kavitha can modify above code as per criteria this is very
helpful for ur scenario.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

hi guys we r working in office...we write some scripts..suddenly we have a work(5min only) in out side..what will do now,,,used to system shut down or log off or lock or sleep mode,switch use or hibernate?

1584


How will you declare a variable in qtp?

556


In keyward driven framework what will be the step for yahoo login page ,inbox logout,plz explain in detail

1499


Hi friends I need to know about jubula automation tool. Is anybody know in bangalore where jubula tanning class is going on do let me know. Its urgent for me to learn that tool please help.

2891


Can any one tell me how to write a script for selecting open option in File menu of A word document.here you have to add objects to OR.try like that and give me the ans.i asked this question to so many but no one knows.if any one know the answer plz let me know

1404






can any one please tell me which is the best institute in Bangalore to learn QA (crash course)? Thanks

1523


How is test case write?

574


In QTP TEST DIRECTOR COMBINATION WHAT IS THE PURPOSE OF TEST DIRECTOR? In Somebody says to store test cases and design test cases.?ok fine , but In test director 5.0 , QTp not launching. what u do?

1491


What are the various types of Actions in UFT?

591


How can you exit from an action?

610


What are the key points to create a framework in QTP for oracle forms?

1809


Difference between test object and run time object?

590


Difference between copy to action and call to action?

592


Can anyone share/send me QTP 8.2 Crack as I had it before but now it's virus affected. Pls send me on Sawale.vijay@gmail.com Thanks, ~Vijay

2661


I have two For loop, first For loop does is creates a customer and input the customer info and then the second for loop within the first for loop does the follows which is capture the customer name and verify the with the data within the datatable. The problem I am coming across is that when it goes through the second time creating another customer and then verify the second customer then it creates the following during runtime. I want is to have the customer2 below Customer1 under the Customer_from_Apps. Any help will be greatly appreciate it. Customer Customer_from_Apps Customer_from_Apps1 Customer1 Customer 1 Customer2 Customer2 Window("Customer Desktop").Window("Customer Tracking (Privacy").WinObject("TreeView20WndClass").Click 92,244 runtimevalue = .VbTreeView("vbname:=AppServerTree").GetROProperty("Selectio n") Customer_Val= Datatable.GlobalSheet.AddParameter ("Customer_from_Apps",runtimevalue) row=datatable.getsheet("Global").GetRowCount For x=1 to row datatable.SetCurrentRow(x) Data_Val=Datatable.Value("Customer",dtGlobalSheet) If (trim(Customer_Val)=trim(Data_Val)) Then Reporter.ReportEvent micPass, "Customer validation successful", "Actual Value: " &Data_Val&vbcrlf& "Customer Value: " &Customer_Val else Reporter.ReportEvent micFail, "Cusotmer validation unsuccessful", "Actual Value: " &Data_Val&vbcrlf& "Customer Value: " &Customer_Val End If Next

1334