Testing response compliance using JSON schemas
Do you have REST responses that you'd like to validate against a JSON schema? This recipe shows a simple way to do this using a Groovy
TestStep.
Getting ready
First, we're going to need a simple test project with a mock that produces some sample JSON responses for us to validate. A ready-made project invoice-rest-json-schema-soapui-project.xml
has been provided to do this in the chapter 4 samples. It contains a simple REST project with one resource GET /invoice/{id}
, a mock with two sample responses, and a test case with REST
TestRequest and Groovy
TestSteps. The invoice document is the usual example; that is:
{"invoice": { "id": 12345, "companyName": "Test Company", "amount": 100 }}
We'll also need a ...
Get SoapUI Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.