Created
January 31, 2017 19:12
-
-
Save artyomtrityak/72e5ab659b0bc50225e094534d2be3c7 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> | |
<html> | |
<head> | |
<title>Report for test run</title> | |
<style> | |
body, html { | |
padding: 0; | |
margin: 0; | |
} | |
.table-fill { | |
padding: 0 7%; | |
margin: 20px; | |
background: white; | |
border-radius: 3px; | |
border-collapse: collapse; | |
width: 86%; | |
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1); | |
} | |
tr { | |
border-top: 1px solid #C1C3D1; | |
border-bottom-: 1px solid #C1C3D1; | |
color: #666B85; | |
font-size: 16px; | |
font-weight: normal; | |
text-shadow: 0 1px 1px rgba(256, 256, 256, 0.1); | |
} | |
tr:first-child { | |
border-top: none; | |
} | |
th { | |
color: #D5DDE5; | |
background: #1b1e24; | |
border-bottom: 4px solid #9ea7af; | |
border-right: 1px solid #343a45; | |
font-size: 23px; | |
font-weight: 100; | |
padding: 24px; | |
text-align: left; | |
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); | |
vertical-align: middle; | |
} | |
th.text-left { | |
text-align: left; | |
} | |
.text-center { | |
text-align: center; | |
} | |
tr:nth-child(odd) td { | |
background: #EBEBEB; | |
} | |
td.text-left { | |
text-align: left; | |
} | |
td { | |
background: #FFFFFF; | |
padding: 20px; | |
text-align: left; | |
vertical-align: middle; | |
font-weight: 300; | |
font-size: 18px; | |
text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.1); | |
border-right: 1px solid #C1C3D1; | |
border-left: 1px solid #C1C3D1;; | |
} | |
tr:last-child td { | |
border-bottom: 1px solid #C1C3D1; | |
} | |
</style> | |
</head> | |
<body> | |
<div style="padding: 10px 0 10px 20px; background: black;"> | |
<img src="https://s3.amazonaws.com/ecpublic/dynatrace-logo.svg" width="146" height="26"> | |
</div> | |
<% def round(def number) { | |
if (!number) { | |
return '--' | |
} | |
def retval = Math.round(number * 100) / 100 | |
retval | |
} | |
def category(def category) { | |
String retval | |
Map dict = [ | |
uidriven: 'UI driven', | |
webapi: 'Web API', | |
unit: 'Unit', | |
performance: 'Performance' | |
] | |
retval = dict[category.getInternal()] + ' tests' | |
retval | |
} | |
%> | |
<div> | |
<div style="margin-left: 10px"> | |
<h1>${category(testRun.category)}</h1> | |
<br /> | |
<strong>Test run ID:</strong> ${testRun.id} | |
<br /> | |
<strong>System profile:</strong> ${testRun.systemProfile} | |
<% if (ec.pipelineName) { %> | |
<br /> | |
<strong>Pipeline:</strong> ${ec.pipelineName} | |
<% } %> | |
<% if(ec.appName) { %> | |
<br /> | |
<strong>Application name:</strong> ${ec.appName} | |
<% } %> | |
<br /> | |
<strong>Start timestamp:</strong> ${new Date(testRun.startTime).toString()} | |
<br /> | |
<strong>Application version:</strong> ${testRun.versionMajor}.${testRun.versionMinor}.${testRun.versionRevision}.${testRun.versionBuild} | |
</div> | |
<div> | |
<table class="table-fill"> | |
<thead> | |
<tr> | |
<th class="text-center">Test Status</th> | |
<th class="text-center" colspan="2">Number of tests</th> | |
<tr> | |
<th></th> | |
<th class="text-center">Current test run</th> | |
<th class="text-center">Previous test run</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr> | |
<td class="text-left">Passed</td> | |
<td class="text-center">${testRun.passedCount}</td> | |
<td class="text-center">${prevTestRun ? prevTestRun.passedCount : '--'}</td> | |
</tr> | |
<tr> | |
<td class="text-left">Failed</td> | |
<td class="text-center">${testRun.failedCount}</td> | |
<td class="text-center">${prevTestRun ? prevTestRun.failedCount : '--'}</td> | |
</tr> | |
<tr> | |
<td class="text-left">Degraded</td> | |
<td class="text-center">${testRun.degradedCount}</td> | |
<td class="text-center">${prevTestRun ? prevTestRun.degradedCount : '--'}</td> | |
</tr> | |
<tr> | |
<td class="text-left">Improved</td> | |
<td class="text-center">${testRun.improvedCount}</td> | |
<td class="text-center">${prevTestRun ? prevTestRun.improvedCount : '--'}</td> | |
</tr> | |
<tr> | |
<td class="text-left">Invalidated</td> | |
<td class="text-center">${testRun.invalidatedCount}</td> | |
<td class="text-center">${prevTestRun ? prevTestRun.invalidatedCount : '--'}</td> | |
</tr> | |
<tr> | |
<td class="text-left">Volatile</td> | |
<td class="text-center">${testRun.volatileCount}</td> | |
<td class="text-center">${prevTestRun ? prevTestRun.volatileCount : '--'}</td> | |
</tr> | |
</tbody> | |
</table> | |
</div> | |
</div> | |
<% | |
List statuses = [ | |
'FAILED', | |
'DEGRADED', | |
'VOLATILE', | |
'INVALIDATED', | |
'PASSED', | |
'IMPROVED' | |
] | |
def statusDict(String constant) { | |
Map dict = [ | |
FAILED: 'Failed', | |
DEGRADED: 'Degraded', | |
VOLATILE: 'Volatile', | |
INVALIDATED: 'Invalidated', | |
PASSED: 'Passed', | |
IMPROVED: 'Improved' | |
] | |
String retval = dict[constant] | |
retval | |
} | |
for( def status : statuses ) { | |
def results = tests[status] | |
if (!results) | |
continue | |
%> | |
<% def count = results.size() %> | |
<div style="margin-left: 10px"> | |
<h2>${count} ${statusDict(status)} Tests</h2> | |
<% results.each { row -> | |
result = row.currentResult | |
prevResult = row.prevResult | |
measures = row.measures | |
String testName = result.packageName ? result.packageName + '.' + result.name : result.name | |
%> | |
<div style="margin-left: 10px"> | |
<h3>${testName}</h3> | |
Timestamp: ${new Date(result.executionTime).toString()} | |
<br /> | |
Platform: ${result.platform} | |
<br /> | |
Status: ${statusDict(result.status.toString())} | |
<% if (prevResult) { %> | |
<br /> | |
Previous status: ${statusDict(prevResult.status.toString())} | |
<% } %> | |
</div> | |
<div> | |
<table class="table-fill"> | |
<thead> | |
<tr> | |
<th></th> | |
<th colspan="4" class="text-center">Current build</th> | |
<th colspan="4" class="text-center">Previous build</th> | |
</tr> | |
<tr> | |
<th class="text-center" rowspan="2">Measure</th> | |
<th class="text-center">Value</th> | |
<th class="text-center">Expected min</th> | |
<th class="text-center">Expected max</th> | |
<th class="text-center">Violation, %</th> | |
<th class="text-center">Value</th> | |
<th class="text-center">Expected min</th> | |
<th class="text-center">Expected max</th> | |
<th class="text-center">Violation, %</th> | |
</tr> | |
</thead> | |
<tbody> | |
<% measures.each { measure -> | |
current = measure.current | |
prev = measure.prev | |
String measureName = current.metricGroup + " - " + current.name | |
%> | |
<tr> | |
<td class="text-left">${measureName}</td> | |
<td class="text-center">${round(current.value)} (${current.unit})</td> | |
<td class="text-center">${round(current.expectedMin)} (${current.unit})</td> | |
<td class="text-center">${round(current.expectedMax)} (${current.unit})</td> | |
<td class="text-center">${round(current.violationPercentage)}</td> | |
<td class="text-center"><% if (prev) { %>${round(prev.value)} (${prev.unit})<% } %></td> | |
<td class="text-center"><% if (prev) { %>${round(prev.expectedMin)} (${prev.unit})<% } %></td> | |
<td class="text-center"><% if (prev) { %>${round(prev.expectedMax)} (${prev.unit})<% } %></td> | |
<td class="text-center"><% if (prev) { %>${round(prev.violationPercentage)}<% } %></td> | |
</tr> | |
<% } %> | |
</tbody> | |
</table> | |
</div> | |
</div> | |
<% } %> | |
<% } %> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment