There is an out-of-the-box support prepared for XML reports to be generated for each story as well as creating an index file with links to each report.
This feature is turned on by default and registers XmlReporterFactory bean. To turn it off just set reporting.enabled
property to false
.
For implementation details please check the XmlReporterAutoConfiguration
class.
We also autoconfigure reporter extension (bean implementing a XmlReporterExtension interface).
The default generated XML report contains only information about:
- story narrative
- story start time
- story end time
- story duration
- story status (e.g. failed, successful)
- story steps
Rest of the information available in the report depends on the extensions autoconfigured/manually registered.
In case you want to have narrative in report you have to follow JBehave narrative format:
In order to explain how to use narrative
As a development team
I want to show you how to do it
All three fixed part of narrative must be present in given order: In order to
, As a
and I want to
The default report can be extended with other info by registering beans implementing the interface XmlReporterExtension
(for convenience an abstract class AbstractXmlReporterExtension
containing methods for writing XML elements can also be used).
There are several extensions already prepared and ready to use:
EnvironmentInfoXmlReporterExtension
(copies Spring Environment properties starting with nameenvironmentInfo
, can be explicitly disabled by setting propertyreporting.environment.enabled
tofalse
)RestXmlReporterExtension
(copies REST requests/responses from RestServiceSteps, can be explicitly disabled by setting propertyreporting.rest.enabled
tofalse
)WsXmlReporterExtension
(copies SOAP requests/responses from WebServiceSteps, can be explicitly disabled by setting propertyreporting.ws.enabled
tofalse
)TestContextXmlReporterExtension
(copies contents of TestContext, can be explicitly disabled by setting propertyreporting.context.enabled
tofalse
)FailScreenshotsReporterExtension
(prints out error screenshots from Web testing - if any were generated, can be explicitly disabled by setting propertyreporting.web.screenshot.failed.enabled
tofalse
)SqlXmlReporterExtension
(copies SQL statements/results from SqlSteps, can be explicitly disabled by setting propertyreporting.sql.enabled
tofalse
)ScreenshotReporterExtension
(prints out screenshots (except error) from Web testing - if any were generated, can be explicitly disabled by setting propertyreporting.web.screenshot.enabled
tofalse
)- Frequency of screenshot taking can be controlled by property: 'web.screenshot.reporting.mode'
- MANUAL: screenshots from a manual step only
- WAIT: screenshots after every web wait
- STEP: screenshots after every web step
- DEBUG: screenshots after every web step and action
- Frequency of screenshot taking can be controlled by property: 'web.screenshot.reporting.mode'
ServerLogXmlReporterExtension
(copies server logs, or their parts used by SshSteps, can be explicitly disabled by setting propertyreporting.ssh.enabled
tofalse
)- Content can be controlled by property: ssh.reporting.mode
- FULL: copies server log(s) for each system with configured SshTemplate
- TEMPLATE: copies server log(s) for each system with configured SshTemplate with an attribute reportable = true
- CACHE: copies cached server log(s) used within scenario execution
- Extension contains fail mode, which acts like TEMPLATE mode if test fails
- it can be turned on by using property: ssh.reporting.logOnFailure with value "true"
- Content can be controlled by property: ssh.reporting.mode
These extensions are autoconfigured by default if it makes sense (e.g. if there is a DataSource
bean available for SqlXmlReporterExtension
, and so on).
Following step allows setting specific server log report extension mode Step throws AssertionError when ServerLogXmlReporterExtension isn't registered.
Given ssh reporter mode is set to [TEMPLATE]