Exporting custom reports using Groovy
Another option to create reports is to use a Groovy TestStep. Consider these situations:
You need to include extra information that is not available via one of the standard reports, for example, by accessing test framework objects or other test data.
You would like to produce a custom report format, for example, HTML or PDF.
You would like to use the report later in
TestCase
; for example, use theEmail TestStep
(see the Sending e-mails with the Email TestStep plugin recipe of Chapter 10, Using Plugins) to e-mail the results somewhere.
In this recipe, we'll see how to extract test results from the SoapUI framework classes and export the data to a custom XML report file using Groovy.
Getting ready
The SOAPDBMock-Reporting-soapui-project.xml
project from the chapter 6 samples will be used to illustrate this recipe. You can find the Groovy script under the TearDown Script tab on GetInvoiceTestSuite
(the file creation is commented out to save you from any path...