Last active
January 28, 2024 12:01
-
-
Save unickq/036224c766a76bdd9eb5de379a187af5 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "https://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<style type="text/css"> | |
body{margin: 0px;padding: 15px}body, td, th{font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Tahoma, sans-serif;font-size: 10pt}th{text-align: left}h1{margin-top: 0px}a{color:#4a72af} | |
.status{background-color:<%=build.result.toString() == "SUCCESS" ? 'green' : 'gold' %>;font-size:28px;font-weight:bold;color:white;width:720px;height:52px;margin-bottom:18px;text-align:center;vertical-align:middle;border-collapse:collapse;background-repeat:no-repeat} | |
.status .info{color:white!important;text-shadow:0 -1px 0 rgba(0,0,0,0.3);font-size:32px;line-height:36px;padding:8px 0} | |
</style> | |
<body> | |
<div class="content round_border"> | |
<div class="status"> | |
<p class="info"><%= build.result.toString() == "SUCCESS" ? 'The build is successful' : 'The build needs to be checked' %> | |
</p> | |
</div> | |
<!-- BUILD STATUS --> | |
<table> | |
<tbody> | |
<tr> | |
<th>Project:</th> | |
<td>${project.name}</td> | |
</tr> | |
<tr> | |
<th>Build ${build.displayName}:</th> | |
<td> | |
<a href="${rooturl}${build.url}">${rooturl}${build.url}</a> | |
</td> | |
</tr> | |
<tr> | |
<th>Date of build:</th> | |
<td>${it.timestampString}</td> | |
</tr> | |
<tr> | |
<th>Build duration:</th> | |
<td>${build.durationString}</td> | |
</tr> | |
</tbody> | |
</table> | |
<!-- ALLURE REPORT --> | |
<% | |
lastAllureReportBuildAction = build.getAction(ru.yandex.qatools.allure.jenkins.AllureReportBuildAction.class) | |
lastAllureBuildAction = build.getAction(ru.yandex.qatools.allure.jenkins.AllureBuildAction.class) | |
if (lastAllureReportBuildAction) { | |
allureResultsUrl = "${rooturl}${build.url}allure" | |
allureLastBuildSuccessRate = String.format("%.2f", lastAllureReportBuildAction.getPassedCount() * 100f / lastAllureReportBuildAction.getTotalCount()) | |
} | |
if (lastAllureReportBuildAction) { | |
%> | |
<h2>Allure Results</h2> | |
<table> | |
<tbody> | |
<tr> | |
<th>Total Allure tests run:</th> | |
<td> | |
<a href="${allureResultsUrl}">${lastAllureReportBuildAction.getTotalCount()}</a> | |
</td> | |
</tr> | |
<tr> | |
<th>Failed:</th> | |
<td>${lastAllureReportBuildAction.getFailedCount()} </td> | |
</tr> | |
<tr> | |
<th>Passed:</th> | |
<td>${lastAllureReportBuildAction.getPassedCount()} </td> | |
</tr> | |
<tr> | |
<th>Skipped:</th> | |
<td>${lastAllureReportBuildAction.getSkipCount()} </td> | |
</tr> | |
<tr> | |
<th>Broken:</th> | |
<td>${lastAllureReportBuildAction.getBrokenCount()} </td> | |
</tr> | |
<tr> | |
<th>Success rate: </th> | |
<td>${allureLastBuildSuccessRate}% </td> | |
</tr> | |
</tbody> | |
</table> | |
<% } %> | |
<!-- ALLURE IMAGE --> | |
<!-- <img lazymap="${allureResultsUrl}/graphMap" src="${allureResultsUrl}/graph" alt="Allure results trend"/> --> | |
<br/> | |
<!-- JUNIT REPORT --> | |
<% def junitResultList = it.JUnitTestResult | |
if (junitResultList.size() > 0) | |
{ %> | |
<table> | |
<tr> | |
<h2 class="bg1" colspan="2"><B>${junitResultList.first().displayName}</B></h2> | |
</tr> | |
<% junitResultList.each{ | |
junitResult -> | |
junitResult.getChildren().each { packageResult -> | |
packageResult.getChildren().each{ suite -> | |
suite.getChildren().each{ test -> | |
def status = test.getStatus() | |
def testUrl = test.getUrl().replace("junit/", "testReport/") | |
def color = "lightgreen" | |
if (status == hudson.tasks.junit.CaseResult.Status.FAILED || status == hudson.tasks.junit.CaseResult.Status.REGRESSION) { | |
color = "#ffcccc" | |
} | |
if (status == hudson.tasks.junit.CaseResult.Status.SKIPPED) { | |
color = "#ffffb3" | |
} | |
%> | |
<tr bgcolor="${color}"> | |
<td > | |
${status}: <a href="${rooturl}${build.url}${testUrl}">${test.getFullName()}</a> | |
</td> | |
</tr> | |
<% } } } } %> | |
</table> | |
<% } %> | |
</div> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/a/58306318/4170608
