Skip to content

fhoeben/allure-fitnesse-listener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Allure jUnit Listener for FitNesse

Maven Central

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.

Capturing FitNesse Results

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 to nl.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)

Generating Allure Report

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.

Sample pom.xml Profile

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>

About

jUnit Listener to incorporate FitNesse results in Allure

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages