Search code examples
jmeterperformance-testing

Why is my JMeter Response Assertion not working


I am trying to do a simple assert to check a negative instance where I get "Not found" in the Sample result and Response Data, which is expected.

I have tried:

Apply to: Main sample \ Sub-Sample

Field to Test: Text Response \ Response Code \ Response Message \ Response Header

Patterns to Test: Contains \ Substring

Pattern to Test: Not \ to \ Not Found \ found

Nothing seems to work, any idea what could be wrong?

enter image description here

enter image description here

enter image description here


Solution

  • JMeter automatically treats HTTP status codes above 399 as failures therefore you need to tick Ignore Status box if you want to mark the Sampler as successful.

    Example configuration: enter image description here

    Also be informed that Contains mode of the Response Assertion assumes that you provide a regular expression as input, most probably you need to switch to Substring instead.

    More information: How to Use JMeter Assertions in Three Easy Steps