[23] QTP study No.8_Checking Objects

2007/11/14 16:51

Checking Objects

In this section, you will add a standard checkpoint in the Book a Flight page. This checkpoint verifies the value in the box containing the first name of the passenger.

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.     Save the test as Checkpoint.

Choose File > Save As. Save the test as Checkpoint.

3.     Confirm that the Active Screen option is enabled.

If you do not see the Active Screen at the bottom of the QuickTest window, click the Active Screen button or choose View > Active Screen.

4.     Locate the page where you want to add a standard checkpoint.

You want to add a checkpoint that checks the property values of the First Name edit box after the passenger's name has been entered in the box.

In the Item column of the Keyword View, expand Action1 > Welcome: Mercury Tours.

Highlight the Book a Flight: Mercury row. The Book a Flight page is displayed in the Active Screen and the object corresponding to the selected step is highlighted. You can see that the passenger's first name is displayed in the First Name box.

5.     Create a standard checkpoint.

In the Active Screen, right-click the First Name boxand choose Insert Standard Checkpoint. The Object Selection – Checkpoint Properties dialog box opens.

Confirm that WebEdit: passFirst0 is highlighted, and click OK.

The Checkpoint Properties dialog box opens.

                         The dialog box displays the object's properties:

o    The Name is the name of the object as defined in the HTML code of the Web page.

o    The Class is the type of object. WebEdit indicates that the object is an edit box.

o    The ABC icon in the Type column indicates that the value of the property is a constant.

For each object class, QuickTest recommends default property checks. The table below describes the default checks for the WebEdit class.

Property

Value

Explanation

html tag

INPUT

INPUT is the html tag as defined in the HTML source code.

innertext

In this case, the value of innertext is empty. The checkpoint checks that the value is empty.

name

passFirst0

passFirst0 is the name of the edit box.

type

text

text is the type of object as defined in the HTML source code.

value

<FirstName>

(The name you entered while recording)

The value entered in the edit box.

The passenger's first name is entered in the First Name box when the passFirst0 Set... step is performed. Therefore, in the Insert statement area of the Checkpoint Properties dialog box, select After current step. This inserts the checkpoint after the passFirst0 Set... step in which the first name is entered.

In the Name box, enter CheckName as the new checkpoint name.

Accept the rest of the settings as default and click OK. QuickTest adds a standard checkpoint step to your test below the selected step.

6.     Save the test.

Choose File > Save or click the Save button .

You insert most checkpoints in the manner described above. Several special types of checkpoints are explained in the following sections.

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