Skip to content
Anton Shapin edited this page Apr 4, 2016 · 5 revisions

Allure Cucumber Plugin

An Allure Report can be generated for any Cucumber-JVM tests. In order to get test results, you need to:

  • Add plugin dependecies to pom file.
  • Add AspectJ Weaver and respective properties.
  • Add AllureReporter to CucumberOptions.
  • Execute your tests.

How to

Maven

See the example project: https://github.com/kirlionik/cucumber-allure-plugin-examples

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

  • Add properties section:
<properties>
   <aspectj.version>1.8.2</aspectj.version>
   <version.allure>1.4.23</version.allure>
   <cucumber.version>1.2.4</cucumber.version>
</properties>
  • Add dependencies:
        <dependency>
            <groupId>com.github.kirlionik</groupId>
            <artifactId>allure-cucumber-plugin</artifactId>
            <version>1.0.1</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${cucumber.version}</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>${cucumber.version}</version>
        </dependency>
        <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-java-aspects</artifactId>
            <version>${version.allure}</version>
        </dependency>
        <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-commons</artifactId>
            <version>${version.allure}</version>
        </dependency>
  • Add build section:
   <build>
        <plugins>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                    <includes>
                        <include>**/*IT.class</include>
                    </includes>
                    <argLine>
                        -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
                    </argLine>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>ru.yandex.qatools.allure</groupId>
                <artifactId>allure-maven-plugin</artifactId>
                <version>2.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <phase>post-integration-test</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
  • Add Allure Cucumber Plugin to Cucumber options
@RunWith(Cucumber.class)
@CucumberOptions(
        strict = true,
        plugin = {
                "com.github.kirlionik.cucumberallure.AllureReporter"
        }
)
public class RunAcceptanceIT {
}
Clone this wiki locally