Monday 21 July 2014

Response Assertion in Jmeter

Response Assertions

 Following are some commonly used Assertion in JMeter:

   1)  Response Assertion
   2)  Duration Assertion
   3) Size Assertion
   4) XML Assertion
   5) HTML Assertion


Every response data coming from server must be checked before the transaction is termed as “PASS” or “FAIL”. The response assertion lets you add pattern strings to be compared against various fields of the server response.

It also helps in result analysis to decide total “PASS” and “FAIL” transactions.


Steps to add Response assertion in Jmeter


 Step 1) Add Response Assertion

Right-Click Thread Group -> Add -> Assertions -> Response Assertion




Step 2) Add Pattern to test
On Response Assertion Panel, click Add -> Text -> enter text to Test.





 

 Step 3) Right click Thread Group, Add -> Listener -> Assertion Results






 Step 4) Run your test





In the Results, you will see that if the pattern given in the Assertion matches, the test passes, Now purposely change the text , so that Jmeter fails the test.

Similarly you can check the response code and other parameters to be asserted while testing.

No comments:

Post a Comment