问题
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 )
- in my Jenkins => configure
- going down until "Post-build Actions"
- press "add post-build action"
- 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