Validations for Browser or App Actions

Document created by DPM Admin Employee on Jul 20, 2017Last modified by Dave Murphy on Sep 26, 2017
Version 3Show Document
  • View in full screen mode

Validations are the technique used to verify that a test event occurs as expected. For example, text on a web site landing page after login or in a WebUI or mobile app after a view is loaded.

  • For browser and app actions, out-of-the-box validations can be added Clip Editor, List View (when an action is expanded) or via the lower panel wheever a given action is open in the Action Editor.
  • For message validation, refer to User Defined Validations instead.

Out-of-the-box action validations range from simple true/false conditions such as verifyAlertNotPresent, which verifies that the action did not cause an alert to appear, to more complex conditions such as verifyTableCellText which verifies that a particular cell in a given table contains the specified text. A single message, browser action, or app action can have an unlimited number of validations.

For a complete reference to App Actions, refer to the TouchTest Advanced Tutorial, App Action Reference section.

Message and action validations consist of the selected command, the parameters of the selected command such as pattern matching, where applicable, and a failure action (represented by the "Errors should" field), as well as log messages that can optionally be customized.

Adding a Validation to an Action

  1. In the Expanded view, use the mouse to hover over the clip element.
  2. Click the Valdiations  node on the Add toolbar.

When you do so, a new Validation form is added.

  • To open an action in the lower panel, select and then double-click it.
  1. Select a validation from the Command drop-down. The Command drop-down presents the list of available validations (prefixed with verify...). Subsequent parameters depend upon the wait selection made here.

In the default validation (above) verifyElementPresent, Locator is the only parameter of the selected command that requires definition. As you choose different options in the Command drop-down, different parameters appear underneath it.

  1. Where required, enter a locator. You can copy and paste a Locator from the Input field of a given action.

Note:  Locators are unique characteristics that identify a specific element or object for the given action. The form of the Locator generally varies according to the type of validation. For a browser or app action it may be the name of an element on the page such as submitButton or classname=PieceImageView[13].

  1. Select a Failure Action from the Errors should: drop-down

The Errors should drop-down specifies what failure action to take when the validation condition is not met.

  • If the failure action is set to be recorded only, the validation outcome will be recorded in the result, and the test composition will continue whether the validation passes or fails.
  • If the failure action is set to fail the Clip, the test composition will stop if the validation fails.
  • If the failure action is set to Honor the (Browser or App) Action or Message setting, the validation inherits the parent setting from the action/message.

  1. Where required, specify a pattern to match.

Many validations compare text by matching the pattern of some text on the page in order to determine if that page is correct. The following pattern match types are offered:

    • Exact Match – matches against the string exactly
    • Glob – matches against a pattern using Java glob notation.

A glob is a limited regular expression pattern. In a glob pattern, * represents any sequence of characters, and ? Represents any single character. Many personal computer users are familiar with globs through file matching expressions such as “*.jpg.”

  • RegEx – matches against a regular expression using Java regular expression notation.

Note: CloudTest script authors should note that the Regular expressions within a CloudTest script (via the RegExp object or the /pattern/ notation) are JavaScript regular expressions. These JavaScript regular expression versions differ in important ways and the two are not interchangeable, so expressions cannot be copied from a CloudTest script to an include/exclude for pages, to a session template, or to a Wait, PropSet, or Validation, and vice versa.

Some validations have additional fields, such as the Property field shown above for verifyElementPropertyValue.

  1. Optionally, double-click the Action to open it in the lower panel in order to customize its Success/Error messages. Click Show/hide to add or revise Success/Error messages for display in results. The log message fields specify custom messages to show in Result Details when the validation passes or fails.

Editing a Validation

Validations are the technique used to verify that a test event occurs as expected. For example, you can validate the text that you expect to appear in a mobile app after a given view is loaded.

  1. Locate the validation  and expand its attributes.

  • If a Locator has been specified for a validation then the Property icon is active. You can combine locators with expressions selected from among the available property values using the ISSE Editor.

 

  • For those validations that take a locator, you can also use the Locator icon to enter Touch Locator mode and change the selection. Note that the Locator icon is only active while in record mode.

 

 

Attachments

    Outcomes