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


Please Help Members By Posting Answers For Below Questions

What are the different types of recording modes in qtp? Which will be used when?

784


How we can import data from database?

876


What is synchronization point in QTP?

852


What are the various types of Actions in UFT?

780


How do you do batch testing in wr and is it possible to do in qtp, if so explain?

681


Explain how Selenium is different from UFT?

865


What is the use of text output value in quicktest professional (qtp)?

780


how to evalute defects in QTP script?

1678


If I am scripting Web-based Surveys using QTP that open up differently but at the exact same point require a username and password can I automate that username and password for all the surveys some how using QTP?

1656


What is the difference between analog and low level recording?

822


diff between qtp versions from 8.5

1722


HI, pls help me on this, iam not able to capture getcelldata value in javatable... msgbox javawindow("").javatable("").getcelldata(3,3) but it diaplays empty...

2594


How to test background color and dynamic images during run time can you put the check point for moving objects?

1652


Explain the difference between data driven testing and parameterization ?

764


hi to all, i need a code.. in flight application 1.i need to login first then i need to insert 3 new orders... 2.i have to log out 3.i have to login again with different user 4.need to insert 2 new orders 5.then need to log out 6.then again login with different user 7.3 new orders create and log out 8.but we hv to do this using data table and actions please help me

1950