How do I create an assertion to check if the returned value is in a certain range? (REST)
I am having problems with the following. I have a login webservice I'm trying to setup in SoapUI. I've added certain functions of the webservice like count the amount of accounts, show me all accounts etc. My question is how do I add an assertion that checks if the returned value is between, let's say for example, 1-10. So my request looks like this:
GET http://s0acaw0048o/cbs.login.beheer.service/count HTTP/1.1
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACwALAAWAAAAAgACAAIAQAADgAOABABAAAWABYAHgEAAAAAAAA0AQAANQIIIJvW8yio1UgUScLmnJW6aiehlOVAJiv/sU/FmzEJtuhl872ZJeEPo9sBAQAAAAAAABBO19NrndIBoZTlQCYr/7EAAAAAAgAIAEMAQgBTAFAAAQAWAFMAMABBAEMAQQBXADAAMAA0ADgATwAEAA4AYwBiAHMAcAAuAG4AbAADACYAUwAwAEEAQwBBAFcAMAAwADQAOABPAC4AYwBiAHMAcAAuAG4AbAAFAA4AYwBiAHMAcAAuAG4AbAAHAAgAEeDo02ud0gEAAAAAQwBCAFMAUAB0AHMAdABrAHYAaABuAFcAMABWAEsAQQBYADIAMQA2ADgAVAA=
And the response is:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Wed, 15 Mar 2017 09:09:18 GMT
The number 7 is the current amount of accounts active. It's the method I am using now GET "activeAccountsInteger'. Since the response is on the JSON tab, I figured I would need JSONPath, but that option is not available to me, only Xpath.
So my question is: How do I create an assertion to check if the returned value is in a certain range?
This can be done by using Groovy scripting.
Click on Add assertions>For existence with script and script it using groovy.
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