Skip to content
This repository was archived by the owner on Jan 14, 2019. It is now read-only.
Ivan Krutov edited this page May 23, 2014 · 7 revisions

Allure report can be generated for any JUnit test. In order to get test results you need:

  • Add AllureRunListener to JUnit
  • Add AspectJ Weaver and respective properties
  • Run tests

Maven

See example project: https://github.com/allure-framework/allure-junit-example

You need to add the following to your pom.xml:

<properties>
    <aspectj.version>1.7.4</aspectj.version>
    <allure.version>{latest-allure-version}</allure.version>
</properties>

<dependencies>
    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-junit-adaptor</artifactId>
        <version>${allure.version}</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.14</version>
            <configuration>
                <testFailureIgnore>false</testFailureIgnore>
                <argLine>
                    -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
                </argLine>
                <properties>
                    <property>
                        <name>listener</name>
                        <value>ru.yandex.qatools.allure.junit.AllureRunListener</value>
                    </property>
                </properties>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

Then run the build as usually:

$ mvn clean test

Ant

Right now using Allure with Ant is not possible because RunListener that we provide is only supported in JUnit 4 whereas even the latest version of Ant requires the implementation of JUnit 3 specific interfaces.

Clone this wiki locally