Find Out How

Print Friendly Version

Validations

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.

Browser action validations range from simple true/false conditions such as verifyAlertNotPresent which verifies that the browser 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 on the page contains the specified text. A single browser action can have an unlimited number of validations.

Browser action validations consist of the selected command, the parameters of the selected command, a failure action, and optional log messages.

 

 

Command and parameters

In this example, Locator is the only parameter of the selected command, verifyElementPresent. As you choose different options in the command drop-down, different parameters appear underneath it.

Failure Action

The failure action is where we specify what to do when the validation condition is not met. In this example, when the specified element is not present on the page, we’ve specified to record the error in the Result object and continue running the test. Choose Halt the Composition from the drop down menu in order to stop the test when the condition is not met.

Log Messages

The log messages are where we specify custom messages to show in the Results Viewer when the validation passes or fails. Click the Show Log Messages link to expose and edit the success and failure messages.

Pattern matching

Many validations compare text with some text on the page, in order to determine if the page is correct. The comparison text can be an exact match of the expected text, a glob expression, or a regular expression.

  • Exact Match - matches against the string exactly
  • Glob - matches against a glob

A glob is a limited regular-expression pattern. In a glob pattern, * represents any sequence of characters, and ? represents any single character.

  • Reg Expr - matches against a regular expression

The full power of JavaScript regular-expressions is available.