How To… SoapUI: Basic Request And Response Logging Using Testrunner

Every month on the Third Tuesday as part of our How To…Series, we feature a new post with a guide on how to solve a particular problem with SOAP UI with guest blogger Brendan Connolly. This month he looks at request and response logging with Soap UI using Testrunner.

Browse previous posts in the How..To SOAP UI series

How To…Use Dynamic Properties

How To…REST without WADL

How To…Testing Client Timeouts And Delays

How to…complete Parsing With Groovy

This month Brendan focuses on logging requests and responses being made with SOAP UI.
———————————————————————————————————————————————

When testing interfaces via SOAP or REST it’s common to want to log the request and responses being sent. It could be to help troubleshoot failed tests or to act as documentation or reference point for comparing behaviour.

There are a variety of ways to accomplish this in SoapUI depending on desired results. Most involve using some Groovy scripting, and vary whether you are using the free or paid versions.

Before you dive into Groovy, take a look at a very simple option baked into SoapUI Test Runner Reports.  After all why add more complexity to your tests if a out of the box option suits your needs.

To launch the Test Runner Right click on a TestSuite or TestCase.

LaunchTestRunner

 

The testRunner properties window will be shown.

TestRunnerMain

Click on the Reports tab.

TestRunnerReports

Check Exports all results (not only errors) and enter the destination folder where you would like you logs to be written.
TestRunnerReportSelection

Click the Launch button to execute your tests. When the tests are finished there will be a separate file for each request / response pair. The filenames will use the format TestSuiteName_TestCaseName_RequestTestStepName_Status.txt

Notes:
If your test has multiple request and a failure occurs no further request steps will be logged.

You may need to close and reopen SoapUI after making changes to your tests and executing them from the test runner.

Example Output of TestRunner
testrunner report

About the Author

Brendan

I am a Software Design Engineer in Test based out of Santa Barbara, California. Working in a variety of testing roles since 2009. I am responsible for creating and executing testing strategies and using his coding powers for developing tooling to help make testers lives easier. He writes tests at all levels from unit and integration tests to API and UI tests. I blog on testing and automation at Brendanconnolly.net or follow me on Twitter @theBConnolly
Find out more about @brendanconnolly