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
Explain the concept of object repository and how qtp recognises objects?
Why do we use breakpoints in QTP?
In order to select an automation tool for automating ur application, what r the things u need to consider? For eg i will go for automation; 1) When there is a lot of retesting and regression testing. 2) Return on investments. 3) Whether the tool supports the appln. 4)--------------, etc. Pls give me more number of points because my answer did not satisfy the interviewer. Very urgent pls
Without integrating QC/Testdirector with QTP, is it possible to keep track of the defects?If yes how? How to export QTP results to an excel sheet?
1.explain end to end process of qc,2.how many tabs are in qc9.0,qc10.0 3.what is review, how many reviews are following in aproject 4.how will you get the requirements 5.why do we choose testing 6.how to export tc's and requirements to qc through add-ins
How does qtp identify the object in the application?
How often were they executed?
Explain the concept of how quicktest professional identifies object?
Hi I'm a beginner in QTP. So far I'm ok with Descriptive but stuck while implementing Hybrid Frame work. 1. I have created a Keyword file with .vbs ext set home=description.create home("title").value="Welcome to feests" set reglink=description.create reglink("name").value="register yourrestaurant / take away" set fbusname=description.create fbusname("name").value="business_name" set dispname=description.create dispname("name").value="display_name" set restchkbox=description.create restchkbox("name").value="restaurant" set cuiscate=description.create cuiscate("name").value="cuisine_categery1" set addline1=description.create addline1("name").value="address_line1" set pstcode=description.create pstcode("name").value="address_postcode" set cntry=description.create cntry("name").value="address_country" set mlandno=description.create mlandno("name").value="landline_no" set emailadd=description.create emailadd("name").value="email" 2. I have created an Function Library file as follows Function launch() bro="C:\Program Files\Internet Explorer\iexplore.exe" url="http://www.feests.com/" invokeapplication bro&" "&url Browser(home).page(home).Link(reglink).click End Function Function restregistration(karthik, teja, Ameerpet, UK) Browser(home).page(home).WebEdit(fbusname).set "karthik" Browser(home).page(home).WebEdit(dispname).set "teja" Browser(home).page(home).WebCheckBox(restchkbox).set "ON" Browser(home).page(home).WebList(cuiscate).Select "Indian" Browser(home).page(home).WebEdit(addline1).set "Ameerpet" Browser(home).page(home).WebEdit(pstcode).set "UK" Browser(home).page(home).WebList(cntry).select "United Kingdom" Browser(home).page(home).WebEdit(mlandno).set "023775347" Browser(home).page(home).WebEdit(emailadd).set "email@gmail.com" End Function 3. This is how I have called the keywords and Functions in QTP executefile"C:\Documents and Settings\karthik\Desktop\keywords.vbs" executefile"C:\Documents and Settings\karthik\Desktop\functions.vbs" launch restregistration karthik, teja, Ameerpet, UK, "email@gmail.com" Now the issue is, I'm trying to enter the email ID in WebEdit field. But I dont know what is the mistake I did, if I run the script in QTP it is showing following error Error: Expected identifier Line (2): "executefile"C:\Documents and Settings\karthik\Desktop\functions.vbs"". Can someone help me fix this, please!!?
What is environment variable in qtp and why to use it?
An action has both shared and local or associated to it and both have the same object in them. In the test which one will be considered?
Can any one explain me what is the procedure to connect the remote desk by using QTP 9.2 ?
what is the difference between development and testing
How to use descriptive programming?
Can any one send me the QTP Basic Coding Samples?