【问题标题】:Viewing condition coverage in intellij在 intellij 中查看条件覆盖率
【发布时间】:2015-04-10 05:18:17
【问题描述】:

给定代码:

public void foo(int age,boolean smart) {
  if (age>18 && smart) { // <--- This is the part that should be covered
    doSomething()
  }
}

使用 JUnit 我测试 foo(15,true) 和 foo(25,true)

IntelliJ 将报告条件行已完全覆盖(绿色),但它没有

在使用 Jacoco 的 Eclipse 中,该行被正确标记为部分覆盖,并且条件为黄色。

IntelliJ 有没有办法在条件级别提供覆盖?

【问题讨论】:

标签: unit-testing intellij-idea junit code-coverage jacoco


【解决方案1】:

是的。如果您使用的是 IntelliJ IDEA 覆盖运行程序,则需要将其切换到跟踪模式。

【讨论】:

  • 太好了,我的印象是该分支已经被 Sampling 覆盖了。我现在必须回去检查我的 100% 代码覆盖测试中的几个:D
猜你喜欢
  • 2013-06-15
  • 1970-01-01
  • 1970-01-01
  • 2017-05-02
  • 1970-01-01
  • 2016-07-12
  • 2017-09-22
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多