An open API service indexing awesome lists of open source software.

https://github.com/edgar-code-repository/code-coverage-with-jacoco

Measuring code coverage with the Java Code Coverage Library (JaCoCo)
https://github.com/edgar-code-repository/code-coverage-with-jacoco

Last synced: 12 months ago
JSON representation

Measuring code coverage with the Java Code Coverage Library (JaCoCo)

Awesome Lists containing this project

README

          

CODE COVERAGE WITH JACOCO
--------------------------------------------------------------------------

Measuring code coverage with the Java Code Coverage Library (JaCoCo).

--------------------------------------------------------------------------

**JaCoCo plugin added to pom.xml file:**

```


org.jacoco
jacoco-maven-plugin
0.8.5


com/example/demo/CodeCoverageWith*
com/example/demo/configuration/*
com/example/demo/dto/*
com/example/demo/dto/response/*
com/example/demo/model/*
com/example/demo/repository/*





prepare-agent




report
test

report


target/jacoco-report



```

**Some packages were exluded from JaCoCo:**

```

com/example/demo/CodeCoverageWith*
com/example/demo/configuration/*
com/example/demo/dto/*
com/example/demo/dto/response/*
com/example/demo/model/*
com/example/demo/repository/*

```

**Location where the report will be generated:**

```

target/jacoco-report

```

--------------------------------------------------------------------------

**After JaCoco plugin is added, the test maven phase is executed:**

![TestPhase](./screenshots/maven_test_phase.png)

**A report is generated in the directory target/jacoco-report:**

![](./screenshots/jacoco_report_directory.png)

**Right now, there are no tests available and the JaCoCo report says there is a code coverage of 7%
for missed instructions and 0% for missed branches:**

![Report1](./screenshots/jacoco_report_1.png)

**A few unit tests were added and now the code coverage has reached 97% for missed instructions
and 83% for missed branches:**

![Report2](./screenshots/jacoco_report_2.png)

--------------------------------------------------------------------------