Forum Discussion
2 Replies
Sort By
- LucianCommunity Hero
There is a special assertion type that does just that namely the JsonPath Existence Match. You can set an assertion as below and you're ready to go:
- JustinM89Contributor
If you just need to check that clients has child elements, I would use a Groovy script assertion. Add the assertion, right-click in the script editor and then click Get Data. Choose the test step that returns this JSON, then select 'Response' and select the clients node.
It will then add something like this to the editor:
def response = context.expand( '${Your step name#Response#$[\'clients\']}' )
response will be a string, but you can use Groovy truth to determine that it is not empty/null by doing
assert (response)
If clients has no children, this assertion will fail
Related Content
- 8 years agorvteja1990
- 8 years agomgroen2
- 5 years agofmensah