Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we create allure report outside the target directory. #45

Closed
sgupta3112 opened this issue Aug 7, 2017 · 17 comments
Closed

Can we create allure report outside the target directory. #45

sgupta3112 opened this issue Aug 7, 2017 · 17 comments

Comments

@sgupta3112
Copy link

I am running my test on AWS and there target directory doesn't create.
So I want to create allure-report outside the target,
is there any way to do ?

@baev
Copy link
Member

baev commented Aug 7, 2017

Yeah, you can configure report directory using allure.report.directory system property or using the following plugin configuration:

<configuration>
    <reportDirectory>allure-report</reportDirectory>
</configuration>

Also you can use our Gitter char for such questions https://gitter.im/allure-framework/allure-core

@sgupta3112
Copy link
Author

Here is my pom.xml file.


4.0.0

<groupId>iOS.Harmony.Automation</groupId>
<artifactId>iOS.Harmony.Automation</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>selenium-tests</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <testng.version>6.9.10</testng.version>
    <selenium.version>3.0.1</selenium.version>
    <surefire.version>2.19.1</surefire.version>
    <maven.compiler.version>3.6.1</maven.compiler.version>
    <java-client>4.1.2</java-client>
    <aspectj.version>1.8.5</aspectj.version>
    <allure.version>2.5</allure.version>

</properties>

<dependencies>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>${testng.version}</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>${selenium.version}</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-api</artifactId>
        <version>${selenium.version}</version>
        <scope>compile</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-remote-driver</artifactId>
        <version>${selenium.version}</version>
    </dependency>
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>${java-client}</version>
    </dependency>


    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.22</version>
    </dependency>
    <dependency>
        <groupId>net.sourceforge.htmlunit</groupId>
        <artifactId>htmlunit</artifactId>
        <version>2.21</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-model</artifactId>
        <version>1.5.0.RC2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.google.gdata</groupId>
        <artifactId>core</artifactId>
        <version>1.47.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-testng-adaptor</artifactId>
        <version>1.5.0.RC2</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-java-annotations</artifactId>
        <version>1.5.0.RC2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.xmlbeans</groupId>
        <artifactId>xmlbeans</artifactId>
        <version>2.6.0</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.6.2</version>
    </dependency>


