QTP 11 test recording on Windows 7
It is possible to either edit/run/debug VB scripts right away - or use the
built-in record functionality. Proceed to start up QTP and load all add-ins
installed and relevant for the task.
For the sake of simplicity, we'll choose to test the Windows Calculator.
Let's assume the application has been re-configured/re-programmed and it is
necessary to check that it can still correctly perform calculations.
For this purpose, we'll check the ability to multiply two numbers.
When starting the record function, it is necessary to specify the application
to start up. Please bear in mind that only one of these applications should be
active at any point in time, to avoid confusing the test tool. For this reason,
it will be necessary to close all applications after test, which has been left
open on the desktop.
In this example, the calculator application is specified with its actual
location on the disk.
Multiplicating two numbers using the calculator can either be done through
pressing the appropriate buttons on the application (as will be done here)
or through the script to insert appropriate values directly to the display.
Here the action sequence "9", "*", "3" and "=" is performed - which shows up as
VB script with four actions.
After completing the recording, proceed to press the "Stop" button in the menu,
to complete the recording. Notice that ercording maybe resumed at a further
point in time by re-pressing the record button.
Pressing "Run" will re-trace the recorded steps and produce the calculation in
the calculator application.
During recording, every a windows controll (button) is activated, it is added
to the respoitory and assigned a default name ("Button", "Button_1",
"Button_2", "Button_3", ...). Opening the repository from the menu, reveals
its content. It is possible to add content to the repository directly though
the repository dialog.
Please notice in this case how each button maps to an appropriate button in the
For practical purpose, the default assigned names may be renamed to more
appropriate names, which makes the scritps easier to read.
In the following we will operate with renamed :
- Button -> "9"
- Button_1 -> "x"
- Button_2 -> "3"
- Button_3 -> "="