User-Defined Validations for Messages

Document created by Chris Sommerstad Employee on Jul 21, 2017Last modified by Avril Dsilva on Aug 14, 2017
Version 3Show Document
  • View in full screen mode

CloudTest provides the ability to create custom user-defined validations per message via the Message Editor in the Clip Editor lower panel.
 The validation form takes some of its initial information from the given message in order to suggest some possibilities. This capability is additional to the longstanding built-in validations provided by CloudTest.

  1. To configure a validation, first select and then double-click to open the message whose response you’d like to validate in the lower panel.
  2. In the Selected: <Message Name> tab that results from Step 1, select the Validations node in the list below.

  1. The Validation form appears on the right. Click the green arrow to add a user-defined validation to the node.

The New Validation item is added to the list on the left and the form appears on the right.

  1. Select the New Validation item in the list.

  1. In the This validation field select from among:
  • Validates a portion of the response body
  • Validates a portion of the response header
  • Executes the following script
  • Executes an Existing Script

Depending on the selection made here, the remainder of the form changes accordingly. Refer to the following sections depending on the option selected here.

User-Defined Validations on Response Body

Use the following steps if Response Body was chosen above.

  1. Specify an XPath to validate.
  2. Specify the Response Type from among: XML, SOAP, JSON, PHP, HTML, or Text.
  3. Specify the Match type from among:
    1. Matches exactly
    2. Does not match exactly
    3. Matches regular expression
    4. Does not match regular expression
    5. Matches glob expression
    6. Does not match glob expression
    7. The following script is expected to succeed
    8. The following script is expected to fail
    9. Existing script is expected to succeed
    10. Existing script is expected to fail

For example, the user-defined validation below is on the message’s response body using the specified XPath and the HTML response and is set to Matches exactly. Subsequent actions on the validation will depend whether the response does in fact match.

  1. Next, specify whether to validate based on a Constant expression or a Property type.
  2. If Constant expression is selected, enter the expression.
  3. If Property type is selected, additional fields appear below.  A constant expression is an expression in which each operation is intrinsic
  4. Specify a Failure Action: from among: Fail the Clip, Record in Results only, or Honor the Message setting.

For example, the following user-defined validation uses a custom property whose owner is the Clip.

  • In the example (right), the property type was chosen from among Custom, System, or Global property.
  • The Owner was specified from the list of CloudTest objects (e.g. Composition, Band, Track, Clip, Target, Destination, Chain, or Message).
  • The property name in this case was __EVENTVALIDATION.
  • The Failure Action was chosen from among Fail the Clip, Record in results only, or Honor the Message setting.

User-Defined Validations on Response Header

Use the following steps if Response Header was chosen above.

  1. If the validation will be on the Header Name, specify that header in the entry field.

If the validation will be on a Status line, specify that status line from among code, text, or protocol.

  1. Specify the Match type from among:
    1. Matches exactly
    2. Does not match exactly
    3. Matches regular expression
    4. Does not match regular expression
    5. Matches glob expression
    6. Does not match glob expression
    7. The following script is expected to succeed
    8. The following script is expected to fail
    9. Existing script is expected to succeed
    10. Existing script is expected to fail

For example, the user-defined validation below is on the message’s response header using the Header Name, Host and is set to Matches exactly. Subsequent actions on the validation will depend whether the response does in fact match.

  • In the example (right), the property type was chosen from among Custom, System, or Global property.
  • The Owner was specified from the list of CloudTest objects (e.g. Composition, Band, Track, Clip, Target, Destination, Chain, or Message).
  • The property name in this case was property1.
  • The Failure Action was chosen from among Fail the Clip, Record in results only, or Honor the Message setting.

User-Defined Validations for Following Script

Use the following step if Following Script was chosen above. See Validation Scripts in Find Out How for examples of CloudTest validations by script.

  1. Enter the script that will validate this response.

User-Defined Validations for Existing Script

Use the following steps if Existing Script was chosen above. See Validation Scripts in Find Out How for examples of CloudTest validations by script.

  1. Click the Script icon and select the existing script using the Script Browser.
  2. Specify the Failure Action for the validation.

Attachments

    Outcomes