Tuesday, February 21, 2012
Adding Response Assertions
It is often important that we validate the response we receive for every request we had sent to the server.
We can achieve this by adding a response assertion to the sampler.
There are various types of assertions you will have to identify what serves your purpose & work accordingly.
Add a response assertion by right clicking on the sampler > Assertions > Response Assertion - Have a look at the fig1
Now that we have added a response assertion let's have a closer look at the settings & values we are looking for identifying/validating our response.
1.Add a name to teh response assertion so that you know when it fails.
2.Select the radio button Main Sample only - this looks for text you are looking for in the main sampler.
3.Let's select "Text Response" as we are going to validate the same.
4.Pattern of matching - Helps in identifying what operation rules you want to apply a wider search pattern would be "Contains" so that pattern matching ignores the pre & post text & just look for "Pattern String".
5.In Patterns to Test - Click the Add button just below the patterns to test "enter the text you want to validate".
It is that easy ... Adding a response assertion.