2015-11-25 38 views
0
-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 

我的项目结构如下所示。我想知道是否有任何方法通过运行在项目A中编写的集成测试和在项目B中编写的JUnit测试来计算代码覆盖的代码覆盖率。查找在不同maven项目中编写的单元测试和集成测试的组合代码覆盖

+0

你使用maven中的任何插件? –

+0

是的,我正在使用Spring Roo所需的所有插件和依赖项。使用的插件是项目A的tomcat7-maven-plugin,maven-shade-plugin,maven-compiler-plugin,maven-surefire-plugin,项目B的maven dependency插件,surefire插件,编译器插件,build-helper-maven-plugin另外,我使用Swagger作为REST-API(project-A)的接口作为测试控制台。 –

+0

看看https://maven.apache.org/surefire/maven-surefire-plugin/ –

回答

0

使用Jacoco和父pom:

  1. 父POM

    +Project-A 
    +Project-B 
    
  2. 在父POM:

    <plugins> 
        <plugin> 
         <groupId>org.jacoco</groupId> 
         <artifactId>jacoco-maven-plugin</artifactId> 
    
相关问题