SDL-mirror/test/test-automation/style.xsl

235 lines
6.6 KiB
XML
Raw Normal View History

2011-06-29 17:40:32 +03:00
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Test report</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"/>
<script type="text/javascript">
2011-06-30 16:08:37 +03:00
var hideTests = '[Hide tests]';
var showTests = '[Show tests]';
var hideAsserts = '[Hide Assert Summary]';
var showAsserts = '[Show Assert Summary]';
var hideAllTests = '[Hide All Tests]';
var showAllTests = '[Show All Tests]';
var hideEverything = '[Hide Everything]';
var showEverything = '[Show Everything]';
var animationSpeed = 'fast';
$(document).ready(function() {
$("span.show-tests").click(function() {
var content = $(this).html();
var id = $(this).attr('uid');
var searchString = "div.tests[uid="+id+"]";
2011-06-30 16:08:37 +03:00
if(content == hideTests) {
$(searchString).hide(animationSpeed);
$(this).text(showTests);
} else {
2011-06-30 16:08:37 +03:00
$(searchString).show(animationSpeed);
$(this).text(hideTests);
}
});
$("span.show-asserts").click(function() {
var content = $(this).html();
var id = $(this).attr('uid');
var searchString = "div.asserts[uid="+id+"]";
2011-06-30 16:08:37 +03:00
if(content == hideAsserts) {
$(searchString).hide(animationSpeed);
$(this).text(showAsserts);
} else {
2011-06-30 16:08:37 +03:00
$(searchString).show(animationSpeed);
$(this).text(hideAsserts);
}
});
$("span.show-all-tests").click(function() {
var content = $(this).html();
var searchString = "div.tests";
2011-06-30 16:08:37 +03:00
if(content == hideAllTests) {
$(searchString).hide(animationSpeed);
$(this).text(showAllTests);
/* handle the individual '[show tests]' switcher */
2011-06-30 16:08:37 +03:00
$("span.show-tests[uid]").text(showTests);
} else {
2011-06-30 16:08:37 +03:00
$(searchString).show(animationSpeed);
$(this).text(hideAllTests);
/* handle the individual '[show tests]' switcher */
2011-06-30 16:08:37 +03:00
$("span.show-tests[uid]").text(hideTests);
}
});
$("span.show-everything").click(function() {
var content = $(this).html();
var searchString = "div.tests";
2011-06-30 16:08:37 +03:00
if(content == hideEverything) {
$("div.tests").hide(animationSpeed);
$("div.asserts").hide(animationSpeed);
$(this).text(showEverything);
/* handle the individual switchers */
2011-06-30 16:08:37 +03:00
$("span.show-tests[uid]").text(showTests);
$("span.show-asserts[uid]").text(showAsserts);
} else {
2011-06-30 16:08:37 +03:00
$("div.tests").show(animationSpeed);
$("div.asserts").show(animationSpeed);
$(this).text(hideEverything);
/* handle the individual switchers */
2011-06-30 16:08:37 +03:00
$("span.show-tests[uid]").text(hideTests);
$("span.show-asserts[uid]").text(hideAsserts);
}
});
/* Initially everything is hidden */
$("div.tests").hide();
$("div.asserts").hide();
2011-06-29 22:23:06 +03:00
2011-06-30 16:08:37 +03:00
/* Color the tests based on the result */
$("div.test[result='passed']").addClass('passed');
$("div.test[result='failed']").addClass('failed');
/* Color the asserts based on the result */
$("div.assert[result='pass']").addClass('passed');
$("div.assert[result='failure']").addClass('failed');
});
</script>
2011-06-29 17:40:32 +03:00
<style>
div, h1 {
2011-06-29 17:40:32 +03:00
padding: 3px 10px 2px 10px;
2011-06-29 22:23:06 +03:00
margin: 5px 0px 5px 0px;
}
2011-06-29 17:40:32 +03:00
.document {
font-family: Arial;
font-size: 11pt;
background-color: #EDEDED;
2011-06-29 17:40:32 +03:00
}
.description {
font-style: italic;
}
2011-06-29 22:23:06 +03:00
.bigtitle {
font-size: 14pt;
font-weight: bold;
}
2011-06-29 17:40:32 +03:00
.title {
font-weight: bold;
}
.switch {
font-style: italic;
2011-06-29 22:23:06 +03:00
color: rgb(10, 10, 200); /*#024A68;*/
font-size: 10pt;
cursor: pointer;
}
2011-06-30 16:08:37 +03:00
.passed {
2011-06-29 22:23:06 +03:00
background-color: #64AA2B;
}
2011-06-30 16:08:37 +03:00
.failed {
2011-06-29 22:23:06 +03:00
background-color: #FF6E40;
2011-06-29 17:40:32 +03:00
}
2011-06-30 16:08:37 +03:00
2011-06-29 17:40:32 +03:00
</style>
</head>
<body class="document">
<h1>Test Report</h1>
<div>
<span class="title">Start time: </span><xsl:value-of select="testlog/startTime"/><br/>
<!-- and ended at <xsl:value-of select="testlog/endTime"/>.<br/>-->
<span class="title">Total runtime: </span><xsl:value-of select="testlog/totalRuntime"/> seconds.<br/>
<span class="title">Harness parameters: </span>
<xsl:for-each select="testlog/parameters/parameter">
<xsl:value-of select="."/>
</xsl:for-each>
<br/>
<span class="title">Statistics:</span><br/>
<div class="statistics">
2011-06-29 22:23:06 +03:00
<span>Executed </span> <xsl:value-of select="testlog/numSuites"/> test suites. <br/>
2011-06-30 16:08:37 +03:00
<span>Tests in total: </span> <xsl:value-of select="testlog/numTests"/> (passed: <xsl:value-of select="testlog/numPassedTests"/>, failed: <xsl:value-of select="testlog/numFailedTests"/>)
2011-06-29 17:40:32 +03:00
</div>
</div>
<div>
2011-06-29 22:23:06 +03:00
<br/>
<span class="bigtitle">Test Results</span><br/>
<span class="switch show-all-tests">[Show All Tests] </span> |
<span class="switch show-everything">[Show Everything]</span>
</div>
2011-06-29 22:23:06 +03:00
<br/>
2011-06-29 17:40:32 +03:00
<xsl:for-each select="testlog/suite">
<div id="suite">
2011-06-29 22:23:06 +03:00
Suite: <span class="title"> <xsl:value-of select="name"/></span> (<xsl:value-of select="startTime"/>)
<div class="suiteInfo">
2011-06-29 17:40:32 +03:00
Tests: passed <xsl:value-of select="testsPassed"/>, failed <xsl:value-of select="testsFailed"/>, skipped <xsl:value-of select="testsSkipped"/>.<br/>
Total runtime: <xsl:value-of select="totalRuntime"/> seconds. <br/>
<span class="show-tests switch" uid="{generate-id(test)}">[Show tests]</span>
2011-06-29 22:23:06 +03:00
<div class="tests" uid="{generate-id(test)}">
<xsl:for-each select="test">
<div class="test">
<xsl:attribute name="result">
<xsl:value-of select="result"/>
</xsl:attribute>
2011-06-29 17:40:32 +03:00
Name: <xsl:value-of select="name"/> (<xsl:value-of select="startTime"/> - <xsl:value-of select="endTime"/> ) <br/>
Description: <span class="description"> <xsl:value-of select="description"/> </span><br/>
Total runtime: <xsl:value-of select="totalRuntime"/> seconds <br/>
2011-06-29 17:40:32 +03:00
Result: <xsl:value-of select="result"/> <br/>
<span class="switch show-asserts" uid="{generate-id(assertSummary)}">[Show Assert Summary]</span><br/>
<div class="asserts" uid="{generate-id(assertSummary)}">
2011-06-30 16:08:37 +03:00
<xsl:for-each select="assert">
<div class="assert">
<xsl:attribute name="result">
<xsl:value-of select="result"/>
</xsl:attribute>
Assert name: <xsl:value-of select="name"/> <br/>
Result: <xsl:value-of select="result"/> <br/>
Message <xsl:value-of select="message"/> <br/>
Time <xsl:value-of select="time"/> <br/>
</div>
</xsl:for-each>
AssertSummary:
Assert count: <xsl:value-of select="assertSummary/assertCount"/> <br/>
Asserts Passed <xsl:value-of select="assertSummary/assertsPassed"/> <br/>
Asserts Failed <xsl:value-of select="assertSummary/assertsFailed"/> <br/>
2011-06-29 17:40:32 +03:00
</div>
</div>
2011-06-29 22:23:06 +03:00
</xsl:for-each>
</div>
2011-06-29 17:40:32 +03:00
</div>
</div>
</xsl:for-each>
<br/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>