I got some Jelly template working for this. First the jenkins file:

Make sure you collect your unit test results:
step([$class: 'JUnitResultArchiver', testResults: 'TestResult/*.xml']);

Then send the email:
emailext body: '${JELLY_SCRIPT,template="
${env.JENKINS_HOME}/email-templates/myTemplateFile.jelly"}', subject: 
email_subject, to: 'c...@bodycad.com', replyTo: 'jenk...@bodycad.com', 
mimeType: 'text/html'

Take car under Windows the '\\' is not supported into the template path and 
you need to flip them:
'${JELLY_SCRIPT,template="' + "${env.JENKINS_HOME}/email-templates/
myTemplateFile.jelly".replaceAll('[\\\\]','/') + '"}'

Here's the Jelly template that should be saved into Jenkins home folder 
under email-templates (I removed any style here to simplify the whole thing 
and removed other parts), you can modify the html to your code:

<?jelly escape-by-default='true'?>
<!DOCTYPE html [
<!ENTITY nbsp "&#38;#38;nbsp&#59;">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d=
<!-- Header -->
<!-- Unit Test TEMPLATE -->
<TABLE width="100%">
 <TD colspan="2"><B>Unit Tests</B></TD>
 <j:forEach var="junitResult" items="${it.JUnitTestResult}">
 <j:forEach var="packageResult" items="${junitResult.getChildren()}">
 <TD>Tests Root Name</TD>
 <TD>Tests Counts</TD>
 <TD>Tests Pass</TD>
 <TD>Tests Skip</TD>
 <TD>Tests Fail</TD>
 <j:forEach var="failed_test" items="${packageResult.getFailedTests()}">
 <TD colspan="2"><B><li>Failed: ${failed_test.getFullName()} </li></B></TD>
<!-- Footer -->

You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to