XML Validation configures a set of rules that validate that message content is as expected. Rules are associated to X-Path values.
X-Path Validation Rule
You can create your validation from an existing message, which can simplify the process, or manually.
To create from a message:
- Run the Action containing the task. This will add messages to the “Sample Message to Validate” area.
- Right-click the desired field in the message and select Add Validation.
To create manually:
- Click the Add button in the Validations grid.
- Specify the X-Path that the validation will be applied to.
- Change the operator, if needed.
- If several rules are set, modify the and/or logical operator and parenthesis so the rule evaluation is done correctly.
You can edit the criteria by clicking on the cell to set a basic text value. In addition, you have access to the Variable Editor and the Criteria Editor, which are opened by right-clicking on the criteria cell. From there, you can insert a Variable or a Field Value criteria by specifying its location.
Enabling/Disabling a Validation Rule
It may be necessary to temporarily disable a validation rule so it is no longer evaluated during test execution. To disable a rule, uncheck the check box in the very first column of the X-Path Validation table. To re-enable it, recheck the check box to the initial state.
You can use And, Or and Parentheses to perform more advanced conditions for your validations.