Here are the steps:
- Prepare a request returning the data you need
- Create a Test Suite
- Create a Test Case within that Test Suite
- Add that request as the step to the Test Case
- Open that step editor
- In the bottom left corner click "Assertions"
- Click [+] (add) button
- In "Add Assertion" dialog select "Property Content" (right hand pane)
- In the list of shown matchers select which matcher will match (lol) your needs. For example you may want to count the number of nodes matching your conditions.
- Describe the JsonPath expression for your case. See reference here. The expression might depend on what the entire schema of your returned object is. Here is the example:
$..[?(@.minStudentAge > 15 && @.minStudentAge < 25)]
- Specify the expected result. For example for JsonPath Count matcher it could be
1
Now you have the test case that asserts your field value.
UPD: As it turned out, there is an issue in Soap UI that breaks parsing of JsonPath expression if there is ||
(or) condition used. Hence, instead of using one assertion like this:
$.result.[?(@.minStudentAge < 15 || @.minStudentAge > 25)]
it is better to have two separate asserts specified for the test case:
$.result.[?(@.minStudentAge < 15])
$.result.[?(@.minStudentAge > 25])
This will work pretty much like the single condition with or operator, however this might be even more useful because when fail you will get more concrete error message for your test (that will fail if any of assertions fail).