Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • SoapUI Cookbook
  • Toc
  • feedback
SoapUI Cookbook

SoapUI Cookbook

By : Rupert Anderson
4 (5)
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
12
Index

Selecting mock responses using Groovy

Moving on from basic single response mocks, it is often necessary to provide different mock responses depending on the request data. SoapUI offers some simple ways to do this; SOAP mocks offer dispatch types of RANDOM, SEQUENCE, XPATH, QUERY_MATCH, and SCRIPT. REST mocks currently only have the SEQUENCE and SCRIPT dispatch types. However, once mastered, SCRIPT is, by far, the most useful and flexible dispatch type. For details on the other dispatch types, see http://www.soapui.org/Service-Mocking/simulating-complex-behaviour.html.

To illustrate the use of the SCRIPT dispatch type, you're going to learn how content negotiation can be achieved in a REST mock. Often, RESTful web services provide what is called content negotiation to optionally produce either JSON, XML, or potentially other response formats depending on the request properties. This is very easy to do with SoapUI REST mocks.

Getting ready

The two main ways to do content negotiation are...

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
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