User-Defined Database Validations

Document created by Chris Sommerstad Employee on Jul 20, 2017Last modified by Jijius Jabez on Aug 10, 2017
Version 2Show Document
  • View in full screen mode

CloudTest provides the ability to create custom user-defined validations per database action. Validations can be defined in Clip Editor, List view, or via the Clip Editor lower panel, Action Editor.

    1. To configure a database validation, do either of the following:
      • In List view, select and expand the action whose response you’d like to validate.

      • In Icon view, select and double-click the database action to open it in the lower panel.


  1. Add the Validation to the action by clicking the Validation icon (in List view) or the Validation tab and green Plus (+) icon (in Icon view).

The New Validation item is added to the action.

  1. Give the new validation a name.
  2. In the Validate field select from among:
    • Body – This validates a portion of the SQL response by matching.
    • Linked Script – This validates a portion of the SQL response using an existing script (in the repository)
    • Embedded Script – Executes the entered (or pasted) 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 Database Validations using Body

Use the following steps if Body was chosen above.

  1. Optionally, specify an XPath to validate only a portion of the response identified by the XPath. For example, if the response of the the database action is XML, then you can run XPath on it to return a value and then validate whether that value (returned by XPath) is as expected.
  1. Specify the Response Type from among: XML, SOAP, JSON, PHP, HTML, or Text.
  2. Specify the Match type from among:
    1. Exact Match – Matches exactly
    2. RegEx – Matches regular expression
    3. Glob – Matches glob expression
    4. Script – The script is expected to succeed

For example, the user-defined validation below is on the action’s body and is set to Exact Match. The value shown being validated below is:

11g,123456.780,123456.78,true,MHgwMTAyMDMwNDA1MDYwNzA4,2013-06-25,01:02:03,2013-06-25 01:01:01 -07002,"PostgreSQL
""9.3""",234567.890,234567.89,true,MHgwMjAzMDQwNTA2MDcwODA5,2013-06-25,02:02:02,2013-06-25 02:02:02 -07003,SQL Server
2012,345678.900,345678.9,false,MHgwMzA0MDUwNjA3MDgwOTEw,2013-06-25,03:03:03,2013-06-25 03:03:03 -07004,\N,\N,\N,\N,\N,\N,\N,\N


Note: If you've extracted a property using the Property Sets tab or want to click any existing Global, System, of Custom Property, click the Property icon to use the Property Chooser. Take note that scope must be set if you're validating something outside of the current scope.

  1. Specify the Failure Action for the validation.

User-Defined Database Validations using Embedded Script

Use the following step if Embedded Script was chosen above. See Validation Scripts for examples of CloudTest validations by script.

  1. Enter the script that will validate this response.
  2. Specify the Failure Action for the validation.

User-Defined Validations for Linked 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.