[21] QTP study No.6_Running a Test and Analyzing Test Results

2007/11/02 15:53

Running a Test

In this lesson, you will run the test you recorded in Recording Tests.

1.     Start QuickTest and open the Recording test.

If QuickTest is not already open, choose Start > Programs > QuickTest Professional > QuickTest Professional.

o    If the Welcome window opens, click Open Existing.

o    If QuickTest opens without displaying the Welcome window, choose File > Open > Test or click the Open button down arrow and choose Test.

In the Open Testdialog 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 or click the Options button, then click the Run tab. In the Save still image captures to results option, select Always. Click OK to close the Options dialog box.

3.     Start running your test.

Click Run or choose Automation > 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 Keyword View indicates the step that QuickTest is running.

Analyzing Test 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 results tree, an icon-based view of the steps that were performed while the test was running. The results tree 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 results tree, expand (+) Test Recording Summary >
Recording Iteration 1 (Row 1) > Action1 Summary
> Welcome Mercury Tours > Find a Flight.

Highlight fromPort:Select in the results tree.

The Test Results window now contains three panes, displaying:

o    the results tree, with one step highlighted

o    the test results details of the highlighted step

o    the still image capture pane, showing a screen capture of the Web page on which the step was performed

When you click a page in the results tree, QuickTest displays the corresponding page in the application view. When you click a step (an operation performed on an object) in the 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.

You have now successfully created and run a test that reserves a flight from New York to San Francisco on the Mercury Tours Web site.


2007/11/02 16:02

回放脚本

               1.     运行QuickTest并打开测试脚本。

如果还没有运行QuickTest,点击Start > Programs > QuickTest Professional > QuickTest Professional

o    如果可以看到欢迎界面,点击Open Existing

o    如果没有打开欢迎界面直接运行了Quick Test,点击File > Open > Test或者点击Open按钮的下三角符号选择Test

在弹出的对话框中,打开存放脚本的文件夹,找到之前录制的脚本后点击Open

2.     确定所有的画面保存到测试结果中。

点击Tools > Options或者点击Options,然后点击Run页。在Save still image captures to results选项,选择Always。点击OK确定选择并关闭对话框。

3.     回放脚本。

点击Run或者点击Automation > Run。弹出了回放对话框。

选择New run results folder。接受默认文件夹名称设置。

点击OK确定并关闭对话框。

仔细观察QuickTest启动浏览器运行测试脚本。可以看到QuickTest执行你录制的所有步骤;另外还可以看到在QuickTestKeyword View 视图的左边空白位置出现了一个黄色的箭头,箭头表示脚本回放的步骤。

分析测试结果

脚本回放完成后将弹出测试结果窗口。

测试结果窗口包含两个部分。

·         左边显示results tree。以阶层图标的方式显示脚本回放的所有操作步骤。Results tree主要以脚本回放中所打开的网页为基础,可以通过点击(+)展开查看在各个页面的操作步骤。允许使用不同的数据多次重复某个测试或者动作。每次回放称为一个迭代iteration,每个iteration都有一个编号。 (这个脚本只能进行一次iteration)

·         右边显示测试结果详细信息。迭代Iteration一览表指出哪些iteration通过或者失败。状态 status一览表指出通过的验证点checkpoint的数目以及通过、失败以及警告的报告。

因为Quick Test可以根据最初的录制过程来执行Mercury Tours站点的各操作,所以此次脚本回放是成功的。接下来就可以查看回放的各个步骤,而且可以查看在回放某步骤时的界面详细情况。

1.     查看各步骤的测试结果。

results tree,展开(+) Test Recording Summary >
Recording Iteration 1 (Row 1) > Action1 Summary
> Welcome Mercury Tours > Find a Flight.

results tree中选定fromPort:Select

此时测试结果窗口分为三个部分显示相关信息:

o    Results tree中突出显示被选中的步骤

o    被选中步骤的测试详细信息

o    截图部分,显示该步骤回放时的屏幕截图

当在results tree中选择一个页面时,QuickTest显示的是该页面的所有相关信息。当选择一个步骤(或者操作对象)时,在截图的区域会突出显示相关的对象。本例中,突出显示Departing From编辑框。

2.     关闭测试结果窗口。

目前为止,已经成功的录制并回放了在Mercury Tours站点预订一张从New YorkSan Francisco的机票的全过程。

posted @ 2008-03-18 15:52  Atine  阅读(423)  评论(1编辑  收藏  举报