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

Providing environment-specific properties


A common requirement when running SoapUI tests from scripts is to be able to provide different hostnames, ports, and file paths for different test environments. This recipe shows some easy ways to do this.

How to do it...

We'll look at two different ways to set the endpoint for Test Request TestStep in SOAPMock-soapui-project.xml. For the examples, assume that there is a mock service that is running http://localhost:9001/mockInvoicePortBinding. Perform the following steps:

  1. Perhaps, the simplest way is to use the –e endpoint parameter to override the Test Request TestSteps endpoint, for example:

    ./testrunner.sh -e http://localhost:9001/mockInvoicePortBinding <chapter3 samples>/SOAPMock-soapui-project.xml
    
  2. Another more flexible way is to set the endpoint using a property, for example:

    • Add a project-level property:

    • Use a property expansion to set the TestSteps endpoint:

    • Provide the value for the property using –Pname=value:

      ./testrunner.sh -Pendpoint...