2.0 Record and Playback
2.1 Create and Execute Basic Scripts
2.1.1 Recording Tests
1. Start QuickTest and open a new test.
· If QuickTest is not currently open, choose Start > Programs > QuickTest Professional > QuickTest Professional.
In the Add-in Manager, confirm that the Web Add-in is selected, and clear all other add-ins. Click OK to close the Add-in Manager and open QuickTest.
Note: While QuickTest loads your selected add-ins, the QuickTest splash screen is displayed. This may take a few seconds. If the Welcome window opens, click Blank Test.
Otherwise, choose File > New, or click the New button .
A blank test opens.
· If QuickTest is already open, check which add-ins are loaded by selecting Help > About QuickTest Professional. If the Web Add-in is not loaded, you must exit and restart QuickTest. When the Add-in Manager opens, select the Web Add-in, and clear all other add-ins.
Choose File > New, or click the New button .
A blank test opens.
Note: If the Add-in Manager does not open when starting QuickTest, choose Tools > Options. In the General tab, select Display Add-in Manager on startup. When you exit and restart QuickTest, the Add-in Manager opens.
2. Start recording.
· Choose Test > Record or click the Record button The Record and Run Settings dialog box opens.
In the Web tab, select Open the following browser when a record or run session begins.
· Choose a browser from the Type list and confirm that the URL in the Address box is for example . http://newtours.mercuryinteractive.com.
· Confirm that Close the browser when the test is closed is selected.
· In the Windows Applications tab, confirm that Record and run on these applications is selected, and that there are no applications listed.
This setting prevents you from inadvertently recording operations performed on various Windows applications (such as e-mail) during a recording session.
· Click OK.
QuickTest begins recording, and your browser opens to the Mercury Tours Web site.
3. Login to the Mercury Tours Web site.
In the User Name and Password boxes, type the name and password you registered with Mercury Tours.
The Flight Finder page opens.
4. Enter flight details.
Change the following selections:
Departing From: New York
On: Dec 29
Arriving In: San Francisco
Returning: Dec 31
Service Class: Business class
Click CONTINUE to accept the other default selections. The Select Flight page opens.
Note: When entering dates while recording this test, do not click the View Calendar button, which opens a Java-based calendar. Your test will not record the date selected using this calendar because you did not load the Java Add-in for this tutorial.
To check which add-ins have been loaded, click Help > About QuickTest Professional. To change the available add-ins for your tests, you must close and reopen QuickTest Professional.
5. Select a flight.
Click CONTINUE to accept the default flight selections. The Book a Flight page opens.
6. Enter required passenger and purchase information.
Enter the required information (fields with red text labels) in the Passengers and Credit Card sections. (You may enter fictitious information.)
In the Billing Address section, select Ticketless Travel.
At the bottom of the page, click SECURE PURCHASE. The Flight Confirmation page opens.
7. Review and complete your booking.
Click BACK TO HOME. The Mercury Tours home page opens.
8. Stop recording.
In QuickTest, click Stop on the test toolbar to stop the recording process.
You have now reserved an imaginary business class ticket from New York to San Francisco. QuickTest recorded your Web browser operations from the time you clicked the Record button until you clicked the Stop button.
Save your test.
Select File > Save or click the Save button. The Save dialog box opens to the Tests folder.
Create a folder named Tutorial, select it, and click Open.
Type Recording in the File name field.
Confirm that Save Active Screen files is selected.
Click Save. The test name (Recording) is displayed in the title bar of the main QuickTest window.
2.1.2 Running a Test
Here you will run the test you recorded.
1) Start QuickTest and open the Recording test.
If QuickTest is not already open, choose Start > Programs > QuickTest Professional > QuickTest Professional.
· If the Welcome window opens, click Open Existing.
· If QuickTest opens without displaying the Welcome window, choose File > Open
or click the Open button.
In the Open Test dialog box, locate and select the Recording test, then click Open.
2) Confirm that all images are saved to the test results.
QuickTest allows you to determine when to save images to the test results. In this lesson, all images should be saved to the test results.
Choose Tools > Options and select the Run tab. In the Save step screen capture to test results option, select always.
Click OK to close the Options dialog box.
3) Start running your test.
Click Run or choose Test > Run. The Run dialog box opens.
Select New run results folder. Accept the default results folder name.
Click OK to close the Run dialog box.
Watch carefully as QuickTest opens your browser and starts running the test. In the browser, you can see QuickTest perform each step you recorded; a yellow arrow in the left margin of the test tree indicates the step that QuickTest is running.
2.2 Understand Recording Levels
2.2.1 Standard Recording
Records the test in terms of GUI objects
2.2.2 Analog Recording
enables you to record the exact mouse and keyboard operations you perform in relation to either the screen or the application window.
2.2.3 Low Level Recording
This mode records at the object level and records all run-time objects as Window or WinObject test objects.
2.3 Understand QuickTest Results
When QuickTest finishes running the test, the Test Results window opens.
Initially, the Test Results window contains two panes for displaying the key elements of your test run.
· The left pane displays the test results tree, an icon-based view of the steps that were performed while the test was running. Similar to the test tree in QuickTest main screen, it is organized according to the Web pages visited during the test run and can be expanded (+) to view each step. The steps performed during the test run are represented by icons in the tree. You can instruct QuickTest to run a test or action more than once using different sets of data in each run. Each test run is called an iteration and each iteration is numbered. (The test you ran had only one iteration.)
· The right pane displays the test results details. The iteration summary table indicates which iterations passed and which failed. The status summary table indicates the number of checkpoints or reports that passed, failed, and raised warnings during the test.
Your test run succeeded because QuickTest was able to navigate the Mercury Tours site just as the test was originally recorded. In this section, you will inspect the steps QuickTest performed when running your test, and how the application window appeared when a step was performed.
1. View the test results for a specific step.
In the test results tree, expand (+) Test Recording Summary >
Recording Iteration 1 (Row 1) > Action1 Summary > Welcome Mercury > Find a Flight.
Highlight "fromPort":Select "New York" in the test results tree.
The Test Results window now contains three panes, displaying:
· the test results tree, with one step highlighted
· the test results details of the highlighted step
· the Active Screen, showing a screen capture of the Web page on which the step was performed.
When you click a page in the test results tree, QuickTest displays the corresponding page in the application view. When you click a step (an operation performed on an object) in the test results tree, the corresponding object is highlighted in the application view. In this case, the Departing From text box is highlighted.
2. Close the Test Results window.
Choose File > Exit.
Test Results Tree Symbols
indicates a step that succeeded.
indicates a step that failed.
indicates a warning, meaning that the step did not succeed, but it did not cause the action or test to fail.
indicates a step that failed unexpectedly, such as when an object is not found for a checkpoint.
indicates an optional step that failed and therefore was ignored. Note that this does not cause the test to fail.
indicates that the Smart Identification mechanism successfully found the object.
indicates that a recovery scenario was activated.
indicates that the test run was stopped before it ended.