A Report represent the Results of executing a Document. The Report include the Document and the Status of the execution. A Report can be represented in different formats like HTML or PDF.
Supported Report Formats:
-
HTML Report
-
Json Report
-
Confluence Attachment Report
-
Confluence Page Tree Report
Configure the generation of Reports in the living-doc.yaml
file.
The living-doc.yaml
contains the yaml based configuration of LivingDoc.
This file should be placed in the src/test/resources
directory.
reports:
- name: "default-html"
format: "html"
config:
outputDir: "livingdoc/reports/html"
reports
is a list of different reports.
Each report have a name
as unique identifier.
Each report also specifies the format
of the generated Report.
Optionally a config
can be specified for Report format specific parameters.
Configuration from the command line and environment dependent configuration can be archived using the Java System Property livingdoc.reports.include
to specify a comma separated list of report names that should be generated.
The provided list act as a whitelist, so only reports from the list are generated.
If this property is not specified all reports that are configured are generated.
For more information about the configuration see Configuration.
The HTML Report format is similar to the HTML Document format, with additional coloring to represent the Status of the execution.
Confluence reports are HTML reports that are automatically uploaded to the confluence page of the example after the test execution.
Sets for which repo the reports should be generated for. Must match the name given in this config
The filename of the attachment in confluence.
Defaults to report.html
The baseURL of the Confluence Server with the format protocol://host:port
The Context path of the Confluence Server, for example /
.
Can usually be left empty.
The username of a confluence user with writing access to the Executable Documents.
The password of the confluence user given by username.
Is added to the attachment upload as a comment.
An empty comment defaults to Report from [ISO-timestamp]
Confluence page tree reports create pages detailing the test results for the executed documents under a given root page.
The content id of the page under which the reports should be generated. This page will be updated with a summary of the execution.
The baseURL of the Confluence Server with the format protocol://host:port
The Context path of the Confluence Server, for example /
.
Can usually be left empty.
The username of a confluence user with writing access to the Executable Documents.
The password of the confluence user given by username.
Is added to the attachment upload as a comment.
This documentation is for developer which want to implement own Report Formats.
To create a new Report Format, you must create a ReportRenderer
that contains the logic for generating the reports.
It is called after the execution of the LivingDoc tests.
The ReportRenderer
have one method render(documentResult, config)
that must be implemented.
The first argument is the DocumentResult
which represent the the Result of executing a single Document with all Examples and Fixtures defined by the Document.
The second argument is a configuration which can be used for Report Format specific configuration, like output directory for the Reports.
The render
method must not only generate the Reports but also store the Reports in an appropriate format and location.
A ReportRenderer must be annotated with @Format
and the unique Format identifier must be passed as argument of the Annotation.
In order to be discovered the Java SPI configuration file META-INF/services/org.livingdoc.reports.spi.ReportRenderer
must be created.
The content of the file is the fully qualified class name of your ReportRenderer implementation as:
org.livingdoc.reports.html.HtmlReportRenderer
Now to use your ReportRenderer to generate Reports, the ReportRenderer must be in the classpath while LivingDoc is executed. In the reports configuration of LivingDoc use the unique format id to configure a Report that uses your Format.