As discussed in the earlier post XML Assertion is a generic assertion element which is mainly used to validate the format of XML embedded in the response. When we have a requirement to validate the specific XML response then XML Schema Assertion is used in the JMeter script. In this type of assertion, we can provide the XML Schema file (along with path) which needs to be compared with the actual response. When the response is matched with the schema then the sampler is passed else failed with an error.
How to add ‘XML Schema Assertion’?
You can follow the below steps:
- Select the ‘Sampler’ node whose response needs to be validated.
- Right-click on the sampler element
- Hover the cursor on ‘Add’
- Hover the cursor on ‘Assertions’
- Click ‘XML Schema Assertion’
What are the input fields of ‘XML Schema Assertion’ element?
‘XML Schema Assertion’ has the following input fields:
- Name: To provide the name of the assertion.
- Comments: To provide arbitrary comments (if any)
- XML Schema: To specify the path and file name of the schema.