Validating scalar fields

Validation enables decisions about sent and received messages to be made automatically at test time. A validation is made up of one or more actions.

Under the Validate tab, the default configuration contains three validation actions, as follows:

Table 1. Validate actions
Name When checked, enables name validation (that is, valid when the name field is the same).
Type When checked, ensures that the field type is the same as what is specified (that is, String, Integer, and so on)
Equality When checked, validates that the value of the field equals what is expected. Equality is the default action, but it can be changed as described in Action types.

You can add more validations by clicking New. To delete a validation that you added, select it and click Delete.

Note: The default validations cannot be deleted.

To duplicate any validation (except for the Name and Type validations), select it and click Clone. The validations that are in the editor can be enabled and disabled by selecting or clearing the selection.

Validate tab

Details about the different validation actions are provided in the following topics:

Equality

If Equality is chosen, the value to validate must be entered in the text field. The value can be pasted or loaded from a file, as described earlier.

Equality action type options

Length

If the required validation type is Length, specify the minimum and maximum lengths of the field value in the appropriate fields.

Length action type options

Regex

If Regex is selected as the action type, the regular expression that is used to validate the field must be entered in the text field.

Regex action type

To help in building regular expressions, a testing utility is available. By clicking Test, you can verify your expression against any arbitrary content without waiting for a full test that is run to show the results.

Values to validate against can be entered in the Document field. Alternatively, you can click Browse to locate and select a test document, the contents of which are loaded in the Document field.

Schema

To validate the field value against a schema, select the Schema action type.

The From Document option indicates that the schema location is taken from the document (message) that is currently being processed. If the document does not define a schema location, the action will fail.

To select a different schema from the list of available schemas for the currently selected project, select the Specified schema source option and select the required schema.

Note: With the exceptions of SWIFT and Financial Information eXchange (FIX) formats, you must import a schema into Rational® Integration Tester before you can use it. For more information, see Schemas.
Note: If you are using Rational® Integration Tester 8.6.0 or later, you can validate any messaging action against a specific WSDL document in your project.

Is null and not null

The Is Null and Not Null validations simply check whether the specified field is null or has some value.

XSD type

The XSD Type validation simply checks whether the field is of the correct type as specified by the XSD used to build the message.

Assert by using function

To validate by using an Rational® Integration Tester function, select the Assert using Function action.

Assert by using function action type

Use the menu to select any function that returns a Boolean type, which determines whether the assertion passes or fails. You can access the value of the field within the message by using the FIELD/VALUE tag, as shown.

Note: Message validation is performed before the evaluation of Store actions. Which means that although it is possible to reference tags within the same message, they do not contain data from the incoming message at the point when the function is evaluated (that is, it is not possible to compare two fields from the incoming message by using the Assert using Function action).

XPath

If XPath is selected as the action type, the XPath expression that is used to validate the field must be entered in the text field.

Xpath and Regex action type

To help in building regular expressions and XPath expressions, a testing utility is available. By clicking Test, you can verify your expression against any arbitrary content without waiting for a full test that is run to show the results.

Values to validate against can be entered in the Document field. Alternatively, you can click Browse to locate and select a test document, the contents of which are loaded in the Document field.

JSONPath

If JSONPath is selected as the action type, the JSONPath expression that is used to validate the field must be entered in the text field.

JSONPath action type

To help in building JSONPath expressions, a testing utility is available. By clicking Test, you can verify your expression against any arbitrary content without waiting for a full test that is run to show the results.

Values to validate against can be entered in the Document field. Alternatively, you can click Browse to locate and select a test document, the contents of which are loaded in the Document field.