Go to the Configure section and select the Report Templates page.
A click on the button
creates a new report template. Here you can enter a name and a short description for the report.
Name |
The name of the report. |
Description |
A description of the report. |
Output Format |
The output format: PDF or Excel. |
Status |
The status of the report: Draft or Approved. |
Klaros-Testmanagement comes with several predefined report templates These are read-only, but can be duplicated with the icon. The duplicate can then be modified as desired.
Note | |
---|---|
For larger report templates it can be helpful to use an IDE (e.g. Eclipse) for the script and layout template. The created files can then be uploaded in Klaros-Testmanagement. To avoid errors, add the Klaros model libraries to the build path of your Eclipse project. The tutorial document has a chapter about creating report templates where this is explained in detail. |
Instead of editing the report script and template directly in the application, they can also be imported from a file. Specify the file to be used by clicking the
button and selecting the file to be imported. A click on OK in the file dialog and then on imports the selected file into the script or template field.This page provides three actions to be executed:
To make reports more flexible, it is possible to pass parameters to the report script. These can be used, for example, to pass a time span for which data is determined.
To add arguments to the report, click the icon button on the parameters tab.
The type of the parameters can be specified by selecting the appropriate value from the type list.
Supported types are Text
, Number
, Date
,
Boolean
, List
and Multi List
.
A default value can be specified and a mandatory flag can be set.
Clicking the
icon removes the parameter from the list.
The passed parameters can be accessed by the report script by either calling the
getParameterValue(String name)
or the
getParameter(String name)
method. These methods will
return null if no parameter with the specified name could be found.
As mentioned before, the passed parameters can be retrieved from the context by the
getParameterValue(String name)
and getParameter(String name)
methods.
The following code snippet shows how to access the parameters and how to use them in the report script:
StringBuffer query = new StringBuffer(); query.append("select tcr from KlarosTestCaseResult tcr where tcr.executionTime < "); query.append(context.getParameterValue("executionTime")); List<?> tcr = context.executeQuery(query.toString());
This query will retrieve all objects of type KlarosTestCaseResult
that have an execution time smaller than the value passed with the parameter
executionTime
.
Alternately, the parameters can be directly accessed in the query as shown in the following code snippet:
query.append("select tcr from KlarosTestCaseResult tcr where tcr.executionTime <:executionTime"); List<?> tcr = context.executeParameterizedQuery(query.toString());
Parameters can be accessed from the layout template in the following way:
<p:text value="Test results for test runs with execution time < #{executionTime} ms" />
Note | |
---|---|
Make sure to escape characters like |