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

Answers were Sorted based on User's Feedback



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

Answer / ratankumar

Hi Dear friends!
As per my knowledge iam giving the script to do datadriven
by flatfile in qtp.
First creat a notepad with some inputs in d system
thenOption explicit
Dim fso,f,x
set fso=createobject ("scripting.filesystemobject")
set f=fso.opentextfile("Path of the notepad")
While f.atendofline <>true
x=f.readline

Window("Flight Reservation").WinMenu("Menu").Select
"File;Open Order..."
Window("Flight Reservation").Dialog("Open
Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open
Order").WinEdit("Edit").Set x
Window("Flight Reservation").Dialog("Open
Order").WinButton("OK").Click
Window("Flight Reservation").WinButton("Delete Order").Check
CheckPoint("Delete Order")
Wend

Is This Answer Correct ?    2 Yes 0 No

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

Answer / srinivas prasad

dear friends for qtp documents visit www dot gcreddy dot
com, there you can find more information abot
parameterization

Is This Answer Correct ?    1 Yes 0 No

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

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

More QTP Interview Questions

from where we will retrieve data for data driven tests in qtp?

3 Answers  


How you debug your script?

0 Answers  


How to find if given number is prime or not

1 Answers  


What is API?

1 Answers  


Explain advantages and disadvantages kdf?

0 Answers  


can a Function return more than one value..??? if so please give me the code for that.

5 Answers   DST Global Solutions,


How to capture the Check point Value into a variable?

2 Answers  


In an application you have a web table. You are provided with an external Excel sheet with the same structure as that of the web table. How will you retrieve all data from the web table and compare it with corresponding data available in the excel sheet, using QTP? How will you report the results in QTP?

1 Answers  


Problem with XML checkpoint in QTP ?

0 Answers  


can we take 'dim my pen is good' as a paramerter

2 Answers  


How to supress warnings from the "Test results page"?

4 Answers  


How can i store runtime value through vb script while using qtp

1 Answers  


Categories