配置 Sonar 以查看集成测试 (v6.2) [英] Configure Sonar to see Integration Tests (v6.2)

查看:15
本文介绍了配置 Sonar 以查看集成测试 (v6.2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Sonar 中可视化集成测试?

目前我只看到:

  • 全球覆盖(UT + IT)
  • UT的数量

我在某处读到我们必须在 GUI 中配置一个小部件:我没有看到任何可以做到这一点的选项.

I read somewhere we had to configure a widget in the GUI : I didn't see any option which could do that.

文档说明:

如果单元测试的覆盖率不是用 JaCoCo 计算的,总体而言覆盖率 = 集成测试覆盖率.

If coverage by unit tests is not computed with JaCoCo, overall coverage = integration test coverage.

但就我而言,当我更改我的 UT(或 IT)时,我发现覆盖范围正在发生变化.此外,我在目标中看到了 jacoco 报告:

But in my case I see that the coverage is changing when I change my UTs (or ITs). Moreover I see jacoco reports in the targets :

  • jacoco.exec
  • jacoco-it.exec

我终于尝试了官方声纳样品:它是一样的!我没有发现任何样本之间有明显的区别:

I finaly tryed the official Sonar samples : it is the same ! I didn't find any sample with a clear separation between :

  • 单元测试覆盖率
  • 集成测试覆盖率
  • 整体测试覆盖率

很抱歉,Sonar 文档和示例需要改进...

And sorry but Sonar documentation and samples have to be improved...

上下文: sonar6.2、java8、spring boot、模块化项目、maven、surefire &故障保护

Context : sonar6.2, java8, spring boot, modular project, maven, surefire & failsafe

推荐答案

从 SonarQube 6.2 开始,所有测试结果都被合并成简单的覆盖".这样做是基于这样的理论,即总的来说,大多数人并不关心他们的代码是如何被覆盖的,而只是 它被覆盖了.

Starting in SonarQube 6.2, all test results are merged into simply "coverage". This was done on the theory that by and large, most people don't care how their code is covered, only that it is covered.

通过此更改,消除了从单元测试与集成测试计算总体覆盖率的一些数学不一致问题,此外还添加了提供许多不同覆盖率报告的功能.(有些人有单元、集成、烟雾等测试).

With this change, some math inconsistencies w/r/t how Overall Coverage was calculated from unit tests versus integration tests were eliminated, and additionally the ability to feed many different coverage reports was added. (Some people have unit, integration, smoke, ... tests).

关于

我在某处读到我们必须在 GUI 中配置一个小部件:我没有看到任何可以做到这一点的选项.

I read somewhere we had to configure a widget in the GUI : I didn't see any option which could do that.

在 6.2 中删除了仪表板,因此无需配置任何小部件.覆盖范围会自动显示在项目主页上.

In 6.2 dashboards were dropped, so there are no widgets to be configured. Coverage is shown automatically on the project home page.

这篇关于配置 Sonar 以查看集成测试 (v6.2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