How can I write a Jenkins email-ext template to display test results like the standard test report

后端 未结 5 1399
暗喜
暗喜 2020-12-23 22:27

I have tweaked the standard jelly template to display the current test results in a table, however I really want to be able to display diffs as seen in Jenkins own test resu

5条回答
  •  时光取名叫无心
    2020-12-23 23:16

    If you are struggle on how to access it via internal API (difficult to know and it exists limitation always), there is another more flexible way to do it.

    Using FILE token instead of groovy template

    1. using script to access your testing data via Jenkins API, for your case, it is like http://jenkins.server/job/yourjob/lastCompletedBuild/testReport/api/xml and generate your own html file like email.html under the workspace
    2. In Default Content form in the email-ext configuration, using FILE token to send the email directly ${FILE, path="email.html"}

    In step 1 above, you can also use more flexible way for your own template, I use python script and simple string Template.

    It works perfect for me.

提交回复
热议问题