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 results page.
For example:
JUnit Tests: 0 failures (±0) , 1 skipped (+1)
Package Duration Fail (diff) Skip (diff) Total (diff)
foo.bar.baz 89 ms 0 0 1 +1 5 +2
Step 1 - Installing Email Extension Plugin. Open Jenkins using the following URL: http://localhost:8080/ on any browser (in this tutorial port 8071 is used). Click on Manage Jenkins. Click on Manage Plugins. Select Email Extension and Email Extension Template Plugin and click Install Without Restart.
This plugin allows you to configure every aspect of email notifications. You can customize when an email is sent, who should receive it, and what the email says.
Added script under *Jenkins -> Manage Jenkins -> Editable Email Notification Templates-> Add New Template* and then under "Default Content" section, we added default groovy scripts (for example: groovy-html. template - Copy paste content). Save. Now under project job, under Post-build section we selected same template.
Write a Groovy template for Email Ext plugin instead of Jelly template. In Groovy template you'll have access to Build object for your build. You can then call getTestResultAction on it to obtain the AbstractTestResultAction for the build which you can then query for everything you need.
Here is a link to Jenkins Main Module API. A sample Groovy template for Ext Email plugin could be found in $JENKINS_HOME/plugins/email-ext/WEB-INF/classes/hudson/plugins/emailext/templates/groovy-html.template
. More info on Groovy template/script usage can be found in Email Ext plugin documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With