Adding Verification Logic to a Visual Test

This topic describes how you can use the Test Logic Designer to add verification logic to a visual test. Any type of verification logic sends a user-defined pass/fail message and a flag (optional) to the result of your visual test.
  1. Open the visual test.
  2. Right-click on the test step which includes the object that you want to verify.
  3. Choose Insert > Test Logic > Verification. The Test Logic Designer wizard opens.
  4. Click Next.
  5. From the Select a Logic Type page, select the type of verification logic.

    Select a type of verification logic based on:

    • The property of a control – Creates verification logic based on the value of a property of a control. For example:
      Verify "Button"."Text" Is Equal to "Cancel"
    • Whether a control exists - Creates verification logic that checks if the specified control exists or if the specified control does not exist. For example:
      Verify "Button" Exists Is Equal to True
    • A variable defined in this visual test – Creates verification logic based on the contents of a local variable in your visual test. For example:
      Verify st_LastValidation Is Equal to False
    • The contents of a Rumba screen - Creates verification logic to compare the contents of a Rumba screen.
    • A verification asset - Creates verification logic to compare the contents of the UI against an asset. Currently, Silk Test Workbench supports only image verifications as verification assets. For additional information, see Asset Types. For example:
      Run the Image Verification called 'Untitled_1'
    • The time taken to run a sequence of steps - Creates verification logic based on the time taken to run a sequence of steps. For example:
      Verify timer number '1' is between 0 and 2 seconds Do Step 3 To Step 4
  6. Click Next.
  7. If you have selected The property of a control, the Define a property-based condition page opens.
    1. Expand the Identify a control menu and select one of the following:
      • Application Under Test – Click this button to identify a visible control directly from the application under test.
      • Screen Preview – Click this button to identify a control directly from the Screen Preview, if the application under test is not available.
      • Identify Object Dialog – Click this button to use the Identify Object dialog box to identify a non-visible control. The Identify Object dialog box additionally enables you to edit the locator of the control.
    2. Additionally, you can also type the full locator of the control into the Name of control field and click Refresh. If the control is found in the application under test, the Select a property is populated with the properties of the control.
    3. In the Select a property table, select the property.
    4. From the Select the condition list, select the conditional logic to apply to the property of the control.
    5. In the Expected value field, specify the value that the property is expected to have.
    6. Click Next.
  8. If you have selected Whether a control exists, the Define an exists condition for the control page opens.
    1. Expand the Identify a control menu and select one of the following:
      • Application Under Test – Click this button to identify a visible control directly from the application under test.
      • Screen Preview – Click this button to identify a control directly from the Screen Preview, if the application under test is not available.
      • Identify Object Dialog – Click this button to use the Identify Object dialog box to identify a non-visible control. The Identify Object dialog box additionally enables you to edit the locator of the control.
    2. Select Control exists to verify that the control exists.
    3. Select Control does not exist to verify that the control does not exist.
    4. Type a value into the Timeout field to specify how long Silk Test Workbench should wait for the control to appear or to disappear. The default timeout is 0, which means Silk Test Workbench does not wait for the control to appear or to disappear.
    5. Click Next.
  9. If you have selected A variable defined in this visual test, the Define a variable-based condition page opens.
    1. Select a pre-defined local variable from the Select the variable list. For a variable to appear in this list, you must include the local variable in your visual test. To add a new local variable to the visual test, click New. The Evaluate as field, displays the data type of the selected variable.
    2. Select the comparison operator to apply to the variable from the Select the condition list.
    3. In the Expected value field, specify the value that the variable is expected to have.
    4. Click Next.
  10. If you have selected The contents of a Rumba screen, identify the control on the Rumba screen.
    1. Expand the Identify a control menu and select one of the following:
      • Application Under Test – Click this button to identify a visible control directly from the application under test.
      • Screen Preview – Click this button to identify a control directly from the Screen Preview, if the application under test is not available.
      • Identify Object Dialog – Click this button to use the Identify Object dialog box to identify a non-visible control. The Identify Object dialog box additionally enables you to edit the locator of the control.
    2. Click Next.
  11. If you have selected A verification asset, the Build the Verification Asset page opens.
    1. Click Create a new verification to open the Image Verification UI, in which you can create a new verification asset.
    2. Click Insert an existing verification to open the Browse for Verification dialog box, in which you can choose the verification asset that you want to execute in your test.
    3. Optional: Check the If the verification fails, capture a screenshot check box to add a screenshot to the result file when the verification fails.
    4. Click Next.
  12. If you have selected The time taken to run a sequence of steps, the Define a timing-based condition page opens. Specify the sequence of test steps and the range of time within to play back the sequence of test steps.
    1. Click on the link to the right of the Do step statement to specify the first step in the sequence of steps to verify.
    2. Click on the link to the right of the To step statement to specify the last step in the sequence of steps to verify.
    3. By adapting the values in the two Should be between fields, sets the range of time in which the sequence of steps should play back. For example, if the range of time is set to 10 to 30 seconds and the actual time to play back a specified sequence of steps is less than 10 seconds or greater than 30 seconds, then a fail message is sent to the result of the visual test. Conversely, if the actual playback time falls between 10 and 30 seconds, then a pass message is sent to the result of the visual test.
    4. Select a timer from the Using timer number list. When timing multiple conditions, you can differentiate the timers by assigning a unique number to each timer. After creating verification logic using a timer, two test steps appear in the Test Steps window. The first is labeled Start timer number X (with X being the specific timer number) and appears just before the first test step in the sequence of steps to verify. The second is labeled Stop timer X and appears just after the last step in the sequence of steps to verify.
      Tip: If you want to change the sequence of steps to verify, cut and paste either timer test step to the desired location in the Test Steps window.
    5. Click Next.
  13. The Build the Verification page opens. Create pass/fail messages to include in the result of your visual test. Additionally, if the verification fails, you can send a flag to the result and the Start Screen of the current user.
    1. Optional: Click on the condition link to the right of the If statement to open the Condition Designer from which you can edit the condition.
    2. Type text into the Display the following pass text in the result detail field that should appear in the result when the verification passes during playback. The text appears in the Result Detail column of the verification step in the Test Steps pane of the Details tab.
    3. Type text into the Otherwise display the following fail text in the result detail field that should appear in the result when the verification fails during playback. The text appears in the Result Detail column of the verification step in the Test Steps pane of the Failed tab, Flags tab, and Details tab.
    4. Optional: Check the If the verification fails, create a flag in the result check box to create a flag when the verification fails. The flag appears in the Result Detail column of the verification step in the Test Steps pane of the Failed tab, Flags tab, and Details tab. By default, this flag is automatically assigned to the current user and displays in the Flags pane of the Start Screen of the current user. If you want to assign this flag to someone else, you must reassign it after playback from the result.
    5. Optional: Type a description of the flag when the verification fails into the Display the following flag description field.
    6. Optional: Check the If the verification fails, capture a screenshot check box to add a screenshot to the result file when the verification fails.
  14. Click Next. The Summary page displays the test logic that you have defined. Uncheck the check box at the bottom of the page to prevent the Summary page from appearing on subsequent uses of the Test Logic Designer wizard. Checking or un-checking this check box updates the Show Test Logic Designer summary screen general option. For more information, see Modifying General Options.
  15. Click Finish to insert the test logic into the test steps of your visual test. To modify the test logic, click Back and make the desired changes. The test logic is added to the visual test.