We will test with the mercury sample application FLIGHT.
QTP script consists of things like actions, functions etc. In QTP 9 we can place 120 actions in a script, this is a limit.
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 "Kumar" (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.