其他源代码存储库的Java代码覆盖率 [英] Java code coverage for other source code repository

查看:71
本文介绍了其他源代码存储库的Java代码覆盖率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有maven project1,它具有src/main/java-应用程序源代码

I've maven project1, which has src/main/java -- application source code

我确实有另一个maven project2,它具有所有测试src/main/test-所有api测试,都属于上述project1

I do have another maven project2, which has all tests src/main/test -- all api tests which are all part of above project1

现在,是否有任何方法可以在project2中配置Java Jacoco代码覆盖率代理,以便在执行来自project2的测试时应计算project1的代码覆盖率?

Now, Is there any way to configure Java Jacoco code coverage agent in project2 in such away that It should calculate code coverage of project1 when execute tests from project2 ?

预先感谢,我知道这是一种理论问题.

Thanks in advance, I know it's kind of theoretical question.

推荐答案

一般地说-是的,有可能:

Speaking in general - yes it is possible:

  • 默认情况下,代理收集有关所有 课,无论他们来自何处.
  • 生成报告需要 收集了有关执行的信息,以及原始的类文件和 您要为其生成报告的来源.
  • By default agent collects information about execution of all the classes, no matter from where they come.
  • Report generation requires collected information about execution, plus original class files and sources for which you want to generate report.

如果两个项目都属于同一Maven反应堆,请查看 jacoco简单集成测试解决方案.如果没有,那么JaCoCo Ant Tasks可以提供路径指定方面的灵活性- http://www.jacoco.org/jacoco/trunk/doc/ant.html

If both projects are part of the same Maven reactor, then have a look at jacoco simple integration test solution . If not, then JaCoCo Ant Tasks that provide flexibility in specification of paths - http://www.jacoco.org/jacoco/trunk/doc/ant.html

这篇关于其他源代码存储库的Java代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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