Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ujjboy/coverage-across-modules-demo
https://github.com/ujjboy/coverage-across-modules-demo
across-module coverage jacoco multiple-modules
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ujjboy/coverage-across-modules-demo
- Owner: ujjboy
- License: apache-2.0
- Created: 2018-04-11T02:31:24.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-15T06:42:08.000Z (over 6 years ago)
- Last Synced: 2024-11-07T04:48:55.652Z (3 months ago)
- Topics: across-module, coverage, jacoco, multiple-modules
- Language: Java
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# coverage-across-modules-demo
[![Build Status](https://travis-ci.org/ujjboy/coverage-across-modules-demo.svg?branch=master)](https://travis-ci.org/ujjboy/coverage-across-modules-demo)
[![Coverage Status](https://codecov.io/gh/ujjboy/coverage-across-modules-demo/branch/master/graph/badge.svg)](https://codecov.io/gh/ujjboy/coverage-across-modules-demo)
![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)某些工程结构下,我们会将 core 代码和 test 代码分开,例如:
```
+parent
|--core
|--api
|--spi
|--test
|--test-common
|--test-integration
```如果这个时候我们适用 jacoco 去跑测试覆盖率,你会发现测试覆盖率并不是期望中的值。
这是因为 test 模块没有包含任何 core 源码,所以是无法统计到测试覆盖率的。
这时候我们就需要用到 jacoco 0.7.7 的一个新特性 [`report-aggregate`](http://www.jacoco.org/jacoco/trunk/doc/report-aggregate-mojo.html)
使用方式:
第一步:在主`pom.xml` 加入
```xml
org.jacoco
jacoco-maven-plugin
0.7.9
default-prepare-agent
prepare-agent
default-report
test
report-aggregate
```第二步:在没用源码的工程里加入 `` 依赖
例如在:`test/test-integration/pom.xml`里加入
```
xx
test-common
xx
spi
xx
api
```
第三步:直接 `mvn test` 即可。