user9552213
user9552213

Reputation: 33

Response Status: 200 OK but Response body is Null in JMETER

For one of my Requests in jmeter, I am getting Response code as 200 OK but Response body is NULL. Due to this "Response Assertion" is failing since we are expecting Response to generate. Here i am unable to get as to why the status code is 200 even though Response body is null.

Sampler result showing Response status as 200

Response Data SS

Response assertion

Upvotes: 2

Views: 4841

Answers (1)

Dmitri T
Dmitri T

Reputation: 168002

If you're expecting HTTP Status Code to be 200 and not interested in the body - amend your Response Assertion configuration as follows:

  • Fields to Test: Response Code
  • Pattern Matching Rules: Equals
  • Patterns to Test: 200

This way your assertion will pass.

enter image description here

Check out Response Assertions in JMeter 3.2 - New and Improved article for more information on using Response Assertion to conditionally mark Samplers as passed or failed


If you expect the request to return some body data - then assertion failure is correct and I can think of the following options:

  1. You're sending a malformed request hence not getting a response, cross check the request with the API contract or with the other API testing tools like SoapUI or Postman
  2. There is a bug in your application. Status code 200 doesn't necessarily mean success and vice versa
  3. If the situation happens only under the load it might be the case you found the bottleneck

Upvotes: 1

Related Questions