How can we parameterize our test, values in flat file.
Ex:- Values in notepad, with that values i want to
parameterize the test.

Answer Posted / arunsingh

'Open a notepad and enter some values in
'line by line and save it (C:/a.txt)
'FlightReservation window should be opened

set obj=createobject("scripting.filesystemObject")
set file=obj.opentextfile("C:/a.txt")
i=1
While file.atendofline<>true
n=file.readline
datatable.setcurrentrow(i)
datatable(1,1)=n
i=i+1

'Record some transactions by opening a ordermenu and
'enter order number

Window("Flight Reservation").WinMenu
("Menu").Select "File;Open Order..."
Window("Flight Reservation").Dialog("Open
Order").WinCheckBox("Order No.").Set "ON"

'replace order number which u entered
'at the recording with n

Window("Flight Reservation").Dialog("Open Order").WinEdit
("Edit").Set n
Window("Flight Reservation").Dialog("Open Order").WinButton
("OK").Click
if(Window("Flight Reservation").Dialog("Open Order").Dialog
("Flight Reservations").exist)then
Reporter.ReportEvent
micFail, "OrderNo "&n, "Not Exist"
Window("Flight Reservation").Dialog("Open
Order").Dialog("Flight Reservations").WinButton("OK").Click
Window("Flight Reservation").Dialog("Open Order").WinButton
("Cancel").Click
datatable(2,1)="not Exist"
else
Reporter.ReportEvent
micPass, "OrderNo "&n, "Exist"
datatable(2,1)="Exist"
end if
Wend


Try for this u will get it.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Hi All , How can we decicde for pariticular frame(DataDriven or Keword Driven)in Project? Thanks Balaji

1369


What is the significance of “action 0” in qtp?

561


supose i hv to acsess some functionlaties of a test in 1 machin , some part other machin how can acsess?

1351


Can you brief the hurdles you faced during Automation testing?

573


your coming from electrical backgroung..but y ur coming to software side?

1378






when to start the automation?

1473


How will you find the current time of the remote machine using QTP script?

587


Both static and dynamic arrays are handled by the vb script. Is it true?

552


Hybrid framework supports Descriptive programming. Is it true?

643


How do you do batch testing in wr & is it possible to do in qtp, if so explain?

613


In qtp, how you can exit for loop?

519


In qtp, explain what is crypt object

590


What are the advantages of Object Repository?

577


what are the limitations of smart identification in qtp 9.0

1917


Hi Friends, How many types of Data Bases available in market... What is the diff. while using Syabase and Oracle in a Project... ? and what is the main diff. of Syabase and Oracle databases... ? Thanx in advance..

1510