詹金斯(Jenkins
Jenkins忽略了属性,不会创建诱人的重点。请帮忙。
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
结果路径:target/allure-results
jenkins 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']]
])
}
}
}
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']]
])
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您希望与Jenkins合作,则需要安装
Allure
插件,并将其配置为管理Jenkins-&gt;全局工具配置 - &GT; Allure Commandline ...
然后在管道脚本中,您只需像这样调用魅力:
allure
命令的一部分必须匹配您在global global Configuration中为您设置的Allure的名称
。If you want allure to work with Jenkins you need to install
Allure
plugin for it and configure it inManage Jenkins -> Global Tool Configuration -> Allure Commandline...
Then inside your pipeline script, you simply call allure like this:
the
allure
part of the command has to match the name you set for allure inGlobal Configuration
.更改启动命令:bat“ MVN CLEAN TEST -DTEST = BDDRUNNER”
Changed the startup command: bat "mvn clean test -Dtest=BDDRunner"
这个对我有用。希望它有帮助
This one worked for me. Hope it helps