While this approach has the benefit of ensuring the response object includes the expected values for the specified properties, it is also verbose and cumbersome to maintain.
Wouldn’t it be nice if the test could look more like this?
The JSON Schema project intends to shepherd the Core, Validation, and Hyper-Schema specifications to RFC status.
Currently, we are continuing to improve our self-published Internet-Drafts.
Another method available on the the Json Path class is param.
Param allows us to set parameters that can be used in the groovy expression.
Many apps and services produce and consume data in JSON format.
If you’ve worked on a test-driven Following the four-phase test pattern, the test above executes a request to the current user endpoint and makes some assertions about the structure and content of the expected response.Behind the scenes, the various get methods available on the Json Path object use the Groovy Collection object, before mapping the results back to Java objects.This means we can for example use the find(Closure closure) method, passing a closure to specify our criteria.The next step will be to get the drafts adopted by an IETF Working Group.In the meantime, publication of Internet-Draft documents can be tracked through the IETF: Internet-Drafts expire after six months, so our goal is to publish often enough to always have a set of unexpired drafts available.