soapUI Pro allows for a high degree of report customization. You can create as many report and subreport templates as you would like. These can contain data exposed by the internal DataSets and from any external source (databases etc...) - just like any JasperReport. Let's look at how you can create a simple custom report at the project level and how you can use the different customization mechanisms available.
1. Creating Custom Templates
- We'll start by adding a totally new report at the project level; press the Add Report Template button in the Available Reports toolbar:
- Set the name to "Properties" and the type to COMMON (meaning it will be available at all levels). Pressing OK gives us:
- Here we can select which subreports we want to have automatically included in the report. Select the PropertiesReport subreport and press OK. The generated template can be seen in the editor:
- If we now go to the Project Overview tab and add a property:
- Press the Create Report button in the toolbar:
- Selecting our newly created Properties and clicking OK gives us the following report:
- Oops! The string "null-properties" isn't exactly what we want here. Let's have a look at the Properties SubReport that adds this, a bit down in the template we can see the following:
- It seems the Type is passed as a parameter to the report. Let's just add a hard-coded value for this:
- If we now recreate the report we get:
Better! But we're not entirely happy with this, are we...
2. Adding Parameters
- Let's add a parameter for setting the report title (instead of the "Sample Project"). Back to the template and add:
- Now add the parameter to the Parameters tab with a default value:
generating the report now gives us:
- Great! This parameter can be overridden at any level in soapUI Pro, and since this is a Common report we can generate it wherever we want, for example; for a TestCase we can set the ReportTitle (here with property-expansion thrown in!):
- And generating a new report gives us...
- oops... the parameter didn't fit... hmm... now what? Either change the formatting in the template or read on:
3. Configuration Properties
- Another way to customize the contents of a report is by adding configuration properties which will be prompted in the UI when creating the report. Back to the template again and now add the following:
- This creates an "interactive" configuration parameter which will be shown in the UI when creating the report:
- Make sure that you remove the ReportTitle parameter we created in the previous section. It will otherwise override this one. The created report will be:
Read the Configuration Parameter Reference to see all available types and options for these parameters.