You are previewing SoapUI Cookbook.
O'Reilly logo
SoapUI Cookbook

Book Description

Boost your SoapUI capabilities to test RESTful and SOAP APIs with over 65 hands-on recipes

In Detail

Packed with practical guidance, this book will show you how to build core SoapUI skills, integrate open source libraries, and code the extra functionality needed to quickly overcome common and advanced API test problems.

Building up your skills, you will progress to more advanced topics such as Groovy scripting, testing secured services, load test concurrency issues, using plugins and developing your own!

So when out-of-the-box SoapUI can't do exactly what you need or the quick guidance you require just isn't there, then take, tweak, and use what you need from a broad range of practical examples in this book and customize your way to API testing success with coverage of SOAP, REST, and Groovy.

What You Will Learn

  • Generate tests, refactor interfaces, and learn how to develop stub REST and SOAP service implementations using Java

  • Create data-driven tests and check results using MySQL, in-memory H2 DB, MongoDB, file, and ActiveMQ datasources

  • Develop dynamic data-driven REST and SOAP service mocks using Groovy scripting to quickly provide realistic test service implementations

  • Automate functional and load tests and run mocks by creating Shell, Java, JUnit, Gradle, Groovy, and Maven scripts

  • Test AWS and OAuth 2 cloud-based services including Dropbox and Google's Gmail API

  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. SoapUI Cookbook
      1. Table of Contents
      2. SoapUI Cookbook
      3. Credits
      4. About the Author
      5. Acknowledgments
      6. About the Reviewers
      7. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      9. 1. Testing and Developing Web Service Stubs With SoapUI
        1. Introduction
          1. What you'll learn
          2. What you'll need
        2. Generating a WSDL-first web service using SoapUI tool integration
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Developing a SOAP web service test-first
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Updating a SOAP project using a WSDL
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Updating SOAP projects using WSDL refactoring (Pro)
          1. Getting ready
          2. How to do it...
          3. There's more...
        6. Generating and developing a RESTful web service stub test-first
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Code-first REST services
          5. See also
        7. Generating SoapUI tests with REST discovery (Pro)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      10. 2. Data-driven Testing and Using External Datasources
        1. Introduction
          1. What you'll learn
          2. What you'll need
        2. Creating and checking data with the JDBC Request TestStep
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Parameterizing SQL queries with the JDBC Request TestStep
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        4. Setting properties from an external file
          1. Getting ready
          2. How to do it...
          3. How it work...
          4. See also
        5. Importing CSV file data into an in-memory H2 database with Groovy
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Looping over CSV file data and driving tests with Groovy
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Querying MongoDB with Groovy
          1. Getting ready
          2. How to do it…
          3. How it works...
          4. There's more...
          5. See also
        8. Publishing, browsing, and consuming ActiveMQ JMS messages via the REST API
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      11. 3. Developing and Deploying Dynamic REST and SOAP Mocks
        1. Introduction
          1. What you'll learn
          2. What you'll need
        2. Selecting mock responses using Groovy
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Developing dynamic database-driven SOAP mocks
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Developing dynamic database-driven REST mocks
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Building mock responses dynamically
          1. How to do it...
          2. How it works...
          3. There's more...
        6. Deploying mocks as WAR files
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      12. 4. Web Service Test Scenarios
        1. Introduction
          1. What you'll learn
          2. What you'll need
        2. Testing WSDL and response WS-I compliance
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Testing SOAP response schema compliance
          1. Getting ready
            1. How to do it...
            2. How it works...
            3. There's more...
            4. See also
        4. Testing REST response XML schema compliance
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Testing response compliance using JSON schemas
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Need XML schema validation?
          5. See also
        6. Testing and mocking SOAP (MTOM+XOP) attachments
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Testing HATEOAS links
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        8. Testing polling style asynchronous REST services
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        9. Testing asynchronous SOAP service callbacks
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Testing for e-mails with Groovy
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        11. Testing files with Groovy
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      13. 5. Automation and Scripting
        1. Introduction
          1. What you'll learn
          2. What you'll need
        2. Running mocks from the command line
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Running tests from the command line
          1. Getting ready
          2. How to do it…
          3. How it works...
          4. There's more...
        4. Providing environment-specific properties
          1. How to do it...
          2. How it works...
          3. See also
        5. Generating mock WAR files from the command line
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Running mocks and tests using Maven
          1. Getting ready
          2. How to do it...

          3. How it works...
          4. There's more...
          5. See also
        7. Running mocks and tests using Java and JUnit
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Running mocks and tests using Groovy scripts
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        9. Running mocks and tests using Gradle
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      14. 6. Reporting
        1. Introduction
          1. What you'll learn
        2. Generating reports from test runners
          1. Getting ready
          2. How to do it...
            1. Standard reports
            2. Summary reports
            3. JUnit Reports
            4. AlertSite Reports
          3. How it works...
          4. There's more...
            1. Pro test runner options
        3. Publishing JUnit reports using Jenkins
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Exporting custom reports using Groovy
          1. Getting ready
          2. How to do it…
          3. How it works...
          4. There's more...
        5. Analyzing test, HTTP, and mock coverage (Pro)
          1. Getting Ready
          2. How to do it...
          3. How it works...
            1. Contract coverage
            2. Assertion coverage
          4. There's more…
            1. HTTP coverage reporting
            2. Mock coverage reporting
            3. REST coverage reporting
          5. See also
      15. 7. Testing Secured Web Services
        1. Introduction
          1. What you'll learn
        2. Testing basic HTTP-authenticated RESTful web services
          1. Getting ready
          2. How to do it...
            1. Smoke test
            2. Tomcat HTTP Basic authentication setup
            3. SoapUI HTTP Basic authentication testing
          3. How it works...
          4. There's more...
          5. See also
        3. Testing HTTP Digest-authenticated RESTful web services
          1. Getting ready
          2. How to do it...
            1. Tomcat HTTP Digest authentication setup
            2. SoapUI HTTP Digest authentication
          3. How it works...
          4. There's more...
          5. See also
        4. Testing HTTP form-authenticated RESTful web services
          1. Getting ready
          2. How to do it...
            1. Setting up Tomcat form authentication
            2. Adding the login pages to helloworld-webapp
            3. Testing with SoapUI
          3. How it works...
        5. Creating and using X.509 certificates to test web services over HTTPS
          1. Getting ready
          2. How to do it...
            1. Enabling HTTPS in Tomcat
            2. Testing the service over HTTPS
          3. How it works...
          4. There's more...
          5. See also
        6. Testing client certificate authenticated web services
          1. Getting ready
          2. How to do it...
            1. Client certificate creation and keystore setup
            2. Tomcat configuration
            3. Enabling client certificate authentication in SoapUI
          3. How it works...
          4. There's more...
        7. Securing mock services using X.509 certificates
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Testing WS-Security UsernameToken, Timestamp, and TransportBinding
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Scanning web service security vulnerabilities
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      16. 8. Testing AWS and OAuth 2 Secured Cloud Services
        1. Introduction
          1. What you'll learn
          2. What you'll need
        2. Testing Dropbox using a pregenerated OAuth 2 Access Token
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Testing Dropbox using OAuth 2 Authorization Code Grant flow
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Testing Dropbox using OAuth 2 Implicit Grant flow
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Testing the Gmail API using OAuth2
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Automating OAuth 2 authentication and consent
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Testing AWS services using Access Key authentication
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      17. 9. Data-driven Load Testing With Custom Datasources
        1. Introduction
          1. What you'll learn
          2. What you'll need
        2. Load testing data-driven TestCases concurrently with separate Groovy datasources
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Load testing data-driven TestCases concurrently with a shared Groovy datasource
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Load testing data-driven TestCases concurrently with a shared distributed datasource
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Running load tests using Maven, command line, Java, Groovy, and Gradle scripts
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      18. 10. Using Plugins
        1. Introduction
          1. What you'll learn
        2. Using old-style (open source) plugins
          1. Why are they called old-style?
          2. Getting ready
          3. How to do it...
          4. How it works...
          5. There's more...
          6. See also
        3. Sending e-mails with the Email TestStep plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Using plugins via the plugin manager (Pro)
          1. How to do it...
          2. How it works...
          3. See also
        5. Using the Groovy Console plugin to create and run a new TestStep
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Packaging old-style plugins when running tests with Maven
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      19. 11. Taking SoapUI Further
        1. Introduction
          1. What you'll learn
        2. Building, packaging, and running SoapUI from the source code
          1. Getting ready
          2. How to do it...
          3. There's more...
          4. See also
        3. Importing, building, running, and debugging SoapUI in Eclipse
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Developing a Groovy plugin with custom Action using Gradle
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Logging from extensions and scripts
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Prompting for user input with the UISupport class
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Creating a custom RequestFilter (Listener) plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Creating a custom TestStep (Factory) plugin to check whether a file exists
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      20. Index