Assertion or verification is important in testing, by using this we can ensure that our testing is going in right direction. Suppose we sent a request to server and get some response but here how we ensure whether we are getting correct response or not. So by using assertion we can ensure for correct response at run time, if response is not correct then test will fail for that request.
In my previous post, I posted “http://roadtoautomation.blogspot.com/2013/05/road-to-jmeter-data-driven-testing-of.html”, today I continue from that post so you need to read previous post before this.
For this post I have changed values of data csv file and added a new Colum for “ConversionRateResult” and put corresponding correct values except for “USD,BBD: 2.44”.
In my previous post, I posted “http://roadtoautomation.blogspot.com/2013/05/road-to-jmeter-data-driven-testing-of.html”, today I continue from that post so you need to read previous post before this.
For this post I have changed values of data csv file and added a new Colum for “ConversionRateResult” and put corresponding correct values except for “USD,BBD: 2.44”.
Now I added “Response Assertion” in jmeter test as selecting below options
Add new variable name “value” in “CSV Data Set Config’ as below:
Now select created “Response Assertion” and add variable ${value) as below:
When I run Jmeter test, “Response Assertion” verify responses with corresponding values mentioned in csv data file. If it mismatch then test will fail
After execution Jmeter test failed only for wrong value and shown below error message.
"Assertion error: false
Assertion failure: true
Assertion failure message: Test failed: text expected to contain /2.44/"
Actually it's better to use XPath Assertion as it's more suitable for XML web service data. Check Using the XPath Extractor in JMeter for more details
ReplyDeleteI tried this, but this doesn't work at my end. Do I have to configure anything else?
ReplyDeleteFrom Currency and To currency are in SOAP REQUEST where as “ConversionRateResult" is in SOAP RESPONSE
so. here we have not defined the SOAP RESPONSE variable anywhere in jmeter SOAP/XML-RPC Request
Hello, I have an issue with "When I run Jmeter test, “Response Assertion” verify responses with corresponding values mentioned in csv data file."
ReplyDeleteThe Response values are not getting asserted with values in csv file. How do I handle this?
Thanks,