</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.version}</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>UTF-8</encoding>
                <scope>compile</scope>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${surefire.version}</version>

            <configuration>
                <testFailureIgnore>false</testFailureIgnore>
                <argLine>
                    -javaagent:/org/aspectj/aspectjweaver//aspectjweaver-.jar
                </argLine>
                <!-- This is to skip tests during normal maven execution
                (e.g. mvn package) and run them in integration-test -->
                <!-- testng xml suite file to be used for test execution -->
                <suiteXmlFiles>
                    <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                    <!--<suitexmlfile>${suiteXmlFile}</suitexmlfile>-->
                </suiteXmlFiles>
                <reportsDirectory>${project.basedir}/target</reportsDirectory>
                <!--   <testFailureIgnore>true</testFailureIgnore>-->
            </configuration>
            <executions>
                <execution>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                    <configuration>
                        <skip>false</skip>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <goals>
                        <goal>test-jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.5.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <finalName>zip-with-dependencies</finalName>
                        <appendAssemblyId>false</appendAssemblyId>
                        <descriptors>
                            <descriptor>src/main/assembly/zip.xml</descriptor>
                        </descriptors>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
                <filesets>
                    <fileset>
                        <directory>res/snapshot</directory>
                        <includes>
                            <include>**/*</include>
                        </includes>
                        <followSymlinks>false</followSymlinks>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>2.3</version>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.14</version>
            <configuration>
                <testFailureIgnore>false</testFailureIgnore>
                <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>1.5.4</version>
                </dependency>
            </dependencies>
        </plugin>

        <!--Needed only to show reports locally. Run jetty:run and
        open localhost:8080 to show the report-->
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.4.0.M1</version>
            <configuration>
                <webAppSourceDirectory>${project.build.directory}/site/allure-maven-plugin</webAppSourceDirectory>
                <stopKey>stop</stopKey>
                <stopPort>1234</stopPort>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.10</version>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

<reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
        <plugin>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-maven-plugin</artifactId>
            <version>${allure.version}}</version>
            <configuration>
                <!--<outputDirectory>${basedir}/target/allure-reports/</outputDirectory>-->
                <reportDirectory>allure-results</reportDirectory>
                <reportDirectory>allure-report</reportDirectory>
            </configuration>
        </plugin>
    </plugins>
    <outputDirectory>${basedir}/site</outputDirectory>
</reporting>

Still It is getting created in target directory.

Can you please help me .

@baev
Copy link
Member

baev commented Aug 7, 2017

There is at least few problems with your configuration.

  1. <version>${allure.version}}</version> - redundant }
  2. reportDirectory configured twice
  3. old aspectjweaver version
  4. unescaped path for javaagent
  5. redundant allure dependencies

BTW what is the point of using Allure 1 ? I recommend you to upgrade to Allure 2, here you can find working example https://github.com/allure-examples/allure-testng-example

@baev baev closed this as completed Aug 7, 2017
@sgupta3112
Copy link
Author

I have updated Pom but still same.


4.0.0

<groupId>iOS.Harmony.Automation</groupId>
<artifactId>iOS.Harmony.Automation</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>selenium-tests</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <testng.version>6.9.10</testng.version>
    <selenium.version>3.0.1</selenium.version>
    <surefire.version>2.19.1</surefire.version>
    <maven.compiler.version>3.6.1</maven.compiler.version>
    <java-client>4.1.2</java-client>
    <aspectj.version>1.8.10</aspectj.version>

</properties>

<dependencies>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>${testng.version}</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>${selenium.version}</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-api</artifactId>
        <version>${selenium.version}</version>
        <scope>compile</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-remote-driver</artifactId>
        <version>${selenium.version}</version>
    </dependency>
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>${java-client}</version>
    </dependency>


    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.22</version>
    </dependency>
    <dependency>
        <groupId>net.sourceforge.htmlunit</groupId>
        <artifactId>htmlunit</artifactId>
        <version>2.21</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-testng</artifactId>
        <version>LAST_VERSION</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.google.gdata</groupId>
        <artifactId>core</artifactId>
        <version>1.47.1</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.xmlbeans</groupId>
        <artifactId>xmlbeans</artifactId>
        <version>2.6.0</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.6.2</version>
    </dependency>


</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.version}</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>UTF-8</encoding>
                <scope>compile</scope>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${surefire.version}</version>

            <configuration>
                <testFailureIgnore>false</testFailureIgnore>
                <argLine>
                    javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                </argLine>
                <!-- This is to skip tests during normal maven execution
                (e.g. mvn package) and run them in integration-test -->
                <!-- testng xml suite file to be used for test execution -->
                <suiteXmlFiles>
                    <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                    <!--<suitexmlfile>${suiteXmlFile}</suitexmlfile>-->
                </suiteXmlFiles>
                <reportsDirectory>${project.basedir}/target</reportsDirectory>
                <!--   <testFailureIgnore>true</testFailureIgnore>-->
            </configuration>
            <executions>
                <execution>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                    <configuration>
                        <skip>false</skip>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <goals>
                        <goal>test-jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.5.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <finalName>zip-with-dependencies</finalName>
                        <appendAssemblyId>false</appendAssemblyId>
                        <descriptors>
                            <descriptor>src/main/assembly/zip.xml</descriptor>
                        </descriptors>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
                <filesets>
                    <fileset>
                        <directory>res/snapshot</directory>
                        <includes>
                            <include>**/*</include>
                        </includes>
                        <followSymlinks>false</followSymlinks>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>2.3</version>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.14</version>
            <configuration>
                <testFailureIgnore>false</testFailureIgnore>
                <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>1.5.4</version>
                </dependency>
            </dependencies>
        </plugin>

        <!--Needed only to show reports locally. Run jetty:run and
        open localhost:8080 to show the report-->
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.4.0.M1</version>
            <configuration>
                <webAppSourceDirectory>${project.build.directory}/site/allure-maven-plugin</webAppSourceDirectory>
                <stopKey>stop</stopKey>
                <stopPort>1234</stopPort>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.10</version>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

<reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>LAST_VERSION</version>
            <configuration>
                <reportDirectory>allure-report</reportDirectory>
            </configuration>
        </plugin>
    </plugins>
    <outputDirectory>${basedir}/site</outputDirectory>
</reporting>

@eroshenkoam
Copy link
Member

eroshenkoam commented Aug 8, 2017

Hi, @sgupta3112
The frist way is:

  • remove reporting section at all
  • add following configuration to build/plugins section:
