简体   繁体   English

查找在不同的Maven项目中编写的单元测试和集成测试的组合代码覆盖率

[英]Find combined code coverage of unit tests and integration tests written in different maven projects

-Project-A(API)
----src
    ---main(Main code is written here)
    ---test(Contains Service layer tests)
---pom.xml

-Project-B(APIClientTests)
----src
    ---main
    ---test(Contains Client tests)
---pom.xml

My project structure looks like this. 我的项目结构如下所示。 I would like to know that is there any way to calculate code coverage of code written in main of Project A, by running the integration tests written in Project A and JUnit tests written in project B. 我想知道有什么方法可以通过运行以项目A编写的集成测试和以项目B编写的JUnit测试来计算以项目A的主体编写的代码的代码覆盖率。

Use Jacoco and parent pom : 使用Jacoco和parent pom:

  1. parent pom 父母pom

     +Project-A +Project-B 
  2. in parent pom : 在父pom中:

     <plugins> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 单元测试和集成测试的 Jacoco 覆盖率与覆盖率相结合 - Jacoco coverage of unit and integration tests combined with coverageratio 在声纳中获得正确的覆盖范围,用于单独的maven模块中的单元和集成测试 - Get correct coverage in sonar for unit and integration tests in separate maven modules Maven集成测试和带有概要文件的单元测试 - Maven Integration tests and unit tests with profile Maven-运行集成和单元测试 - Maven - run integration and unit tests Maven - 单元测试的独立集成测试 - Maven - separate integration tests from unit tests 生成单元和集成测试的声纳覆盖报告 - generating sonar coverage reports for unit and integration tests 当代码和单元测试在不同模块中时,Quarkus Jacoco 覆盖率不起作用 - Quarkus Jacoco coverage not working when code and unit tests are in different modules Maven 在没有集成测试的情况下运行单元测试,在没有单元测试的情况下运行集成测试 - Maven run unit tests without integration tests, and integration tests without unit tests 集成测试之外的Web应用程序的代码覆盖率 - Code coverage of web application outside integration tests 检查代码覆盖率的单元测试中的反射 - Reflection in unit tests for checking code coverage
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM