带有故障安全报告的 Jenkinsfile



我有一个 jenkinsfile 可以生成 maven 万无一失的报告,并且还使用故障保护进行集成测试。

我可以从 surefire 存档测试库,并通过 Jenkins 中的链接查看它们,我想为故障保护做同样的事情。 故障安全插件根本不生成报告,更不用说通过 Jenkins 提供它们了。

我该怎么做? 这是我的 jenkinsfile:

node {
stage 'Checkout'
git credentialsId: 'mike', url: 'mike@lhost:/repo'
def mvnHome = tool 'M3'
stage 'Build'
sh "${mvnHome}/bin/mvn clean package verify"
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
stage 'SonarQube'
sh "${mvnHome}/bin/mvn -Dsonar.host.url=http://192.168.3.70:9000 sonar:sonar"
}

以下是故障的 POM:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.13</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>

同样,我看到测试运行并通过,但我没有看到报告或如何使 Jenkins 存档和显示它们。

您只包含来自 Surefire 的报告:

step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])

也许这有帮助:

step([$class: 'JUnitResultArchiver', testResults: '**/target/failsafe-reports/TEST-*.xml'])

最新更新