Showing posts with label Automated testing. Show all posts
Showing posts with label Automated testing. Show all posts

Sunday, June 15, 2008

QTP Tutorial 1: Learning Recording

For any suggestions or any topic you want to include in this blog or even discuss, please email me on expert.qtp@gmail.com

Lets start recording with the mercury sample application FLIGHT.

We will begin with a simple test like the "Hello World" program with which we start learning any programming language.


1) First of all click on Record toolbar button ( or Automation menu --> Record or press F3). when we click on Record, "Record and Run Settings" window opens up. Go to "Windows Applications" tab and choose first option "Record and run test on any open windows based application." and click on ok.


2) Open Flight application (Start -->All programs -->QuickTest Professional --> Sample Applications --> Flight)


3) Type Agent name as "Shree" (You can enter any, but must be 4 characters or more) and enter password as "mercury".


4) In the flight reservation window that opens up:

a) In the Flight Schedule area, in Date of Flight enter tomorrow's date in mm/dd/yyyy format.( I used tabs to move to next fields)
b)In Fly From enter Denver
c)In Fly To enter London
d) Click on Flights button which is on the right hand side of "Fly To".
Let the default option be selected in the Flights Table.
e) Click ok
f)In the name field enter your name. It will fill rest of the required information by itself.
g) Click on insert order and after the order is inserted
h) Click on File --> exit.


5) Now you have recorded your first script. You can click on the expert view tab to see the script which QTP has recorded for you automatically.


6) Click on run from Automation Menu (or press F5) to open up run dialog box.


7) Go to the "Results Location" tab, and below "write run results to", in "new run results folder" radio button- let it be the default option --C:\Program Files\Mercury Interactive\QuickTest Professional\Tests\Test1\Res1(you can also change it)


8) click on ok.


This will run you earlier recorded test and show you the results.


But we have to go a long way. This is just the beginning.

QTP Tutorials 2 - Using Data Table

Lets use data table:

There are two types of data tables Design time and Run time:

Design time data table is what you see in the main QTP window and run time data table you can see only in the test results window. Design time data table is always created before running the test while run time data table is generated after execution of the test.

1) Open new test (Ctrl+N)

2) We will click on record toolbar button ( or Automation menu --> record or press F3). when we click on record, "Record and Run Settings" window opens up. Go to "Windows Applications" tab and choose first option "Record and run test on any open windows based application." and click on ok.

3) Open Flight application (Start-->All programs-->QuickTest Professional->Sample Applications-->Flight)

4) Type Agent name as "Niyati" (you can enter any, but must be 4 characters or more) and enter password as "mercury".

5) In the flight reservation window that opens up:

6) Click on File-->exit. Click Stop to stop the recording.

7) In the keyword view you will see four headings- Item, Operation, Value, Documentation. Under Value click on Kumar and on the right hand side of Kumar you will see a small icon, just click on that (or press ctrl + F11), The "Value Configuration Options" dialog box opens. In that dialog box click on parameter radio button and select Data Table from there. In Name field enter any variable name (I entered 'username'). Let all other be the default options in this dialog box and click on ok.

8) QTP will add username column in the data table (bottom, left hand side) with 'Niyati' as the first value.

9) Now enter more values in the username column, manually. I entered 'Varun' and 'Tanya' in 2nd and 3rd column respectively.

10) Save the test. (File-->Save).

11) Now run the test. (follow same steps as we did earlier).

12) If the test ran successfully, in the Results summary window on the left hand side you will see three iterations (because we added 3 variables in the 3 rows of a data table). Expand 1st iteration, it will show action summary for that iteration, expand the action summary, it will show Login, Expand the login. Click on the first option under it "Agent Name: SetText". On the right hand side it will show 1st variable name under details.

13) Similarly you can look for 2nd and 3rd.