声纳故障安全测试结果

2022-09-03 06:59:12

我刚刚将单元测试和集成测试分开。我想将覆盖结果与UT和IT分开。

我按照本教程进行了操作,它有效(感谢@JohnDobie)。

sonar coverage test results

Sonar 显示单独的代码覆盖率结果和单元测试成功(右上角)。但是,如何在声纳中获得集成测试成功?


答案 1

等待在 IT 执行结果的声纳中实现(请参阅@Fabrice答案)。我在本教程中找到了解决方法。这个想法是:

... fool Sonar to show test success for both unit and integration tests together by instructing Failsafe to store its test reports to the same directory as Surefire instead of the default failsafe-reports.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <configuration>
        <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
    </configuration>
</plugin>

结果并不完美,因为所有测试结果都显示在单元测试小部件中。但我真的不想在ci服务器中检查IT测试结果。我想要为我的项目提供一个多合一的仪表板。

enter image description here


答案 2

IT 执行结果不会推送也不会显示在 Sonar 中。

这是我们将来可能会添加的内容,但我们首先关注的是覆盖范围,因为这毕竟是最重要的。(执行结果通常通过CI服务器上的CI软件进行监控)


推荐