2

I use Gauge framework for my automated testing and I'd like to use Allure to generate reports. Unfortunately, Allure hasn't adapter for this. My project consists of several modules, each of them has its own pom.xml.

Main pom.xml (fragment):

    <modules>
        <module>libs/common</module>
        <module>tests/panda-api</module>
        <module>tests/dbus-api</module>
    </modules>    
    <dependencies>
        <dependency>
            <groupId>com.thoughtworks.gauge</groupId>
            <artifactId>gauge-java</artifactId>
            <version>0.6.0</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
    </dependencies>    
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

Submodule (panda-api) pom.xml:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <allure.version>1.5.0.RC2</allure.version>
    <aspectj.version>1.8.5</aspectj.version>
</properties>
<dependencies>
    <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-bundle</artifactId>
        <version>${allure.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.0</version>
    </dependency>
    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>${aspectj.version}</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>com.thoughtworks.gauge.maven</groupId>
            <artifactId>gauge-maven-plugin</artifactId>
            <version>1.1.0</version>
            <executions>
                <execution>
                    <phase>test</phase>
                    <configuration>
                        <specsDir>specs</specsDir>
                    </configuration>
                    <goals>
                        <goal>execute</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19</version>
            <configuration>
                <testFailureIgnore>false</testFailureIgnore>
                <argLine>
                    -Xmx1600m -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                </argLine>
                <properties>
                    <property>
                        <name>listener</name>
                        <value>ru.yandex.qatools.allure.junit.AllureRunListener</value>
                    </property>
                </properties>
            </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.8</version>
            <configuration>
                <inputDirectories>${project.basedir}/reports/xml-report</inputDirectories>
                <resultsDirectory>allure-results</resultsDirectory>
                <reportDirectory>allure-report</reportDirectory>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.2.10.v20150310</version>
            <configuration>
                <webAppSourceDirectory>${project.build.directory}/site/allure-maven-plugin</webAppSourceDirectory>
                <stopKey>stop</stopKey>
                <stopPort>1234</stopPort>
                <httpConnector>
                    <port>8090</port>
                </httpConnector>
            </configuration>
        </plugin>
    </plugins>
</build>
<reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.8</version>
            <configuration>
                <resultsDirectory>allure-results</resultsDirectory>
                <reportDirectory>allure-report</reportDirectory>
            </configuration>
        </plugin>
    </plugins>
</reporting>

I run the following commands from the root directory of project:

$ mvn clean compile test-compile
$ mvn install -f libs/common/pom.xml
$ mvn gauge:execute -f tests/panda-api/pom.xml -Denv=test -DspecsDir=specs

Gauge generate own XML-report to 'reports/xml-report/result.xml' in JUnit XML Schema format. Allure generate an empty report to 'allure-report', because allure-results aren't generated. How to generate the Allure Report based on Gauge xml-result?

TDub
  • 23
  • 5

1 Answers1

0

Allure only accept JUnit XML files with name matches TEST-*.xml glob (related issue https://github.com/allure-framework/allure2/issues/542). Simply rename the file to TEST-results.xml to solve your problem.

Dmitry Baev
  • 2,270
  • 1
  • 14
  • 24