Reporting Download Trial - Free 14 day evaluation

Customizing Templates

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

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

  1. We'll start by adding a totally new report at the project level; press the Add Report Template button in the Available Reports toolbar:
  2. addreporttype
  3. Set the name to "Properties" and the type to COMMON (meaning it will be available at all levels). Pressing OK gives us:
  4. addreport-choosesubreports

  5. 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:
  6. addreport-initial

  7. If we now go to the Project Overview tab and add a property:
    addreport-addproperty
  8. Press the Create Report button in the toolbar:
  9. addreport-createinitial

  10. Selecting our newly created Properties and clicking OK gives us the following report:
  11. addreport-initialpdf

  12. 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:

    addreport-propertiessubreport

  13. It seems the Type is passed as a parameter to the report. Let's just add a hard-coded value for this:
  14. addreport-addsubreportparameter

  15. If we now recreate the report we get:
  16. addreport-initialpdf-2

    Better! But we're not entirely happy with this, are we...

2. Adding Parameters

  1. Let's add a parameter for setting the report title (instead of the "Sample Project"). Back to the template and add:
  2. addreport-addparameter-intemplate

  3. Now add the parameter to the Parameters tab with a default value:
  4. addreport-addparameter

    generating the report now gives us:

    addreport-initialpdf-3

  5. 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!):
  6. addreport-testcaseparameter

  7. And generating a new report gives us...
  8. addreport-initialpdf-4

  9. oops... the parameter didn't fit... hmm... now what? Either change the formatting in the template or read on:

3. Configuration Properties

  1. 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:
  2. addreport-addconfigparameter

  3. This creates an "interactive" configuration parameter which will be shown in the UI when creating the report:
  4. addparameter-createwithconfig

  5. 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:
  6. addreport-initialpdf-5

    Read the Configuration Parameter Reference to see all available types and options for these parameters.