/arquillian-recorder

Record & report your tests - takes screenshots, records videos & makes neat reports

Primary LanguageJavaApache License 2.0Apache-2.0

Arquillian Recorder

Arquillian Recorder project brings realtime reports of your Arquillian tests. You can report your own report informations by firing SPI events from your extension and you can implement your own screenshooters and video recorders of your tests by base screenshooter and video recorder implementations on which you build your target implementation very easily.

Reporter subproject is gathering all information from Arquillian test as it proceeds in your test run and it generates reports even after every test method if you want to. You can export some report to various formats like xml, json or html (with custom template) and you can easily integrate your own export format according to your preferencies.

Arquillian Desktop Video Recorder extension

It records your desktop during tests. You find all documentation in its respective directory.

Arquillian Reporter

Arquillian Reporter is an extension to Arquillian platform which provides the possibility to make reports of your Arquillian tests.

You can use reporter standalone - meaning it will not take any screenshots nor videos (Maven dependency snippet below) and only raw reports will be generated. However when you put e.g. desktop video recorder on class path, it means that videos will be added dynamically into your report as you can see on the examples of reports below. It holds as well for screenshooters from Graphene and Droidium. It will be automatically reported when it is on classpath.

However, using just desktop video recorder or screenshooter implementation is sufficient to get reports since these implementations automatically contains reporter below so just by putting video recorder on class path you will get reporter for free.

In order to use it in standalone mode, please place this artifact configuration into Maven dependencies:

Making it part of your project

<dependency>
    <groupId>org.arquillian.extension</groupId>
    <artifactId>arquillian-recorder-reporter-impl</artifactId>
    <version>${version.reporter}</version>
</dependency>

The examples of how reports are taken can be seen here for JSON, here for XML, here for HTML type of reporting and here for Asciidoctor reporting.

Settings

Please put this extension definition into arquillian.xml in order to bootstrap the configuration:

<extension qualifier="reporter">
    <property ... />
</extension>
Configuration property Description Default value

report

type of report you want to get, possible values are xml, json or html, html4, html5 or htm for html format and ad, adoc or asciidoc for Asciidoctor

xml

file

file where to export the report

arquillian_report.{report type}

rootDir

root directory which prepends file

target

template

another template for xml to html transformation

template.xsl, when not found, default system xsl template is used

reportAfterEvery

when should report be exported - method, class, suite

default is after every class, it is exported after every suite every time

language

language you want to get your HTML report in, only English right now

en

maxImageWidth

maximal width of taken screenshot to display directly into resulting HTML page, otherwise it is displayed as a link, measured in pixels.

500

title

custom title for your report

Arquillian test run report

How does it work?

There is a lifecycle observer which listens to all important Arquillian lifecycle events like BeforeSuite, AfterClass, Before and so on. There is JAXB model which gets filled as test is proceeding. After all suite(s) are finished, reporting is delegated to Exporter. You can register your own exporter by observing ExporterRegisterCreated event and specifying report type for that exporter.

JAXB is after all marshalled to various formats depending of what you want. There is one underlying model which just marshalls to the format you need by some specific exporter.

You say what to report

It is impossible to know in advance what some particular Arquillian extension will need to report. For that matter, you can report you own properties into report tree by firing ordinary Arquillian event. Let’s see an example:

@Inject private Event<PropertyReportEvent> propertyReportEvent;

ScreenshotEntry propertyEntry = new ScreenshotEntry();

propertyReportEvent.fire(new PropertyReportEvent(propertyEntry));

You see that you have to fire PropertyReportEvent from reporter’s SPI with an object which extends PropertyEntry from SPI. Reporting extension does not report screenshot entries on its own. That is the job of screenshooting extension itself so it just passes the event to reporting extension. Reporter just collects it and export to specified format.

All possible entries you can fire are here.

After firing the property, it gets hooked into the right place of report tree. So when screenshot property event in Before is fired, it will appear in a method subtree. When videos are taken and VideoEntry event was fired in AfterClass or AfterSuite, it will be added into the right subtree as seen in the example.

Due to JAXB restrictions, you can not fire nor marshall interfaces so it can not be done totally generic.

How to export on purpose?

You have to fire ExportReport event.