Well, it is hard to investigate what is going wrong in particular project when developers fail to follow best practices, so, what is written below is based on my own opinion about how it should work.
I succeeded to get following jacoco-it
:
parking-system
Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Missed Classes
Total 384 of 1,119 65% 41 of 61 32% 48 95 122 315 21 62 4 13
com.parkit.parkingsystem.service 158299 65% 2013 39% 19 34 49 124 4 15 1 3
com.parkit.parkingsystem.config 807 8% 6 0% 7 9 33 35 4 6 0 1
com.parkit.parkingsystem.util 4511 19% 4 0% 5 6 15 17 3 4 0 1
com.parkit.parkingsystem.dao 43319 88% 35 62% 3 13 8 87 0 9 0 2
com.parkit.parkingsystem.model 4084 67% 82 20% 9 27 10 42 5 22 0 2
com.parkit.parkingsystem 12 0% n/a 3 3 5 5 3 3 1 1
com.parkit.parkingsystem.constants 615 71% n/a 2 3 2 5 2 3 2 3
after following steps:
- bind
prepare-agent-integration
and report-integration
to maven lifecycle:
diff --git a/pom.xml b/pom.xml
index 0bf2fb9..fc3bdaa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -153,6 +153,20 @@
<goal>report</goal>
</goals>
</execution>
+ <execution>
+ <id>prepare-agent-integration</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>prepare-agent-integration</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>post-report-integration</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>report-integration</goal>
+ </goals>
+ </execution>
</executions>
</plugin>
<plugin>
- instantiate mysql db:
% docker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=rootroot mysql:latest
% docker exec -ti 61c9c7931a5a /bin/bash
root@61c9c7931a5a:/# su - mysql
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 24
Server version: 8.0.27 MySQL Community Server - GPL
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database test
-> ;
Query OK, 1 row affected (0.01 sec)
mysql> use test;
@execute resources/Data.sql starting from line 5
- set JAVA_HOME to 1.8 - it is important because they are using outdated version of jacoco
mvn verify