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.

Answers were Sorted based on User's Feedback



Hi I have a doubt in qtp. Can you please clarify my doubt. If we are importing the data from ex..

Answer / sailaja

Hi Srikanth
Thankyou soo much. Now my script is running fine . Before I
did the same setting in keyword view->Action right click
Action call properties Run on all rows.But it did not
solved my problem . Once again thankyou soo much.

Regards
Sailaja.

Is This Answer Correct ?    1 Yes 0 No

Hi I have a doubt in qtp. Can you please clarify my doubt. If we are importing the data from ex..

Answer / 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

Hi I have a doubt in qtp. Can you please clarify my doubt. If we are importing the data from ex..

Answer / infanto

i have a question
Wen ever i use IE=createObject
(Ineternetexplorer.application)
QTP just navigates to the URL mentioned but doesn't
recognise the USErname and Password field so the test
fails..
But wen i just record and use system.util "iexplore"
the code recognises and the tst passes, but here it works
fine sometimes and sometimes the test just fails and
aftersometime i run it works.. so its not consistent,,, any
suggestion

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More QTP Interview Questions

hi i have completed my b.tech in cse stream. now i am working in an organisation in testing department. i want do sap course but i dnt know which module will boost my career can anyone suggest me which is good for my career

0 Answers  


What are the Features & Benefits of Quick Test Pro ?

1 Answers   Crea,


Write script to fetch the data from global sheet where row number is 3 and parameter is "text"

3 Answers   Accenture, Thomson Reuters,


I want to write some certification courses, so friends could you guide me? which certification is best and how to write exam and what tutorials need to be studied,what to do first, I am working on automation tool QTP 9.2

0 Answers   Livetek,


Object Repositories types, which & when to use?

3 Answers   Crea,






write the code to reverse a string without using Strrev built in function.

14 Answers   ADP,


I need your help in the below topic using QTP Automation tool. How to automate the right click of mouse on a context menu? 1)Tried low level recording which is working fine but making use of co-ordinates. 2) Also tried changing the mouse settings and properties using Tools ->WebEvent RecordingConfiguration and created a configuration file with required mouse click events and used which did not work.

1 Answers   AppLabs,


What scripting language QTP of?

4 Answers  


How to Import data from a ".xls" file to Data table during Runtime.

10 Answers   BirlaSoft,


What is Virtual object wizard in QTP?

4 Answers  


How do u write script in qtp? where do u write?

2 Answers  


dears, I have one question for QTP.If my software is english and defined objects is english name. But, if my software has support MUI, under this case that my objects in the QTP can't work, because the QTP can't catch the objects name. In this case, is anybody know how to solve this problem? Thanks a lot.

2 Answers   CyberLink,


Categories