I have jenkins file which has publishHTML method to generate report with .html file of jacoco result. Is it possible to display that report on dashboard like 'Test Trend Result' ?
2 Answers
So I went through a bit then found a solution adding to the pipeline directly
publishCoverage adapters: [jacocoAdapter('target/site/jacoco/jacoco.xml')]
Reference: https://github.com/jenkinsci/code-coverage-api-plugin

- 1,122
- 1
- 12
- 40
-
You can also surface everything in one report using the "mergeToOneReport" argument, such as: publishCoverage adapters: [jacocoAdapter( mergeToOneReport: true, path: '**/reports/jacoco/jacocoTestReport/*.xml')] – Lucy Apr 16 '20 at 13:15
You need to use the JaCoCo plugin
Get coverage data as part of your build First you need to get coverage calculated as part of your build/tests, see the JaCoCo documentation for details. You need at least one or more *.exec file available after tests are executed. Usually this means adjusting your Maven pom.xml or Ant build.xml file..
Set up coverage retrieval and publishing In order to get the coverage data published to Jenkins, you need to add a JaCoCo publisher and configure it so it will find all the necessary information. Use the help provided via the question-mark links for more information. Basically you specify where the *.exec files are, where compiled code can be found and where the corresponding source code is located after the build is finished to let the plugin gather all necessary pieces of information..

- 8,817
- 2
- 32
- 47