How can I generate html reports in jenkins

空扰寡人 提交于 2020-12-06 16:56:26

问题


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....??


回答1:


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.




回答2:


For Freestyle Project :-

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




回答3:


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

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)



来源:https://stackoverflow.com/questions/52682563/how-can-i-generate-html-reports-in-jenkins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!