Lesson 3: Create verification points
In this lesson, you will record verification points to test objects. Verification points verify that a certain action has taken place, or verify the state of an object.
You can create a Properties verification point or six types of Data verification points. When you create a verification point, you capture information about an object in the application to establish baseline information for comparison during playback. You will record a Data verification point to capture the tree of composers.
To start at the beginning of the tutorial, see the HCL OneTest™ UI Tutorial.
Create a data verification point
- In the Recording Monitor, click the Insert Verification Point or Action Command button .
- In the Select an Object page of the Verification Point and Action Wizard, clear the After selecting an object advance to next page option if it is selected.
- Use the Object Finder to select the Composers tree in the application. Click
the Object Finder and drag it over the tree. While holding down the mouse
button, you will see that the entire tree is outlined with a red border and
the object name is displayed (
javax.swing.JTree
) in a screen tip next to the red border. When you release the mouse button to make the selection, notice that the recognition properties for the object are listed in the grid at the bottom of the Select an Object page. - Click Next.
- In the Select an Action page, make sure Perform Data Verification Point is selected and click Next.
- On the Insert Verification Point Data Command page, in the Data Value field, select the Tree Hierarchy test. This test captures information about the entire tree hierarchy.
- In the Verification Point Name field, type
Classics_tree
and click Next. - The Verification Point Data page displays the captured data in a grid in the right pane. If a check mark appears in the box beside an item, that item will be tested. By default, all items are selected. Leave them checked. If they are not selected, click the Check All button.
- Click Finish.
Create an image verification point
You can insert an image verification point to confirm that the appropriate album is displayed for the selected CD.
- In the Recording Monitor, click the Insert Verification Point or Action Command button (
- In the Select an Object page of the Verification Point and Action Wizard, clear the After selecting an object advance to next page option if it is selected.
- Use the Object Finder () to select the Album image in the application. Click
the Object Finder and drag it over the album image.
While holding down the mouse button, you will see that the album image outlined
with a red border and the object name is displayed (
javax.swing.JLabel
) in a screen tip next to the red border. When you release the mouse button to make the selection, notice that the recognition properties for the object are listed in the grid at the bottom of the Select an Object page. - Click Next.
- In the Select an Action page, selectPerform Image Verification Point and click Next.
- In the Insert Image Verification Point Command page, type Album_image as the Verification Point Name.
- Make sure that the option Select full image is selected and click Next.
- The Verification Point Data page displays the captured image in the right pane. Click Finish.
Create a properties verification point
You can now insert a different verification point to confirm that the order is for the correct customer. A Properties verification point is used to capture the text in the confirmation screen.
- In the ClassicsCD application, click Order > View Existing Order Status. Do not click either of the password fields at this time.
- Click OK.
You will test on the label Order for Trent Culpito in the View Existing Orders dialog box.
- In the Recording Monitor, click the Insert Verification Point or Action Command button .
- On the Select an Object page, select the advance to next page option this time (the check box beneath the Object Finder).
- Drag the Object Finder over the label, Order for Trent Culpito,
to select it. While holding down the mouse button, you'll see that the label
is outlined with a red border and the object name is displayed (
javax.swing.JLabel
).After you select the object, the Select an Action page opens because you selected the advance to next page option.
- Select Perform a Properties Verification Point, which is the second action from the top. Click Next.
- On the Insert Properties Verification Point Command page, leave the Include Children field set to None.
- Under Verification Point Name, accept the suggested default.
- Leave the Use standard properties option checked,
and click Next.
On the Verification Point Data page, the test object properties and their values are displayed in a grid format. You can choose which properties to test in the Property column and can edit the property values in the Value column.
Note: By default, none of the properties are selected. To test object properties, you must select the properties you want to test by checking each of them. The properties you select are tested each time you play back a script with this verification point. You can check all properties in the list by clicking the Check All toolbar button above the grid. Use the Uncheck All button to clear all properties. When you use a Properties verification point, it is a good practice to test only the properties you are interested in. In this case, only the text property is of interest to determine whether the order is for the correct customer. - In the Property column select the text, opaque, and visible properties to test them during playback. You may have to click the check box twice for the selection to persist.
- Click Finish.
- In the ClassicsCD View Existing Orders dialog box, click Close.
Test the password fields
Now let us place another quick order to test the password fields that we did not test earlier.
- Expand the Schubert folder in the composers tree.
- Click String Quartets Nos. 4 & 14.
- Click Place Order.
- In the Member Logon dialog box, keep the default settings of Existing Customer and Trent Culpito.
- This time, enter
xxxx
in the Password field. - Click the check box to select the Remember Password option.
- Click OK.
- Enter a valid format credit card number and expiration date, for instance, 7777 7777 7777 7777, expiration 06/09.
- Click Place Order.
- Click OK in the order confirmation message box.
- Close the ClassicsCD application by clicking the x button.
- Click the Stop Recording button on the Recording toolbar.
When you stop recording, HCL OneTest™ UI closes the monitor, and writes your script and object map to your project directory. The HCL OneTest™ UI window is restored and the script displays in the main window.
Advance to Lesson 4: Play back the script.