Allure reporting framework integration with FitNesse-setup based on hsac-fitnesse-fixtures.
This project contains a jUnit listener which can be added to a test run executing FitNesse tests, which will allow the results of the test run to be incorporated into an Allure report. Sometimes an Allure report can add that little bit extra to test results (dashboard with graphs, colors and other management-pleasing functionality) and allow you to combine results of multiple test runs, possibly using different testing frameworks.
The idea is to add this listener to a test run executed by a build/CI server (as described at https://github.com/fhoeben/hsac-fitnesse-fixtures#to-run-the-tests-on-a-build-server), so that the test results can then be incorporated into an Allure report.
To enable this listener in a project using the 'standard HSAC maven setup':
- create a dependency to this project (with scope
test
) and - set the maven property
extraFailsafeListeners
tonl.hsac.fitnesse.junit.allure.JUnitAllureFrameworkListener
.
The listener creates data for Allure reporting in target/allure-results
, to get an actual report you still need to
generate one based on these results.
- If you wish to ignore SuiteSetUp and SuiteTearDown test pages in Allure, this can be achieved by setting system property skipSpecialPagesInAllure to true (
skipSpecialPagesInAllure=true
)
An example pom.xml
generating the results files during 'integration-tests' and then creating a report in target/allure-report
during Maven's 'site' phase is provided below.
In short: mini-manual/featurelist:
- The dashboard shows an aggregate of all runs in target/allure-results (so running multiple suites and generating one report is possible - don't clean between runs!)
- If tags are provided on the test pages, these are visible as functional 'stories' in the report
- HSAC's fitnesse report is copied and integrated as an attachment per test case
- If exceptions were thrown, screenshot and pagesource are attached separately
To view the report in a browser, access target/allure-report
using a webserver (browsers won't allow XHR to file:// urls).
Fitnesse results are copied in, so you can drill down to technical results inside the dashboard.
The 'profile' element below provides a sample on how to incorporate both capturing tests results for Allure, and generating an Allure report in a project based on hsac-fitness-project. It is intended to be incorporated inside the 'profiles' element in a pom.xml similar to the one in the hsac-fitnesse sample project.
It can then be activated by adding a -Pallure
to Maven commands, typically like:
mvn clean test-compile failsafe:integration-test -DfitnesseSuiteToRun=HsacExamples.SlimTests -Pallure
to run your tests,
mvn test-compile failsafe:integration-test -DfitnesseSuiteToRun=ReRunLastFailures -Pallure
to rerun failed tests
and
mvn site -Pallure
to generate the HTML report.
To allow keeping history, add the following exclude to the maven clean plugin in your project:
<fileset>
<directory>target</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>allure-results/history/**</exclude>
</excludes>
</fileset>
The following profile can be used with any hsac project to generate full reports.
Set properties allure.report.directory
, allure.fitnesse.listener.version
, allure.maven.plugin.version
, allure.report.version
for your preferred versions (plugin & report versions are @ 2.10.0 and 2.11.0 at the moment of writing)
<profile>
<id>allure</id>
<properties>
<allure.report.directory>${project.build.directory}/allure-report</allure.report.directory>
<extraFailsafeListeners>,nl.hsac.fitnesse.junit.JUnitXMLPerPageListener,nl.hsac.fitnesse.junit.allure.JUnitAllureFrameworkListener</extraFailsafeListeners>
</properties>
<dependencies>
<dependency>
<groupId>nl.hsac</groupId>
<artifactId>allure-fitnesse-listener</artifactId>
<version>${allure.fitnesse.listener.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>site</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${allure.report.directory}/data/fitnesseResults</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/fitnesse-results</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resources-allurehistory</id>
<phase>site</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/allure-results/history</outputDirectory>
<resources>
<resource>
<directory>${allure.report.directory}/history</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>3.1.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>${allure.maven.plugin.version}</version>
<configuration>
<resultsDirectory>allure-results</resultsDirectory>
<reportDirectory>${allure.report.directory}</reportDirectory>
<reportVersion>${allure.report.version}</reportVersion>
</configuration>
</plugin>
</plugins>
</reporting>
</profile>