<build>
    <plugins>
        ...
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.8</version>
            <configuration>
                <reportDirectory>${basedir}/allure-report</reportDirectory> //any directory you want
            </configuration>
       </plugin>
       ...
   </plugins>
</build>
  • mvn clean test - run your tests
  • mvn allure:report - generate report in ${basedir}/allure-report

Second way is:

  • add following configuration to reporting sections:
<reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.8</version>
            <configuration>
                <reportDirectory>${basedir}/allure-report</reportDirectory>
            </configuration>
        </plugin>
    </plugins>
</reporting>
  • mvn clean test - run your tests
  • mvn site - generate report in ${basedir}/allure-report

@sgupta3112
Copy link
Author


4.0.0

<groupId>iOS.Harmony.Automation</groupId>
<artifactId>iOS.Harmony.Automation</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>selenium-tests</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <testng.version>6.9.10</testng.version>
    <selenium.version>3.0.1</selenium.version>
    <surefire.version>2.19.1</surefire.version>
    <maven.compiler.version>3.6.1</maven.compiler.version>
    <java-client>4.1.2</java-client>
    <aspectj.version>1.8.10</aspectj.version>

</properties>

<dependencies>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>${testng.version}</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>${selenium.version}</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-api</artifactId>
        <version>${selenium.version}</version>
        <scope>compile</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-remote-driver</artifactId>
        <version>${selenium.version}</version>
    </dependency>
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>${java-client}</version>
    </dependency>

    <dependency>
    <groupId>io.qameta.allure</groupId>
    <artifactId>allure-attachments</artifactId>
    <version>2.0-BETA15</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.22</version>
    </dependency>

    <dependency>
        <groupId>net.sourceforge.htmlunit</groupId>
        <artifactId>htmlunit</artifactId>
        <version>2.21</version>
        <scope>test</scope>
    </dependency>


    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-testng</artifactId>
        <version>2.0-BETA16</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.google.gdata</groupId>
        <artifactId>core</artifactId>
        <version>1.47.1</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.xmlbeans</groupId>
        <artifactId>xmlbeans</artifactId>
        <version>2.6.0</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.6.2</version>
    </dependency>


