You have a high degree of customization possibilities is soapUI; Printable Reports in soapUI Pro are based on the JasperReports reporting engine which is very flexible. The reports are generated from JasperReports specific XML-based templates which can be customized at both project and global level, making it easy to have a common Look & Feel in all reports you create.
Creating Printable reports in soapUI is easy; just select the corresponding report from the Report Type drop-down in the Create Report dialog as shown in the Getting Started document, the selected report will automatically be compiled and generated as configured.
1. Report Management
The soapUI Project Window contains a Reporting tab where all global and project specific reports are available:
The different sub tabs gives you access to the underlying XML for main reports, sub reports and templates as well as project level report parameters. Project level items can be created, removed and edited as desired, while global items can not be modified inside soapUI. They have to be modified in the file system and reloaded with the Reload button in the top toolbar for changes to be applied (more on that later on).
2. Report Structure
soapUI structures reports as follows:
- Main Reports are the top level templates which are shown in the Create Report dialog and visible in the Available Reports tab above. A Main Report template is a standard jasperReport template which receives the report-scope specific model item as its DataSource, for example when generating a LoadTest report the data object passed to the report is a WsdlLoadTest, whose properties can be defined as Jasper fields in the report and used as such.
- Main reports can include any number of Subreports (shown in the Subreports tab) through the standard JasperReports subreport mechanism in combination with a soapUI-specific URL prefix ("subreport:"). A Subreport gets its data from the specified DataSource which is available when the report is being generated. Looking at the Subreports tab we can see all available subreports and their corresponding DataSource:
For example, the MetricsReport subreport gets its data from ReportMetrics DataSource and is included in the all main reports with the following syntax:
As you can see the subreportExpression uses a soapUI-specific "subreport:" URL-syntax which soapUI uses to locate the specified SubReport template. The fields exposed by the TestSuiteMetrics DataSource are correspondingly defined in the MetricsReport template:
y="98" width="535" height="30" isRemoveLineWhenBlank="true">
- Templates allows for management of common blocks of template XML. The tab is as follows:
The above example template can then be inserted to any report with the familiar property expansion syntax:
- Finally, Parameters allow for parameterization of report content without the need of recompiling the underlying template. The Parameters tab allows you to add parameter values as desired:
Parameter values are passed to JasperReports as standard Jasper parameters, for example the main templates all define the above HeaderLogo parameter:
which is consequently used further down:
So let's recap; report structure is Main Report -> Subreport(*), any of these can refer to any number of Templates (via property expansion) or Parameters (via Jasper Parameters).
3. Report Storage
All global report templates are stored in the file system under the soapUI-Pro\bin\reports folder:
The base folders are:
- logos : contains any images that are referenced with the logo: protocol
- reports : contains all global main-report templates, each subfolder corresponding to the Report Type column in the Available Reports tab
- subreports : contains all global subreport templates, each subfolder corresponding to the Report Type column in the Subreports tab
- templates : contains all global templates
Opening one of these folders reveals the following:
Here you can see that each template is saved as two files:
- A *.jrxml file which is a "clean" jasper template that can be edited in any JasperReports editor or any text editor
- A *-config.xml file (named after the jrxml) that contains metadata for the template used by soapUI.
If you want to change the template contents of any global items, do this directly in the file system (by modifying the jrxml file) and press the "Reload" button in the Reporting tab toolbar after saving your changes:
Styles and Images
The default reports use a common styles template named styles.jrtx (seen in the screenshot above). It is included in the reports using:
The file contains a number of style definitions for headlines, etc:
Modify this file will change the general look of all your reports.
Correspondingly, logos and images can be stored in the logos folder and referenced with:
Custom Global Reports
If you want to customize the look of global reports without modifying the default ones, you can use the Custom Global Reports feature;
- Create a copy of the global reports folder locally
- Apply desired customizations to the templates in this folder
- Specify the path to the folder in the global soapUI Pro Preferences:
- Reports and templates created here will be shown as global reports in the different Reporting Tabs and used as such.
Project Level Report Storage
When you create custom reports at the project level, these are stored in the project file together with the rest of the project data, allowing for easy redistribution. If you save the project as a Composite Project in soapUI Pro, the reports will be saved in a file structure similar to the global one in the Composite Project folder, allowing you to edit these reports using external tools just like you can do for global reports. Use the Reload button described above to reload updated templates as required.