SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

Jmeter - Response Assertion To Assert Response Message

Earlier we learnt how to use response assertion in your jmeter software load test to assert response code of request in my previous post. So now you already aware about how response assertion works. Here we will see example on how to use response assertion in your software load test to assert response message.

Example : Assert Response Message Using Response Assertion
I have prepared simple example on how to assert response message of request using response assertion. If HTTP request has been succeeded then we will get response message OK.

We will assert response message for bellow given 2 requests.
  1. newtours.demoaut.com(Valid URL which returns response message : OK)
  2. newtours1.demoaut.com(Invalid URL which returns response message : Non HTTP response message)
All other configuration is same as described in my PREVIOUS POST except response assertion configuration. Configuration of response assertion for both requests is as bellow.
  • Apply To = Main Sample only.
  • Response Field to Test = Response Message.
  • Pattern Matching Rules = Contains.
  • Pattern To Test = OK.


Note : Both assertions have same configuration in above software load test plan.

Now if you run above example software load test plan, Assertion results for both requests will look like bellow.


In result you can see that assertion of valid request is pass as response message is received "OK" but assertion of invalid request is failed as response message received "Non HTTP response".

This way you can assert response message of request using response assertion in software load test plan.
<< PREVIOUS || NEXT >>

No comments:

Post a Comment