My code structure is as follows :
events
messages
other-code
functional-tests
In the build script for jacoco, first it has to copy all classes and use that class directory to run the tool on. Can you please describe the steps wrt the target directories here. I mean how do I mention the directory on which to run the code coverage upon.
Upon build, each folder has its own target folder with classes in side them.
Here are the steps:
- Build project as a job in Jenkins
- Deploy it to user-stage
- Run jacoco report job in Jenkins
Jacoco report job explanation:
Build step - maven 3.3.3 goals - clean test and testsuite, user-stage details and other info are passed.
Post steps - execute shell
Unable to format and paste here, so uploaded here: https://zerobin.net/?8a988cd05bf3d752#fbzMlW1b7uzD+HZnmwnd9WjQYBI3j95Q7DCIx6q+l0U=
Invoke top level maven targets - maven 3.3.3 -f jacoco_pom.xml jacoco:dump antrun:run@report
The clasDir
variable that's been used in the shell paste should have classes. So far, I have done this in the start of shell script.
mkdir -p target/classes
cp -R messages/target/classes target/classes
and set clsDir = target/classes
,
This way I got the report on that module. My testsuite contained only one class. I want to include other modules also like events
, other-code
and also link the sources.
I need help on how should i set it up. The main purpose is to generate code coverage reports of functional tests.
EDIT:
Answer: Below answer helped, but it was all to be done with shell commands not any UI. So, cloning the repo, doing mvn clean package -DskipTests
and copying over all first level subfolders from all the module folders helped, but then it showed error in coverage Execution data mismatch for class files. Which means that the class instrumented and the class we are using for coverage are built separately by different JVM (one in Jenkins another one thats deployed in stage).
So the solution was to not clone and recompile them, but download the manifest from the deployment repository and unpacking all the jars. This way I had all the classes in same version.