question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[TestNG][Maven] Error: Directory ".../target/allure-results" not found message when running `$ mvn test allure:report`

See original GitHub issue

I’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:closed
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
baevcommented, Nov 14, 2017

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)

1reaction
benyue1978commented, Aug 5, 2022

Took me some time to figure it out. You have to configure allure.properties first.

allure.results.directory=target/allure-results

Then you run a new test, the result will be in the target directory.

mvn clean test mvn allure:serve

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allure results don't generate on Maven build - Stack Overflow
[WARNING] Allure report was skipped because there is no results directories found. My POM.xml: <project xsi:schemaLocation="http://maven.apache.
Read more >
Allure reports do not generate results when calling mvn test ...
I have no allure-results folder generated, I am very confused. Why would some arguments not be resulting in successful build of allure-reports?
Read more >
Allure Framework
Allure Framework is a flexible lightweight multi-language test report tool that not only shows a very concise representation of what have ...
Read more >
Allure report example using testng and maven - Selenium Easy
Each time when we run automation tests, we will have test results to view details about no. of tests passed, failed and failure...
Read more >
Re: [testng-users] Maven + TestNG runs fine on Eclipse with ...
Re: [testng-users] Maven + TestNG runs fine on Eclipse with TestNG/Maven plugins, ... But when I try to run it in command-line, it's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found