Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

allure-results directory not generated under target folder

Tags:

java

maven

allure

I upgraded to latest <allure2.version>2.0-BETA14 in my Maven project. test-results folder is getting generated under the project directory instead of target directory.

I have gone through the allure documentation website and they have suggest to add <allure.results.directory> in the system path to override but it doesn't seem to be working.

I am building my TestNG suite programatically. This was working absolutely fine with allure1.

Below is my pom.xml:

<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.mycompany.test.projectA</groupId>
<artifactId>scarpbook</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>scarpbook</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <java.version>1.8</java.version>

    <testng.version>6.10</testng.version>

    <surefire.plugin.version>2.19.1</surefire.plugin.version>
    <allure.version>2.0-BETA14</allure.version>
    <aspectj.version>1.8.10</aspectj.version>
    <allure.results.directory>target/allure-results</allure.results.directory>
    <allure.report.directory>target/allure-report</allure.report.directory>
    <tms>
        https://github.com/allure-framework/allure-docs/issues/{}
    </tms>

</properties>

<dependencies>

    <dependency>
        <groupId>com.mycompany.testlib</groupId>
        <artifactId>lib</artifactId>
        <version>1.0</version>
    </dependency>

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>${testng.version}</version>
    </dependency>
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-testng</artifactId>
        <version>${allure.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.21</version>
        <scope>test</scope>
    </dependency>

</dependencies>

<build>

    <plugins>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.1.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <executable>java</executable>
                <mainClass>com.mycompany.testlib.testrunner</mainClass>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.18.1</version>
            <configuration>
                <testFailureIgnore>true</testFailureIgnore>
                <argLine>
                    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                </argLine>
                 <systemProperties>
                    <property>
                        <name>allure.results.directory</name>
                        <value>${allure.results.directory}</value>
                    </property>
                </systemProperties>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>
<reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.8</version>
                <configuration>
                    <outputDirectory>${basedir}/target/allure-reports/</outputDirectory>
                    <allureResultsDirectory>${basedir}/target/allure-results</allureResultsDirectory>
                </configuration>
        </plugin>
    </plugins>
</reporting>

like image 247
user3290656 Avatar asked Jul 14 '17 21:07

user3290656


2 Answers

Create a file allure.properties under your test resources (usually it is src/test/resources) with the following content:

allure.results.directory=target/allure-results
like image 79
Dmitry Baev Avatar answered Nov 15 '22 15:11

Dmitry Baev


Try out this solution - https://github.com/allure-framework/allure-maven/issues/30#issuecomment-276441970

In systemPropertyVariables create the following entry:

<allure.results.directory>target/allure-results</allure.results.directory>

like image 29
Tomahawks Avatar answered Nov 15 '22 17:11

Tomahawks