0
votes

I'm trying to generate jacoco code coverage reports from the jacoco exec file (generated on remote server) which I have copied into Jenkins workspace.

My requirement is to start the server in a remote location, then executes scenario tests against the remote server and get the code coverage.

For that purpose, I have placed the jacoco agent in the server side, then attach the jacoco agent as a JVM option and do the instrumentation on the server side. This will automatically generate an empty jacoco exec file in the server side when the server starts up. Then I execute the tests and shutdown the server. Next the generated jacoco exec has copied to jenkins workspace and create a freestyle project. Then added only the exec file in the "Record jacoco coverage report" under "Post-build actions". After that when I triggered a build, I got the results as "Overall coverage: class: 0, method: 0, line: 0, branch: 0, instruction: 0". Could you please help me to get this solved and generate the reports.

I'm using Jenkins 2.138.2 version and jacoco plugin 3.0.4 version.

1

1 Answers

0
votes

According to my understanding the jacoco.exec file contains only the information which code has been executed. So in order to measure the code coverage, this information has to be compared with the class files.

So try to add the class files to the workspace.

If you also want to drill down into the source code in jenkins, add the source code to your workspace.