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 / sonia
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
col1=sheet.cells(i,4)
If CInt(col1) = CInt(sheet.cells(i,3)) Then
sheet.cells(i,5)="Pass"
Reporter.ReportEvent micPass, "Complate", "Expected Result"
&CInt(col1) &vbcrlf&" Actual Result."&vbcrlf& CInt(col1) =
CInt(sheet.cells(i,3))
else
sheet.cells(i,5)="Fail"
End If
Next
oWb.save
oexObj.quit
Set oWb=nothing
Set oexObj=nothing
Use this code it work very fine.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How do we handle run-time errors?
Hi, i run scripts in one machine those r passed.when i run the scripts in client side those r failed.Give me such a scenario when ever u faced?
Is QTP supports Unix. If yes, then how the test automation is done?
How many types of recording facility are available in quicktest professional (qtp)?
How do you configure QTP AND Test director?
What are the methods used in UFT to handle exceptions or run-time errors?
How may types of defects identify application or your currently working application?pls give me answer..
How do you test DLL files using automation Tool QTP?
Why we load add-ins in qtp?
Hi All, How to get repeated word in string . Thanks Balaji
How to add verification steps to tests?
What is the use of running the scripts in Hidden-mode in UFT?
what is test scheduleling?
If you are testing a web application then what will you test in that application?
Explain the concept of how quicktest professional (qtp) identifies object?