</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.version}</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>UTF-8</encoding>
                <scope>compile</scope>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${surefire.version}</version>

            <configuration>
                <testFailureIgnore>false</testFailureIgnore>
                <argLine>
                    javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                </argLine>
                <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
                <!-- This is to skip tests during normal maven execution
                (e.g. mvn package) and run them in integration-test -->
                <!-- testng xml suite file to be used for test execution -->
                <suiteXmlFiles>
                    <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                    <!--<suitexmlfile>${suiteXmlFile}</suitexmlfile>-->
                </suiteXmlFiles>
                <!--   <testFailureIgnore>true</testFailureIgnore>-->
            </configuration>
            <executions>
                <execution>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                    <configuration>
                        <skip>false</skip>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <goals>
                        <goal>test-jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.5.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <finalName>zip-with-dependencies</finalName>
                        <appendAssemblyId>false</appendAssemblyId>
                        <descriptors>
                            <descriptor>src/main/assembly/zip.xml</descriptor>
                        </descriptors>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
                <filesets>
                    <fileset>
                        <directory>res/snapshot</directory>
                        <directory>src/test/resources/allure-results</directory>
                        <includes>
                            <include>**/*</include>
                        </includes>
                        <followSymlinks>false</followSymlinks>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>2.3</version>
        </plugin>


        <!--Needed only to show reports locally. Run jetty:run and
        open localhost:8080 to show the report-->
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.4.0.M1</version>
            <configuration>
                <webAppSourceDirectory>${project.build.directory}/site/allure-maven-plugin</webAppSourceDirectory>
                <stopKey>stop</stopKey>
                <stopPort>1234</stopPort>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.10</version>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.8</version>
            <configuration>
                <reportDirectory>${basedir}/src/test/resources/allure-report</reportDirectory>
            </configuration>
        </plugin>
    </plugins>
    <outputDirectory>${basedir}/allure-reports/</outputDirectory>
</reporting>

@eroshenkoam , I have done some changes but Now I am not able to create allure report on given path. Can you please check this pom.

Thanks,

@eroshenkoam
Copy link
Member

why are you generate report into resource directory?

<reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.8</version>
            <configuration>
                <reportDirectory>${basedir}/src/test/resources/allure-report</reportDirectory>
            </configuration>
        </plugin>
    </plugins>
    <outputDirectory>${basedir}/allure-reports/</outputDirectory> //you need to remove this line
</reporting>

@sgupta3112
Copy link
Author

I am trying to run my test on aws device farm and device farm doesn't support target directory. So I need to create allure report in resource directory.

@sgupta3112
Copy link
Author

@eroshenkoam ,

I have removed that line but still same.

allure-result is not getting created at given path.

I am trying to do since last 20 hours but no luck.

@sgupta3112
Copy link
Author

Thanks all for help :)

@eroshenkoam
Copy link
Member

eroshenkoam commented Aug 8, 2017

@sgupta3112 Did you solve your problem?

@uterator
Copy link

uterator commented Jul 30, 2018

Hi guys, this seems a blocker problem, is there any solution for it?

Not sure why the ticket is closed as the solution is not found.

Allure 2 is trying to create the allure.results.directory directory which in AWS is not allowed because of limited permissions and environment specific structure.

Here is the error reported by AWS:

Exception in thread "main" io.qameta.allure.AllureResultsWriteException: Could not create Allure results directory
	at io.qameta.allure.FileSystemResultsWriter.createDirectories(FileSystemResultsWriter.java:76)
	at io.qameta.allure.FileSystemResultsWriter.write(FileSystemResultsWriter.java:52)
	at io.qameta.allure.AllureLifecycle.lambda$writeTestContainer$3(AllureLifecycle.java:93)
	at java.util.Optional.ifPresent(Optional.java:159)
	at io.qameta.allure.AllureLifecycle.writeTestContainer(AllureLifecycle.java:91)
	at io.qameta.allure.testng.AllureTestNg.onFinish(AllureTestNg.java:155)
	at org.testng.SuiteRunner.invokeListeners(SuiteRunner.java:202)
	at org.testng.SuiteRunner.run(SuiteRunner.java:257)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
	at org.testng.TestNG.run(TestNG.java:1057)
	at org.testng.TestNG.privateMain(TestNG.java:1364)
	at org.testng.TestNG.main(TestNG.java:1333)
Caused by: java.nio.file.AccessDeniedException: /allure-results
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)
	at java.nio.file.Files.createDirectory(Files.java:674)
	at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
	at java.nio.file.Files.createDirectories(Files.java:767)
	at io.qameta.allure.FileSystemResultsWriter.createDirectories(FileSystemResultsWriter.java:74)
	... 14 more

Please note the "allure.results.directory" was not specified.

The specific part of the AWS environment is we don't know the path to the execution workspace, it is a random path so it can't be set initially in the allure.properties.

Any ideas how to avoid this error?

Please note, those options are tried without any luck

  • allure.results.directory=${project.basedir}/allure-results
  • allure.results.directory=./allure-results

Also, please note the java knows where the workspace path is through an environment variable, but how to tell the Allure that?

Maybe there is a way to completely disable the Allure if its execution is not needed for a specific environment like AWS?

Please advise what to do.

@eroshenkoam @baev

@eroshenkoam
Copy link
Member

eroshenkoam commented Jul 30, 2018

Try with allure.results.directory=${project.build.directory}/allure-results plz

@eroshenkoam
Copy link
Member

You point to '/allure-results' - it's not right place for allure results.
In your case results should be in ${project.build.directory}/allure-results

@baev
Copy link
Member

baev commented Jul 30, 2018

@eroshenkoam we are not resolving properties in values, so ${project.build.directory}/allure-results will not work properly

UPD: I mean for allure.properties file, it should work if specified in pom.xml
UPD2: Also you can specify working directory for your JVM or override allure.results.directory in AWS environment (system properties will override value specified in allure.properties file)

@uterator
Copy link

uterator commented Jul 30, 2018

Thanks, guys,
As for pom.xml, AWS is not running tests by maven so the pom.xml has nothing to do in their environment.
As for override the allure.results.directory seems it didn't work.
Is there an Allure's early lifecycle phase when the allure.results.directory can be set to r/w directory? Some moment when the results directory is not created yet.

At this point, the issue still remains actual.

@arkadiyala
Copy link

@sgupta3112 @baev @eroshenkoam @uterator - Is it resolved?
Even i'm trying to update allure results path based on testng.xml i'm using.

For example :
testng1.xml results should be stored under target/Results_testng1
testng2.xml results should be stored under target/Results_testng2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants