【问题标题】:Why does jacoco:check give an error when I create a test class为什么 jacoco:check 在我创建测试类时会出错
【发布时间】:2020-11-26 18:35:02
【问题描述】:

我正在使用 IntelliJ,当我运行我的项目时,它可以与 jacoco 和所有依赖项一起正常工作。

当我创建一个测试类时,我突然收到一个错误,我不明白为什么。

我得到的错误是这个。

[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.5:check (jacoco-check) on project 
statistik-jar: Coverage checks have not been met. See log for details. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following 
articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :statistik-jar

当我有一个测试类时,它可以正常工作,但是当我再添加一个时它会出现此错误。当我收到错误时,文件夹如下所示:

/Test
   /test.class  <-- working
   /folder
      /test2.class <-- gives a error

创建第二个类时出现此错误

【问题讨论】:

  • @HoRn intellij-idea 标签似乎与这个问题无关。

标签: java spring-boot maven jacoco


【解决方案1】:

因为 Jacoco 使用百分位数,如果您创建更多类并且没有相关测试,它会给出错误。

                        <value>COVEREDRATIO</value>
                        <minimum>0.xx</minimum>

检查这些数据。我会给你一些见解。

【讨论】:

  • 我至少有 0.4。如何进行相关测试?
  • 老兄,更改此 0.1 或其他内容并运行 converage 检查它是否有效,然后使用以下内容查找覆盖缺失的行。 jetbrains.com/help/idea/…
  • 我发现了这个问题,现在也明白了很多。我的问题是如果被检查的阶段是测试,jacoco 是否专注于测试?
猜你喜欢
  • 2019-05-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-12-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多