Adding a Verify step
You can use the Verify step to validate expected conditions during Web UI test run. The Verify step checks whether the application under test behaves as expected by comparing actual runtime values with expected values defined in the test. If the verification fails, the step is marked as failed in the test run results. After you add the Verify step from the General section of the catalog, you can choose the type of verification to perform by selecting a mode in the step details pane.
Before you begin
- Ensured that you are assigned a Team Space Owner, Project Owner, or Member with a Tester role to create or edit a test resource.
- Read and understood the information in Edit branch overview and Create or select an Edit branch.
- Ensured that your project contains a Web UI test.
- Opened the test in Test Editor. See Editing a Web UI test.
Procedure
-
Click the
button displayed on the Test
Editor page.
The Edit button appears only when no active edit branch is selected.
Alternatively, right-click the test in the test navigator panel and select Edit.
The Edit branch dialog is displayed.If the Edit branch dialog is not displayed, then go to step 3. - Select an existing edit branch or create a new edit branch.
- Drag and drop the Verify element under any test step as required from the General catalog in the Catalog tab.
-
Click the Verify step.
The step details pane is displayed.
-
Select the required verification mode from the Mode list:
- UI
- General
Note:The default mode depends on where the Verify step is added. When the Verify step is added within a With step, it opens in UI mode. When it is added outside a With step, it opens in General mode.A confirmation dialog is displayed, indicating that switching modes clears the current step configuration.
-
Click Yes.
Note:
- The default mode depends on where the step is added. When the step is added within a With step, it opens in UI mode. When it is added outside a With step, it opens in General mode.
- You can switch between the available modes by selecting a different option from the Mode list.
- If you switch modes after configuring the step, select the required mode and then click Yes in the confirmation dialog. The existing configuration is cleared and the step opens in the selected mode.
-
You can perform the actions that are listed in the following table to configure
verification in a Verify step during a test run:
Mode Action General: You can use General mode to verify variables, expressions, and business logic conditions during a test run. This mode validates runtime data instead of UI elements. Perform the following steps:- In the first column, click the Insert Variable
icon
to select a variable from the list or enter the variable
name. - In the operator field, select an option to indicate the basis of
comparison of the two operands.The available operators are as follows:
- Equals
- Not Equals
- Greater Than
- Greater Than Equals
- Less Than
- Less Than Equals
- Strict Equals
- Strict Not Equals
- Includes
- Not Includes
- In the third column, click the Insert Variable
icon
to select a variable from the list or enter the variable name in
the Value field. Additionally, you can add, duplicate or delete rows for verification.
Also, you can switch to the JS code view to create or modify the comparison statement.
UI: You can use UI mode to verify UI elements and their properties in the application under test during a test run. This mode ensures that UI components are displayed correctly and match expected values. Perform the following steps:- Select an object to be verified by dragging and dropping an element from
Smartshot view, an element from
Elements list, or a property-value pair from the
Properties list.
Alternatively, you can select an object to be verified from the list in UI Object, and then select an identifier such as Class, Content, Label, XPath, or Id of the object from the list. If you follow this method, you must ensure that the object is highlighted in the Smartshot view after you enter the values.
- Click click here to add a row to provide values to be verified under Verification Points.
- Enter the property name and value to be verified in the newly added row.
You can replace the value of verification point dynamically by clicking the Insert Variable icon
and selecting a variable from the list.Note:If you select the text before choosing a variable, the selected text is replaced with the variable. If you do not select any text, the variable is inserted at the current cursor position. - Optional: Under the Object Identified By
section, you can replace the value of identifier dynamically by clicking
the Insert Variable icon
and selecting a variable from the list.Note:If you select the text before choosing a variable, the selected text is replaced with the variable. If you do not select any text, the variable is inserted at the current cursor position. - Optional: Click Click here to add relative to, specify the relative location in the Location field, and specify the relative object in the UI Object field.
- Optional: Click Click here to add alternative
identifier, and select a target object from the list in the
Target 2 field.
Alternatively, you can drag and drop an element from the Smartshot view.
- Optional: Select the Override Timeout checkbox in the Advanced tab and adjust the timeout value in Duration for the object verification.
- In the first column, click the Insert Variable
icon
-
Click the Save icon
to save the modifications.