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

What is dynamic arrays

1 Answers   Patni,


how to write this script using descriptive programming? the script below is the script generated by QTP plz write the script using descriptive programming? plzzzzzzzz do answer thanku Browser("Welcome: Mercury Tours").Page("orkut - login").WebEdit("Email").Set "test123" Browser("Welcome: Mercury Tours").Page("orkut - login").WebEdit ("Passwd").SetSecure "475259b450e3d212bef4a5f5ce9d32ebcbf4" Browser("Welcome: Mercury Tours").Page("orkut - login").WebButton("Sign in").Click Browser("Welcome: Mercury Tours").Page("orkut - home").Link ("Logout").Click Browser("Welcome: Mercury Tours").Page("orkut - login").Sync Browser("Welcome: Mercury Tours").Close

3 Answers  


Hi Everybody, Can anybody please tell me the how to display the result of the QTP in the notepad text file rather than in the QTP result window. Suppose this is my simple script:WHich will open the notepad file and enter some text and then will change the font then will calculate how much time has been taken.Now, in this script i want to display the result in notepad file. Dim s Dim starttimer,endtimer,timeit s="uyetuywqtywqte" SystemUtil.Run "notepad","","Y:\","" Window("Notepad").WinEditor("Edit").Type micCtrlDwn + "s" + micCtrlUp Window("Notepad").Dialog("Save As").WinEdit("File name:").Set "test1" Window("Notepad").Dialog("Save As").WinEdit("File name:").Type micReturn Window("Notepad_3").Type s Window("Notepad_3").WinEditor("Edit").Type micCtrlDwn + "s" + micCtrlUp starttimer=timer Window("Notepad_3").WinMenu("Menu").Select "Format;Font..." Window("Notepad_3").Dialog("Font").WinEdit ("Font:").Type "cou" + micDwn Window("Notepad_3").Dialog("Font").WinComboBox ("Font:").Select "Courier" Window("Notepad_3").Dialog("Font").WinEdit ("Font:").Set "Courier" Window("Notepad_3").Dialog("Font").WinEdit("Font:").Type micReturn endtimer=timer timeit=endtimer-starttimer print(timeit) Please also tell me where the function for the text file result will be declared and where it should be called. Thanks, Gaytri

2 Answers  


How can i click on any Excel sheet's "H" column with out writing coordinates Ex:Window("Book1").WinObject("Book1").Click 498,14 I dont want to give coordinates like 498,14 Can i open "H" column by writing like Ex:Window("Book1").WinObject("Book1").Click "H" or Ex:Window("Book1").WinObject("Book1").Click "H","1" or Ex:Window("Book1").WinObject("Book1").Click H,1 If i want to click on "Sheet3" of an excel sheet, Can i open like Ex:Window("Book1").WinObject("Book1").Click "Sheet3" Please help me any one

0 Answers   Livetek,


How extensive or customized are the server logging and reporting requirements; are they considered an integral part of the system and do they require testing?

0 Answers  






what is the present location of nageshwara rao's institute in hydrabad along with institute phone no. and name of institute.He has shifted from S.R Nagar.

3 Answers  


HI, Anybody can explain Automation Test Framework...and wht do we do before start of Automation.....

5 Answers   Polaris, Siemens,


1. In build1 there is a page with two check boxes and a submit button. You have prepared a script for that page and its working fine. In Build 2 the developers have added two checkboxes in the page. Will the script prepared for Build 1 work for Build 2 or not. If yes, why and if No, why. Remember the developers have not touched the object properties of the textboxes in the page.

3 Answers   ADP,


How may types of defects identify application or your currently working application?pls give me answer..

0 Answers   Cap Gemini,


I have to pass all the test cases into gmail userid and password using functions please give me code thanks have anice and greate day

2 Answers  


In QTP can we feed the out of one browser(internet explorer) as an input to the another browser(mozilla firefox)? If yes explain how to do it with an example.

0 Answers   Patni,


hw to create a frame work in qtp..what are the basic steps

2 Answers   Infosys,


Categories