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

can we change the name of a check point? when will you start writing testcases? do you follow any methodology for writing test scripts? qtp is key word driven testing or data driven testing?

2 Answers  


How to handle the exceptions using the recovery scenario manager in qtp?

0 Answers  


Take a situation when you are working with QTP, suddenly system has crashed.so you again start the system. My questyion is how can QTP directly opened when the system desktop appears.

1 Answers  


How to do the scripting. Is there any inbuilt functions in qtp as in qtp-s.

0 Answers  


How to open a new test using quicktest professional?

0 Answers  






I have written some script in QTP and i added those objects in Object Repository. All written script has been executed successfully. After few days when i tried to execute the same script i got error message "objects not found in Object Repositiry". How can we solve this issue?

3 Answers  


before launching qtp, we need to close all the open browsers u dont know what are all the browsers either it might be ie,mozilla etc and u dont know how many brosers are open.... u need to close all these before launching qtp.. can anyone plz temme d solution...

2 Answers   Keane India Ltd,


In an output value text checkpoint, where does the output value stored by default ?

4 Answers   Ordain Solutions,


I have 2 Environment variable which holds int. I called into my test and addedup. but output is concatenating the values instead of Sum. Ex. Envi("a")= 10, Envi("b") = 20, c= Envi("a")+ Envi("b"). msgbox c ( Ans.1020). How to overcome this pblm?

3 Answers   TCS,


Differentiate the type of test cases which can be automated and which cannot be automated?

0 Answers  


suppose there r 10 action in a test i want to execute action 5 to 10 how would i do that

2 Answers  


does QTP provides any tools for parametrisation?

4 Answers  


Categories