Reporting Download Trial - Free 14 day evaluation

Reporting Infrastructure

PDF Print E-mail
User Rating:  / 7
Rate this article: PoorBest 

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.

 

.
Green Bell

Quick tip:

To fully understand the reporting infrastructure in soapUI Pro you should have a good grasp of how JasperReports and its templating language works, otherwise some of the below explanations might be hard to put into context.

1. Report Management

The soapUI Project Window contains a Reporting tab where all global and project specific reports are available:

reporting-tab

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:

    subreports-tab
    For example, the MetricsReport subreport gets its data from ReportMetrics DataSource and is included in the all main reports with the following syntax:


    y="98" width="535" height="30" isRemoveLineWhenBlank="true">
    $P{IncludeResults}

    ...
    $P{TestSuiteMetrics}
    "subreport:MetricsReport"
    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:
    ...




    ...
  • Templates allows for management of common blocks of template XML. The tab is as follows:

    templates-tab

    The above example template can then be inserted to any report with the familiar property expansion syntax:

    template-example

  • 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:

    parameters-tab
    Parameter values are passed to JasperReports as standard Jasper parameters, for example the main templates all define the above HeaderLogo parameter:

    header-logo-parameter
    which is consequently used further down:

    header-logo-parameter-usage
.
Green Bell

Quick tip:

Standard soapUI Property-Expansion can be used in any of the above templates or parameter values. For example if you want to show the current user name in the report you can add ${#System#user.name} at the corresponding location in your template. This gives very flexible reports but might degrade reporting performance since soapUI caches compiled report templates for re-use. Every time the value of a Property-Expansion in a report template changes, soapUI will need to recompile the containing template.

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:

reporting-filesystem

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:

subreport-folder

Here you can see that each template is saved as two files:

  1. A *.jrxml file which is a "clean" jasper template that can be edited in any JasperReports editor or any text editor
  2. 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:

reload-button

.
Green Bell

Quick tip:

The freely available iReport tool is perfect for editing your soapUI JasperReport templates in the file-system. Download and install it from http://jasperforge.org/projects/ireport and use it to edit the jrxml files described above.

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:

styles-include

The file contains a number of style definitions for headlines, etc:

styles-content

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:

logo-include

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;

  1. Create a copy of the global reports folder locally
  2. Apply desired customizations to the templates in this folder
  3. Specify the path to the folder in the global soapUI Pro Preferences:

    custom-report-library
  4. 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.