22

I have a Jenkins CI server running on a Linux VM. Jenkins runs Gradle task (build) and tests for my project.

I know the HTML reports for test results are generated in project/build/reports folders.

Is there way to see these reports using Jenkins? Or, when the build failed, can the notification email include the link to this report?

Thanks a lot.

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
user2047824
  • 633
  • 1
  • 5
  • 16

1 Answers1

27

You can use the HTML Publisher Plugin to archive the reports in Jenkins.

Add the "Publish HTML reports" post-build action, enter the directory containing your reports and specify the index page.

A link to the report will be displayed on the job's page and you can include the link in a mail, e.g. http://localhost:8080/job/my-job/Tests/

enter image description here

daspilker
  • 8,154
  • 1
  • 35
  • 49
  • How do you get access to the old HTML reports? I see the option "Keep past HTML reports", but I checked this option and I keep seeing only the last report – Michael P May 31 '17 at 20:37
  • 15
    The Pipeline DSL: `publishHTML([reportDir: 'build/reports/tests/test', reportFiles: 'index.html', reportName: 'HTML Report'])` – MarkHu Nov 02 '17 at 21:49
  • 1
    Further to @MarkHu's valuable answer, there are additional options now required (I'm using [HTML Publisher](https://plugins.jenkins.io/htmlpublisher/) plugin Version 1.31). Easiest way to get all the correct options is via `/pipeline-syntax/` as hinted to on the plugin home page. – ATutorMe Nov 24 '22 at 02:15