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
How do you capture tooltip using QTP?
give me the code to save all messages of inbox of gmail into a folder and notepad
suppose in the middle of the project QTP will not work properly, then what do u do? and ur team?
What is active screen?
How to create a standard checkpoint ?
what you mean by artifact,milestone...
Hi, Can we open a test in qtp10 which is saved in qtp 9.2?
What is an expert view and keyword view?
Explain how qtp identifies objects?
Explain sub procedure of vbscript.
If the weblist is identified as webelement,and by clicking on webelement if the values are displayed,and if the values the values also identified as webelement.then how to fetch the values through script?
Describe function procedure in vbscript.
What is meant by Step generator?what is the use of this? we have 3 steps know there what r all those.? can u all pls give me clear idea of this
What is the difference in testing a client-server application and a web application?
I have created 3 actions in test action1, action2, action3 but I want run action 1,action 3,action2 how can you change in the actions in keyword view?