Next Practical Step
Open the failing sampler in View Results Tree, read the assertion failure message, and compare the expected pattern against the actual response body.
Fix JMeter assertion failures: Response Assertion text expected to contain, JSON Assertion path mismatches, Duration and Size assertions. Causes and fixes.
Samplers are marked failed even though the server answered, with messages such as:
Test failed: text expected to contain /expected text/Assertion failure message: ... in the JTL or View Results TreeTest failed: path expected to exist, but was not found (JSON Assertion)Duration Assertion / Size Assertion failures under loadThe response code is usually 200 โ the sampler fails because the body, duration, or size did not match what the assertion expects.
The response you asserted on is not the response you got. Either the application returned different content (dynamic values, an error page with status 200), or the assertion itself is too strict โ wrong pattern mode, wrong scope, or an un-correlated variable.
| Cause | Detail |
|---|---|
| Dynamic or localized content | Session IDs, timestamps, tokens, or personalized text baked into the assertion |
| Wrong pattern-matching mode | Matches (full regex) or Equals used where Contains / Substring was intended |
| Wrong assertion scope | Assertion applied to sub-samples (redirects, embedded resources) or to the wrong field (headers vs body) |
| Failed upstream correlation | ${var} resolves to a literal or default, so the asserted text never existed โ see extractor default value and 401/403 after recording |
| JSON path returns an array | JSON Assertion path matches [] or multiple nodes where a scalar was expected |
| Whitespace / encoding differences | Pretty-printed JSON, CRLF, or HTML entities differ from the recorded expectation |
| Server returned an error page with 200 | The body contains an error message while the status stays green |
| Negative assertions inverted | Not checkbox or Contains on a value that legitimately appears |
jmeter.save.saveservice.assertion_results_failure_message=true so JTL rows carry the message.Equals or Matches on Response Assertion; if you must use regex, escape variables with ${__escapeHtml(...)} or \Q...\E.| Resource | Use when |
|---|---|
| Assertions & SLA validation guide | Choosing the right assertion type and placement |
| Response Assertion reference | Full field-by-field documentation |
| JSON Assertion reference | JSON path expressions and operators |
| Correlation & dynamic values | Assertion fails because a variable never resolved |
| Regex extractor builder | Testing patterns against real response bodies |
JMeter does not run JavaScript or render the page, and it may receive a different body than the browser โ often because a token or cookie was not correlated. Compare JMeterโs recorded response with the browserโs actual response body, not the rendered page.
Set jmeter.save.saveservice.assertion_results_failure_message=true in user.properties so the JTL includes the failure message, then inspect the failing rows. The HTML dashboard also surfaces assertion failures per sampler.
Almost never. Assert on a stable marker (a fixed string, JSON field, or status) with Contains or Substring matching. Exact-match assertions break on every dynamic value, timestamp, and whitespace change.