Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying SoapUI Cookbook
  • Table Of Contents Toc
  • Feedback & Rating feedback
SoapUI Cookbook

SoapUI Cookbook

By : Rupert Anderson
4 (5)
close
close
SoapUI Cookbook

SoapUI Cookbook

4 (5)
By: Rupert Anderson

Overview of this book

This book is aimed at developers and technical testers who are looking for a quick way to take their SoapUI skills and understanding to the next level. Even if you are new to SoapUI but have basic Java skills and a reasonable grasp of RESTFul and Soap web services, then you should have no problem making use of this book.
Table of Contents (13 chapters)
close
close
12
Index

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 JSON schema to validate this, invoice_schema.json has been provided in the chapter 4 samples:

{  
   "$schema":"http://json-schema.org/draft-03/schema",
   "required":true,
   "type":"object",
   "properties":{  
      "invoice":{  
      ...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY