jenkins 中不存在 allure-results
allure-results does not exist in jenkins
Jenkins 忽略属性并且不创建 allure-results。请帮忙
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
詹金斯
结果路径:target/allure-results
Jenkins 不会创建 allure-results 文件夹。如果我自己创建一个文件夹,报告的文件不适合工作区
添加管道脚本
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']]
])
}
}
}
如果你想要 allure 与 Jenkins 一起工作,你需要为它安装 Allure
插件并在 Manage Jenkins -> Global Tool Configuration -> Allure Commandline...
中配置它
然后在您的管道脚本中,您只需像这样调用 allure:
allure includeProperties: false, jdk: '', results: [[path: 'allure-results']]
命令的 allure
部分必须与您在 Global Configuration
中为 allure 设置的名称相匹配。
更改了启动命令:bat "mvn clean test -Dtest=BDDRunner"
Jenkins 忽略属性并且不创建 allure-results。请帮忙
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
詹金斯
结果路径:target/allure-results
Jenkins 不会创建 allure-results 文件夹。如果我自己创建一个文件夹,报告的文件不适合工作区
添加管道脚本
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']]
])
}
}
}
如果你想要 allure 与 Jenkins 一起工作,你需要为它安装 Allure
插件并在 Manage Jenkins -> Global Tool Configuration -> Allure Commandline...
然后在您的管道脚本中,您只需像这样调用 allure:
allure includeProperties: false, jdk: '', results: [[path: 'allure-results']]
命令的 allure
部分必须与您在 Global Configuration
中为 allure 设置的名称相匹配。
更改了启动命令:bat "mvn clean test -Dtest=BDDRunner"