Book Image

SoapUI Cookbook

By : Rupert Anderson
Book Image

SoapUI Cookbook

By: Rupert Anderson

Overview of this book

Table of Contents (19 chapters)
SoapUI Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a custom RequestFilter (Listener) plugin


Custom event listeners allow for extensions that run when things (events) happen in the SoapUI framework. There are certain situations where this can be a nice way to add functionality. Typical examples would be cross cutting concerns; for instance, additional custom logging after a test has run (TestRunListenerAdapter) or modifying a request before a request is dispatched (RequestFilter). In this recipe, we'll first take a quick look at the various types of Listener interfaces, then code a simple plugin to use a RequestFilter to intercept a REST request; and log its URI and add a new parameter to it before the request is dispatched.

All Listeners extend the SoapUIListener interface. The current list is shown here:

Under the interfaces you will find one or more sub interfaces and/or implementations that listen for the particular type of event. For example, you can see above that the SoapUITestCaseRunner (used to script SoapUI tests, see Chapter...