How to Assert on HTTP Response Code in Jmeter

While testing performance of web applications we would want to verify the pages are functioning as expected. But sometimes the page is too huge for the jmeter test client to download, or some times you are not concerned about the contents of the response page, rather you just want to make sure the page is delivered, i.e. there are no 404 or 500’s , but the response code is 200 OK, or redirect 302 , which ever is expected in your test scenario.

solution :

In the Response Assertion you should select “Response Code” rather than the default response, and add 200|302 if you are expecting redirect or 200 if you want to test if the page is being delivered without at issues.

Advertisements

1 Comment

Filed under JMeter

One response to “How to Assert on HTTP Response Code in Jmeter

  1. Thanks for useful tip. However by defaulf 40x and 50x respones codes are considered as errors so it worth mentioning that “Ignore Status” box should be ticked for these response code ranges. Check out How to Use JMeter Assertions in 3 Easy Steps guide for in-depth information on all assertions types available in Apache JMeter.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s