For our Application Under Test (AUT), we made use of the sample application called “Flight” which was bundled with QTP. We were given the test script that we had to automate. Essentially, the script involved:
1. Logging in
2. Creating an Order
3. Faxing an Order
4. Logging out
To accomplish this, here are the basic steps:
(1) Create a new test by selecting File -> New -> Test from the menu (or CTRL+N).
(2) Update the Record and Run Settings by selecting Automation -> Record and Run Settings… from the menu. We needed to add our AUT in the list of Applications.
(3) Create the script — including steps, checkpoints and output values.
You can try recording the steps and it will be able to produce a script. However, playing it back will fail due to some hard-coded items that are no longer applicable upon rerunning (e.g., window title included the Order Number which would be different in the next run). It also wouldn’t have the needed checkpoints (or the test/assertions) and it wouldn’t gather output data.
For the first script created, QTP’s record function was used to record the steps. Inserting checkpoints and output values were also done during the recording. For instances wherein the object title or text being checked is dynamic (e.g., window title containing the Order Number), we made use of regular expressions e.g., instead of “Flight No. 19” as originally recorded, we made use of “Flight No.*” with the regular expressions checkbox marked.
Here’s a link to a video recording of the script creation: http://youtu.be/DwayCg1M5IY
Alternatively, here’s a similar script creation video without step 3 though, but it does have audio. It covers basic recording and inserting checkpoints and an output value.