diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..45fb61c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +# this is a java project using maven +language: java +# switch off gpg handling +# switch on coverage +install: mvn clean install -D coverage -Dgpg.skip=true +# put the result on codecov.io +after_success: +- bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index 2c57ab5..a21e235 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,46 @@ -# Coverage-Reports mit Maven in Multi-Modul-Projekten +see +- https://blog.doubleslash.de/code-coverage-reports-mit-maven-in-multi-modul-projekten/ +- http://wiki.bitplan.com/index.php/Jacoco_maven_multi_module_code_coverage -Beispielkonfiguration für die Generierung von Coverage-Reports in einem Maven-Projekt, das aus mehreren Modulen -besteht. Für Unit-Tests und Integrationstests werden Coverage-Reports erstellt, die jeweils über alle Module -aggregiert sind. +[![Travis (.org)](https://img.shields.io/travis/BITPlan/maven-multimodule-coverage.svg)](https://travis-ci.org/BITPlan/maven-multimodule-coverage) +[![codecov](https://codecov.io/gh/BITPlan/maven-multimodule-coverage/branch/junit-4/graph/badge.svg)](https://codecov.io/gh/BITPlan/maven-multimodule-coverage/branch/junit-4) -Darüber hinaus wird ein Overall-Report erzeugt, der die Gesamt-Testabdeckung beinhaltet (Unit- und -Integrationstests zusammen). +[![BITPlan](http://wiki.bitplan.com/images/wiki/thumb/3/38/BITPlanLogoFontLessTransparent.png/198px-BITPlanLogoFontLessTransparent.png)](http://www.bitplan.com) -Für die Messung der Testabdeckung wird das -[JaCoCo-Maven-Plugin](http://www.eclemma.org/jacoco/trunk/doc/maven.html) verwendet. +# Coverage-Reports with Maven in Multi-Modul-Projects -## Laufzeitumgebung ## +This is an example configuration for the generation of coverage reports in a maven project consisting of +multiple modules. Coverage reports are generated for unit and integration tests which are aggregated over all modules. +aggregiert sind. -Erstellt und getestet wurde dieses Projekt mit folgender Laufzeitkonfiguration: +You also get an overall - report showing the total test coverage over unit and integration tests. -- Maven 3.5 -- JUnit 4 +To measure the test coverage the +[JaCoCo-Maven-Plugin](http://www.eclemma.org/jacoco/trunk/doc/maven.html) is used. -Eine Version dieses Beispiels für JUnit 5 befindet sich -[hier](https://github.com/doubleSlashde/maven-multimodule-coverage/tree/master). +## Enviroment ## +The project was created and tested with the following environment: -## Erstellung der Reports ## +- Maven 3.5 +- JUnit 4 -Die Reporterzeugung erfolgt automatisch während der Testausführung. Ein über alle Module aggregierter Coverage-Report -für die Unit-Tests wird beim Durchlaufen von Mavens `test`-Phase erzeugt, also z.B. beim Aufruf von `mvn test`. +Another version of this project for JUnit 5 is available in the +[master branch (german)](https://github.com/doubleSlashde/maven-multimodule-coverage/tree/master). -Der Report für die Integrationstests sowie der Gesamtreport werden in der `verify`-Phase generiert, also wenn -z.B. `mvn verify` ausgeführt wird. Dies gilt natürlich auch für den Aufruf von späteren Phasen, denen die Phase `verify` -vorausgeht, also z.B. für `mvn install` oder `mvn deploy`. +## Creation of the reports ## +The reports are automatically created during the test execution. An aggregated report for all modules is +created running the Unit-Tests during maven's `test`-phase, by giving the command `mvn test`. -## Ablageort der Reports ## +The reports for the integration tests and the aggregated report are created during the `verify`-Phase by e.g. starting the `mvn verify` command. This is also true for later phases after `verify` +e.g. `mvn install` or `mvn deploy`. -Die Coverage-Reports (HTML) werden im `site`-Ordner unterhalb von `target` des Moduls `coverage` abgelegt: -- `coverage/target/site/jacoco-aggregate-ut/index.html`: Coverage-Report der Unit-Tests -- `coverage/target/site/jacoco-aggregate-it/index.html`: Coverage-Report der Integrationtests -- `coverage/target/site/jacoco-aggregate-all/index.html`: Kumulierter Gesamtreport der Unit- und Integrationstests +## Storagepath for Reports ## -## Wichtig! ## +The Coverage-Reports (HTML) are located in the `site`-folder as a subfolder of `target` of the module `coverage`: +- `coverage/target/site/jacoco-aggregate-ut/index.html`: Coverage-Report of Unit-Tests +- `coverage/target/site/jacoco-aggregate-it/index.html`: Coverage-Report of Integrationtests +- `coverage/target/site/jacoco-aggregate-all/index.html`: Aggregated Totalreport of Unit- and Integrationstests -Wird dem Projekt ein neues Modul hinzugefügt, muss dieses in der `pom.xml` des `coverage`-Moduls als Dependency -hinzugefügt werden. _Ansonsten wird die Testabdeckung des neuen Moduls in den aggregierten Reports nicht berücksichtigt_! +## Important when adding modules! ## +The modules you'd like to get reports for needed to be declared as dependencies in the `pom.xml` of the `coverage`-Module. +Otherwise the module's coverage report will not be integrated into the aggregated report. diff --git a/pom.xml b/pom.xml index 9ed0ddd..3c53068 100644 --- a/pom.xml +++ b/pom.xml @@ -43,7 +43,7 @@ org.jacoco jacoco-maven-plugin - 0.7.9 + 0.8.4