Hi
I have a doubt in qtp. Can you please clarify my doubt.

If we are importing the data from excel sheet in qtp the
the script is running the number of row times.

I mean if there are 4 rows in excel sheet the script is
running 4 times. cant we avoid this.

suppose i have tis script:

datatable.Import "C:\Documents and Settings\sailaja\My
Documents\login1.xls"
n = datatable.GetRowCount
For i =1 to n
systemutil.Run "C:\Program Files\Mercury
Interactive\QuickTest
Professional\samples\flight\app\flight4a.exe"
datatable.SetCurrentRow i
Dialog("Login").WinEdit("Agent Name:").Set DataTable
("Username", dtGlobalSheet)
Dialog("Login").WinEdit("Password:").Set DataTable
("Password", dtGlobalSheet)
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").ActiveX
("MaskEdBox").Type "020209"
Window("Flight Reservation").WinComboBox("Fly
From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly
To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights
Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "Sailaja"
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").WinMenu
("Menu").Select "File;New Order"
window("Flight Reservation").Close
next
I created a excel sheet with 3 rows and 2 columns.
(username and password). The script is running 9 times. I
made the option run one itaration only . eventhough it is
running 9 times .can u plaese clarify my doubt.



Thankyou
Sailaja.

Answer Posted / sreekanth chilam

Hi Sailaja,

As by defalut in Test menu-->Settings-->Run Tab

Options will be -- Run on all rows
Hence if datatable contains 'n' number of rows, script will
execute that much number of times.

To avoid the above situation:

1.Go to Test menu-->Settings-->Run Tab
2.select "Run only one iteration" option button
3.Click Apply -> OK

4.In script give the below code

datatable.import "excel file path"
rowcount=datatable.getrowcount
for i=1 to rowcount
datatable.setcurrentrow(i)
-------

-----
Next

Now see ur prolem will be solved.


Cheers,
Sreekanth

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is output value in QTP and how it can be used in automation testing

1440


What VBScript operators, functions, and statements do you use in QuickTest Professional?

2173


Can you list some technologies that support qtp?

556


How can i use virtual objects? If have i created one new virtual object in a virtual object manager by following instructions.

1452


How to do the scripting. Are there any inbuilt functions in QTP? What is the difference between them? How to handle script issues?

576






Does any one worked on JIL Emulator , Testing with QTP(automation). Trail Version of QTP is not identifying the child objects of JIL emulator, Can any one help me out ,

1383


Explain calling sub procedure.

626


What is the latest version of qtp?

589


in qtp if we record a object and we record the object using virtual wizard then by which way the object is recognized that means recorded

1524


1 Folders in VSS 2 In navigation script there are 100 script i want to run first 50 and 37th script also not needed to run how to do this 3 What is navigation script,Driver script, business script what we are loaded in this script 4 use of resource tab 5 Difference between verification and validation give real scenario example 6 file scripting object when to use it 7 what are the problems you are faced while testing web application 8 difference between expert view and keyword view 9 difference between QTP 8.2 and QTP 9.2 navigation frame work please answer these questions from real time working people as early as possible

1612


Why qtp always start action1 and does not start action?

607


how do u plan test automation?

1447


How to find array size in qtp?

586


i'm testing the webpage with QTP, in this wabpage i have to choose the CV from the window, but QTP can't recognize the object, so i used the Low LEvel Recording, but every time i run the test, QTP go to halt when it gets to the Recorded part, any solution for that?( except puting delay in the script and manuall selecting, because i've did that)

1555


what is actually contain test report? can anybody post the test report

1475