JMeter – Compare Assertion

JMeter - Compare Assertion

In JMeter, Compare Assertion is used for comparing the given text or regular expression string with the response content. I tried to find out the practical use of compare assertion but did not get any useful purpose of this assertion element. I just got to know that compare assertion consumes a high percentage of CPU and memory space and it is not recommended to use it during the load test. 

The compare assertion is basically used for either functional testing or debugging purpose. But still, I do not understand the exact use of compare assertion.

If you know any additional details about Compare Assertion or how it can be used practically then provide the information in the comment box.

How to add ‘Compare Assertion’?

You can follow the below steps:

  1. Select the ‘Sampler’ element whose response needs to be compared.
  2. Right-click on the node
  3. Hover the cursor on ‘Add’
  4. Hover the cursor on ‘Assertions
  5. Click ‘Compare Assertion’
JMeter - Compare Assertion
Figure 01: JMeter – Compare Assertion

What are the input fields of ‘Compare Assertion’?

‘Compare Assertion’ has the following input fields:

  • Name: To provide the name of the assertion.
  • Comments: To provide arbitrary comments (if any)
  • Compare Content: Instruct JMeter to perform content comparison or not. If set True then the comparison will be performed.
  • Compare Time: The input value is used to compare the response time.
  • Comparison Filters: The regular expression string which needs to be compared. 

Leave a Reply

Your email address will not be published. Required fields are marked *