<tr>
<td colspan="4"><b><%= suiteName %></b></td>
</tr>
<% DateFormat format = new SimpleDateFormat("yyyyMMdd HH:mm:ss")
def execDateTcPairs = []
suite.caseResults.each() { tc ->
Date execDate = format.parse(tc.starttime)
execDateTcPairs << [execDate, tc]
}
// primary sort execDate, secondary displayName
execDateTcPairs = execDateTcPairs.sort{ a,b -> a[1].displayName <=> b[1].displayName }
execDateTcPairs = execDateTcPairs.sort{ a,b -> a[0] <=> b[0] }
execDateTcPairs.each() {
def execDate = it[0]
def tc = it[1] %>
<tr>
<td colspan="2"><%= tc.displayName %></td>
<td><b><span style="color:<%= tc.isPassed() ? "#66CC00" : "#FF3333" %>"><%= tc.isPassed() ? "PASS" : "FAIL" %></span></b></td>
<td><%= tc.getDuration().intdiv(60000)+"分"+(tc.getDuration()-tc.getDuration().intdiv(60000)*60000).intdiv(1000)+"秒" %></td>
</tr>
<% if(tc.errorMsg != null) {%>
<tr>
<td ><b><span style="font-size:10px;color:#FF3333">错误描述:</span></b></td>
<td colspan="3"><span style="font-size:10px"><%= tc.errorMsg%></span></td>
</tr>
<%
}%>
<% } // tests
} // suites %>
</tbody>
</table>
<table>
<tr>
<td><img alt="注意" src="http://i44.tinypic.com/j9rkf5.jpg"></td>
</tr>
<tr>
<td style="color:#AE0000;clear:both">这是自动化测试构建的反馈结果信息,如果要查看详情报告,请<a href="${rooturl}${build.url}"><strong> 进入 </strong></a>后先注册<br>
</td>
</tr>
<tr>
<td colspan="2" class="designed">designed by @<a href="http://www.51ste.com">ruink</a> </td>
</tr>
</table>
<!-- bottom message -->
</div>
<%
} // robot results
}
if (!robotResults) { %>
<p>No Robot Framework test results found.</p>
<%
} %>
邮件测试报告的样式如下:
至此,Jenkins与Robot的持续集成测试就大功告成了。如果你有更好的模板,或者补充,不妨投递给 51STE测试部落,我们部落力量就等你来加强了^_^。