I'm running a Selenium test with Maven and would like to have an Allure report generated in the end. Unfortunately, I get an error message.
Maven command line:
clean -Dtest=TestLogs test allure:report
Error message:
[INFO] --- allure-maven:2.9:report (default-cli) @ demo ---
[INFO] Allure installation directory C:\Users\Zoe\Documents\demo\selenium_tests\demo_selenium/.allure
[INFO] Try to finding out allure 2.3.1
[INFO] Generate Allure report (report) with version 2.3.1
[INFO] Generate Allure report to C:\Users\Zoe\Documents\demo\selenium_tests\demo_selenium\target\site/allure-maven-plugin
[ERROR] Directory C:\Users\Zoe\Documents\demo\selenium_tests\demo_selenium\target\target\allure-results not found.
[WARNING] Allure report was skipped because there is no results directories found.
My POM.xml:
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.wesh.nc</groupId>
<artifactId>demo</artifactId>
<!--<packaging>pom</packaging>-->
<packaging>jar</packaging>
<version>1.0</version>
<properties>
<allure.version>1.5.2</allure.version>
<allure.maven.version>2.0</allure.maven.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<skip>${skip.selenium.tests}</skip>
<parallel>none</parallel>
<threadCount>1</threadCount>
<reuseForks>false</reuseForks>
<disableXmlReport>false</disableXmlReport>
</configuration>
<executions>
<execution>
<id>runSeleniumTests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.9</version>
<configuration>
<resultsDirectory>target\allure-results</resultsDirectory>
<inputDirectories>target\allure-results</inputDirectories>
<outputDirectory>target\allure-report</outputDirectory>
<reportVersion>2.3.1</reportVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>${allure.maven.version}</version>
<configuration>
<resultsPattern>target\allure-results</resultsPattern>
<outputDirectory>target\target-report</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.7</version>
</dependency>
<dependency>
<groupId>org.gebish</groupId>
<artifactId>geb-core</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.gebish</groupId>
<artifactId>geb-spock</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.0-groovy-2.4</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>3.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.8.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>1.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>${allure.maven.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-junit-adaptor</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-commons</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-report-data</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-java-adaptor-api</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-model</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
</dependencies>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>${allure.maven.version}</version>
<configuration>
<outputDirectory>target/allure-report</outputDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
I'm aware this POM is messy, I've been trying several things in order to make Allure work...
If someone knows what I can do to generate the allure-results directory, thanks in advance.
You missed Allure listener & AspectJ configurations. Please follow the instructions from documentation page: https://github.com/allure-framework/allure1/wiki/JUnit
Also you can consider upgrading to latest Allure version. Docs for a new version can be found here https://docs.qameta.io/allure/#_junit_4