In JMeter script, HTML Assertion is a rarely used assertion component where more stress is given to the correctness of web design and validation of the tags. HTML assertion parses the web page coming in the response using JTidy (which is an HTML syntax checker tool) and then provides output in the form of pass or fail. If the assertion fails then the output shows the number of errors and warnings.
How to add ‘HTML Assertion’?
You can follow the below steps:
- Select the ‘Sampler’ element whose HTML response needs to be validated.
- Right-click on the node
- Hover the cursor on ‘Add’
- Hover the cursor on ‘Assertions‘
- Click ‘HTML Assertion’
What are the input fields?
‘HTML Assertion’ has the following input fields:
- Name: To provide the name of the assertion.
- Comments: To provide arbitrary comments (if any)
- Tidy Settings: Instruct JMeter to perform given operations like omit (to ignore), auto (as usual), strict (check all the syntaxes) or loose (can ignore child element).
- Format: The format of the response. The available options are HTML, XHTML and XML.
- Error Only: Once it is checked then JMeter considers only errors in the syntax and omits the warnings.
- Error Threshold: To provide the count of errors which can be ignored and considered the request as pass.
- Warning Threshold: The number of warnings which can be ignored and considered the request as passed.
- Write JTidy report to file: Specify the path and name of the file where a report will be written during test execution.
You may be interested:
- Performance Testing Tutorial
- Performance Engineering Tutorial
- Micro Focus LoadRunner Tutorial
- NeoLoad Tutorial
Hi Team,
I am getting this on Assertion Results Listener.
How can I fix this?
HTML Assertion : can’t parse argument number:
Hi Harshal,
Please use Response Assertion instead of HTML Assertion and validate the content of the page instead of validating the format.