[TestNG][Maven] Error: Directory ".../target/allure-results" not found message when running `$ mvn test allure:report`
See original GitHub issueI’m submitting a …
- [ x] bug report
What is the current behavior?
Running the command
$ mvn test
generates the allure results into ‘./allure-results’ folder, not into ‘./target/allure-results’ folder.
In according with 13.6.2 Results directory section of the documentation, it is said that This path can be relative from the build directory (for maven it is the target directory)
. However, now the ‘allure-results’ folder is not in the ‘target’ folder.
As a consequence, the command
$ mvn allure:report
generates the following error:
[ERROR] Directory E:\workspace\project_name\target\allure-results not found.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
The sample code to reproduce the issue can be found here
Run the command:
$ mvn clean test
and find that the allure-results
folder is located not in the target
folder, but in the root folder of the project.
Then run the command:
$ mvn allure:report
and observe the error in the command line of type
[ERROR] Directory E:\workspace\project_name\target\allure-results not found.
What is the expected behavior?
After running $ mvn test
, allure results should be generated into ‘./target/allure-results’ folder, as described in 3.6.2 Maven Configuration Results directory section of the documentation.
After running $ mvn allure:report
, the report should be generated into ‘./target/site/allure-maven/index.html’, as described in 13.6.3 Maven Usage section of the documentation,
as well as on the GitHub page of the Allure Maven Plugin.
What is the motivation / use case for changing the behavior?
It would be great to run one command:
$ mvn clean test allure:report
and obtain the test run report.
However, at the moment, one needs to run first $ mvn test
, and then either invoke allure command line tool on the generated allure-results folder, or copy the results into target folder and only then to run $ mvn allure:report
.
And the second motivation is that the current behaviour does not correspond to the documentation.
Please tell us about your environment:
Allure version | 2.4.1 |
---|---|
Test framework | testng@6.11 |
Allure integration | allure-testng@2.0-BETA19 |
Generate report using | allure-maven@2.9 |
Other information
Sample pom.xml
file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.qa</groupId>
<artifactId>allure_results_folder_inconsistency</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<aspectj.version>1.8.11</aspectj.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<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>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.9</version>
<configuration>
<reportVersion>2.4.1</reportVersion>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.0-BETA19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</project>
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
you need to create
allure.properties
file in your resources folder and specify the results directory (see https://github.com/allure-examples/allure-testng-example/blob/master/src/test/resources/allure.properties)Took me some time to figure it out. You have to configure allure.properties first.
Then you run a new test, the result will be in the target directory.