Created
March 12, 2014 21:04
-
-
Save sergebug/9516308 to your computer and use it in GitHub Desktop.
jelly template to email FitNesse test results using email-ext plugin from Jenkins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"> | |
<html> | |
<head> | |
<title>${project.name}</title> | |
<style> | |
body table, td, th, p, h1, h2 { | |
margin:0; | |
font:normal normal | |
100% Georgia, Serif; | |
background-color: #ffffff; | |
} | |
h1, h2 { | |
border-bottom:dotted 1px #999999; | |
padding:5px; | |
margin-top:10px; | |
margin-bottom:10px; | |
color: #000000; | |
font: normal bold 130% | |
Georgia,Serif; | |
background-color:#f0f0f0; | |
} | |
tr.gray { | |
background-color:#f0f0f0; | |
} | |
h2 { | |
padding:5px; | |
margin-top:5px; | |
margin-bottom:5px; | |
font: italic bold 110% Georgia,Serif; | |
} | |
.bg2 { | |
color:black; | |
background-color:#E0E0E0; | |
font-size:110% | |
} | |
th { | |
font-weight: bold; | |
} | |
tr, td, th { | |
padding:2px; | |
} | |
td.test_passed { | |
color:blue; | |
} | |
td.test_failed { | |
color:red; | |
} | |
td.center { | |
text-align: center; | |
} | |
td.test_skipped { | |
color:grey; | |
} | |
.console { | |
font: normal normal 90% Courier New, | |
monotype; | |
padding:0px; | |
margin:0px; | |
} | |
div.content, div.header { | |
background: #ffffff; | |
border: dotted | |
1px #666; | |
margin: 2px; | |
content: | |
2px; | |
padding: 2px; | |
} | |
table.border, th.border, td.border { | |
border: | |
1px solid black; | |
border-collapse:collapse; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="header"> | |
<j:set var="spc" value="&nbsp;&nbsp;" /> | |
<!-- GENERAL INFO --> | |
<table> | |
<tr class="gray"> | |
<td align="right"> | |
<j:choose> | |
<j:when test="${build.result=='SUCCESS'}"> | |
<img src="${rooturl}static/e59dfe28/images/32x32/blue.gif" /> | |
</j:when> | |
<j:when test="${build.result=='FAILURE'}"> | |
<img src="${rooturl}static/e59dfe28/images/32x32/red.gif" /> | |
</j:when> | |
<j:otherwise> | |
<img | |
src="${rooturl}static/e59dfe28/images/32x32/yellow.gif" /> | |
</j:otherwise> | |
</j:choose> | |
</td> | |
<td valign="center"> | |
<b style="font-size: 200%;">BUILD ${build.result}</b> | |
</td> | |
</tr> | |
<tr> | |
<td>Build URL</td> | |
<td> | |
<a href="${rooturl}${build.url}">${rooturl}${build.url}</a> | |
</td> | |
</tr> | |
<tr> | |
<td>Project:</td> | |
<td>${project.name}</td> | |
</tr> | |
<tr> | |
<td>Date of build:</td> | |
<td>${it.timestampString}</td> | |
</tr> | |
<tr> | |
<td>Build duration:</td> | |
<td>${build.durationString}</td> | |
</tr> | |
<tr> | |
<td>Build cause:</td> | |
<td> | |
<j:forEach var="cause" items="${build.causes}">${cause.shortDescription} | |
</j:forEach> | |
</td> | |
</tr> | |
<tr> | |
<td>Build description:</td> | |
<td>${build.description}</td> | |
</tr> | |
<tr> | |
<td>Built on:</td> | |
<td> | |
<j:choose> | |
<j:when test="${build.builtOnStr!=''}">${build.builtOnStr}</j:when> | |
<j:otherwise>master</j:otherwise> | |
</j:choose> | |
</td> | |
</tr> | |
</table> | |
</div> | |
<!-- HEALTH TEMPLATE --> | |
<div class="content"> | |
<j:set var="healthIconSize" value="16x16" /> | |
<j:set var="healthReports" value="${project.buildHealthReports}" /> | |
<j:if test="${healthReports!=null}"> | |
<h1>Health Report</h1> | |
<table> | |
<tr> | |
<th>W</th> | |
<th>Description</th> | |
<th>Score</th> | |
</tr> | |
<j:forEach var="healthReport" items="${healthReports}"> | |
<tr> | |
<td> | |
<img | |
src="${rooturl}${healthReport.getIconUrl(healthIconSize)}" /> | |
</td> | |
<td>${healthReport.description}</td> | |
<td>${healthReport.score}</td> | |
</tr> | |
</j:forEach> | |
</table> | |
<br /> | |
</j:if> | |
</div> | |
<!-- FitNesse TEMPLATE --> | |
<j:set var="FitNesseResultsAction" value="${it.getAction('hudson.plugins.fitnesse.FitnesseResultsAction')}" /> | |
<j:if test="${FitNesseResultsAction.isEmpty()!=true}"> | |
<j:set var="FitnesseResults" value="${FitNesseResultsAction.getResult()}" /> | |
<div class="content"> | |
<a href="${rooturl}${build.url}/${FitNesseResultsAction.getUrlName()}/"> | |
<h1>FitNesse Tests</h1> | |
</a> | |
<br>${FitNesseResultsAction.getSummary()}</br> | |
<table> | |
<j:if test="${FitnesseResults.failCount > 0}"> | |
<tr class="result-failed"><td><strong>Wrong and Exceptions: ${FitnesseResults.failCount}</strong></td></tr> | |
<tr><th>Name</th><th>Right</th><th>Wrong</th><th>Ignored</th><th>Exceptions</th><th>Details-Captured</th><th>Details-Remote</th></tr> | |
<j:forEach var="r" items="${FitnesseResults.failedTests}"> | |
<tr><td>${FitnesseResults.toHtml(r)}</td> | |
<td>${r.passCount}</td> | |
<td>${r.failOnlyCount}</td> | |
<td>${r.ignoredCount}</td><td>${r.exceptionCount}</td> | |
<td>${r.getDetailsLink()}</td> | |
<td>${r.getDetailRemoteLink()}</td></tr> | |
</j:forEach> | |
</j:if> | |
<j:if test="${FitnesseResults.skipCount > 0}"> | |
<tr class="result-skipped"><td><strong>Ignored: ${FitnesseResults.skipCount}</strong></td></tr> | |
<tr><th>Name</th><th>Right</th><th>Wrong</th><th>Ignored</th><th>Exceptions</th><th>Details-Captured</th><th>Details-Remote</th></tr> | |
<j:forEach var="r" items="${FitnesseResults.skippedTests}"> | |
<tr><td>${FitnesseResults.toHtml(r)}</td><td>${r.passCount}</td><td>${r.failOnlyCount}</td> | |
<td>${r.ignoredCount}</td><td>${r.exceptionCount}</td> | |
<td>${r.getDetailsLink()}</td> | |
<td>${r.getDetailRemoteLink()}</td></tr> | |
</j:forEach> | |
</j:if> | |
<j:if test="${FitnesseResults.passCount > 0}"> | |
<tr class="result-passed"><td><strong>Right: ${FitnesseResults.passCount}</strong></td></tr> | |
<tr><th>Name</th><th>Right</th><th>Wrong</th><th>Ignored</th><th>Exceptions</th><th>Details-Captured</th><th>Details-Remote</th></tr> | |
<j:forEach var="r" items="${FitnesseResults.passedTests}"> | |
<tr><td>${FitnesseResults.toHtml(r)}</td> | |
<td>${r.passCount}</td> | |
<td>${r.failOnlyCount}</td> | |
<td>${r.ignoredCount}</td> | |
<td>${r.exceptionCount}</td> | |
<td>${r.getDetailsLink()}</td> | |
<td>${r.getDetailRemoteLink()}</td></tr> | |
</j:forEach> | |
</j:if> | |
</table> | |
<br /> | |
</div> | |
</j:if> | |
<div class="content"> | |
<!-- CONSOLE OUTPUT --> | |
<a href="${rooturl}${build.url}/console"> | |
<h1>Console Output</h1> | |
</a> | |
<table class="console"> | |
<j:forEach var="line" items="${build.getLog(50)}"> | |
<tr> | |
<td> | |
<tt>${line}</tt> | |
</td> | |
</tr> | |
</j:forEach> | |
</table> | |
<br /> | |
</div> | |
</body> | |
</html> | |
</j:jelly> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's seems pretty. Is it possible to have a screenshot of the email received ? Thanks !