maven build在本地给出了正确的结果,但我通过位桶管道运行了相同的结果,最后build段的测试结果是测试结果总数的3倍。我在atlassian平台上发现了类似的问题,但没有答案:
我看到了构建后部分,并注意到默认情况下,测试结果解析器正在解析surefire/failsafe/ test -results文件夹中的每个测试xml文件,这就是为什么count不正确的原因。
我尝试在bitbucket管道文件中重置默认测试结果目录/文件路径,但找到了GitLab的解决方案,但没有找到Bitbucket的解决方案:
https://support.atlassian.com/bitbucket-cloud/docs/test-reporting-in-pipelines/
发布于 2020-10-19 21:37:34
所以我等待了2个月才找到配置级别的解决方案,但我不得不选择一个变通办法。
在bitbucket拆卸阶段之前,我删除了target下的目录,即junitresults和名为folder的套件。
由于我的项目是testng+maven,所以我使用了IsuiteListener和maven clean插件来清理目录,造成重复的测试结果。
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>Deleting all unnecessary files</id>
<phase>verify</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>target/surefire-reports/junitreports</directory>
<followSymlinks>false</followSymlinks>
<includes>
<include>*</include>
</includes>
</fileset>
</filesets>
<verbose>true</verbose>
</configuration>
</plugin>和套件级别的文件夹
String path = System.getProperty("user.dir") + File.separator
+ "target" + File.separator + "surefire-reports"
+ File.separator + "${suite folder name}";
try {
File file = new File(path);
if (file.isDirectory()) {
FileUtils.deleteDirectory(new File(path));
MainLogger.logger().info("deleted " + path);
} else
MainLogger.logger().info("Not deleted " + path);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}https://stackoverflow.com/questions/63503980
复制相似问题