Search code examples
javatestngallure

allure-results does not exist in jenkins


Jenkins ignores properties and does not create allure-results. Please help.

pom.xml

<groupId>org.example</groupId>
<artifactId>GoogleTest</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <maven.compiler.source>8</maven.compiler.source>
    <maven.compiler.target>8</maven.compiler.target>
    <aspectj.version>1.8.10</aspectj.version>
    <allure.version>2.17.3</allure.version>
    <cucumber.version>7.2.3</cucumber.version>
</properties>

<dependencies>

    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-testng</artifactId>
        <version>${cucumber.version}</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>${cucumber.version}</version>
        <scope>compile</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>4.4.1</version>
    </dependency>
    <dependency>
        <groupId>ch.qos.reload4j</groupId>
        <artifactId>reload4j</artifactId>
        <version>1.2.19</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>7.5</version>
    </dependency>

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

    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-java-commons</artifactId>
        <version>2.17.3</version>
        <scope>compile</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-commandline -->
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-commandline</artifactId>
        <version>2.17.3</version>
        <type>pom</type>
    </dependency>

    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-cucumber3-jvm</artifactId>
        <version>2.17.3</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/junit/junit -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.2</version>
        <scope>test</scope>
    </dependency>

</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>8</source>
                <target>8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.2</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.10.0</version>
            <configuration>
                <reportVersion>${allure.version}</reportVersion>
                <allureDownloadUrl>https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/${allure.version}/allure-commandline-${allure.version}.zip</allureDownloadUrl>
                <reportVersion>${allure.version}</reportVersion>
                <reportDirectory>${basedir}/target/allure-results</reportDirectory>
            </configuration>
        </plugin>
    </plugins>
</build>

allure.properties

allure.results.directory=target/allure-results

jenkins

results path: target/allure-results

Jenkins does not create the allure-results folder. If I create a folder myself, the files for the report do not fit in the workspace

add pipeline script

pipeline {
agent any

tools {
    // Install the Maven version configured as "M3" and add it to the path.
    
    maven "3.8.5"
}

stages {
    stage('Build') {
        steps {
            // Get some code from a GitHub repository
            git 'https://github.com/steed777/GoogleTest.git'

            // Run Maven on a Unix agent.
            bat "mvn -Dtest=com.github.steed777.common.runner.**verify"

            // To run Maven on a Windows agent, use
            // bat "mvn -Dmaven.test.failure.ignore=true clean package"
        }

        
    }
}
post{
    always{
        allure([
            
            includeProperties: false, jdk: '', results: [[path: 'target/allure-results']]
            ])
    }
}
}

Solution

  • Changed the startup command: bat "mvn clean test -Dtest=BDDRunner"