2

Image of post build action step for "Publish HTML Reports plugin" in maven based project

After adding the plugin also I am getting http 404 error.

Is there anything required to write any shell script or any code in pipeline to generate html reports or directly we can generate html reports?

Can you please help me out in resolving the error....??

Sweety
  • 53
  • 2
  • 2
  • 6
  • You can do some sanity checks like does the folder exist and the index.html. I have also faced the following issue that sometimes prevents html pages from being rendered you can check it for reference https://stackoverflow.com/questions/35783964/jenkins-html-publisher-plugin-no-css-is-displayed-when-report-is-viewed-in-j – saad Oct 07 '18 at 03:32
  • Are you expecting the entire Jenkins build log to generate as an HTML report, or just some type of subsection like test cases – Chris Maggiulli Apr 03 '22 at 04:58

3 Answers3

0

According to documents on the plugin page, it only helps us bring the pages to Jenkins dashboard (not generate them). That means we have to generate the HTML files in our pipeline or build steps using other tools.

If you use maven, I suggest you look at Surefire. Run the test and generate HTML reports in build steps. Then, publish them with the plugin in post-build steps.

Lam Le
  • 1,489
  • 3
  • 14
  • 31
0

For Freestyle Project :-

enter image description here

For Pipeline Project :-

Add the below piece of code :

publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: true, reportDir: "HTML Report Directory", reportFiles: 'html-file_name', reportName: 'HTML Report', reportTitles: ''])

Change the tag - reportDir and reportFiles accordingly

user_9090
  • 1,884
  • 11
  • 28
0

So in my project, first I create a report that create during running of my tests localy (use ExtentHtmlReporter library for that )

  1. in my Jenkins => configure
  2. going down until "Post-build Actions"
  3. press "add post-build action"
  4. press on "publish HTML report"

added image

enter image description here

in the added field you should fill like that the path , the html file name (the image that added it my project where my report create) enter image description here

Vladi
  • 1,662
  • 19
  • 30