Jacoco Maven插件-包括测试源 [英] Jacoco Maven plugin - include test sources
问题描述
我是Jacoco maven插件的新手,并试图为我的测试类添加覆盖率分析(我正在将TestNG与故障安全插件一起使用).
I'm new in Jacoco maven plugin and trying to add coverage analysis for my test classes (I'm using TestNG with failsafe plugin).
在检查了文档和一些教程之后,我使它可以用于 Sources Root (源代码/主要)中的类,但是无法将这些类包括在 Tests Root 中>(源代码/测试).我的项目仅包含测试类,因此仅针对这些类才需要覆盖报告.
After checking the documentation and some tutorials I made it work on classes in Sources Root (src/main), but couldn't manage to include the classes in Tests Root (src/test). My project consists of only test classes, so the coverage report is required only for these.
在IntelliJ中,有一个选项启用测试文件夹中的覆盖范围"可以满足我的实际需求.因此,我认为也应该有一种在插件配置中启用这些文件夹的方法.
In IntelliJ, there is an option "Enable coverage in test folders" which does what I really want. So I think there should be a way to enable these folders in plugin configurations as well.
感谢您的帮助!
推荐答案
感谢克隆并构建了提到的jacoco版本,在本地安装了jar(不同的说明此处),并通过以下方式在覆盖率数据中添加了测试配置:
Cloned and built the mentioned version of jacoco, installed the jar locally (different instructions here) and added the tests in coverage data by configuration:
<configuration>
<includeTests>true</includeTests>
</configuration>
这篇关于Jacoco Maven插件-包括测试源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!