test/test-automation/style.xsl
author Markus Kauppila
Wed, 06 Jul 2011 23:49:36 +0300
changeset 5748 91a7152856f3
parent 5739 be70f1dfd7aa
child 5755 35d4ae5dea90
permissions -rw-r--r--
Made the default XSL style less blocky.
markus@5723
     1
<?xml version="1.0" encoding="ISO-8859-1"?>
markus@5723
     2
<xsl:stylesheet version="1.0" 
markus@5723
     3
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
markus@5723
     4
markus@5723
     5
<xsl:template match="/">
markus@5723
     6
	
markus@5723
     7
<html>
markus@5723
     8
<head>
markus@5723
     9
<title>Test report</title>
markus@5725
    10
markus@5725
    11
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"/>
markus@5725
    12
markus@5725
    13
<script type="text/javascript">
markus@5725
    14
markus@5727
    15
var hideTests = '[Hide tests]';
markus@5727
    16
var showTests = '[Show tests]';
markus@5727
    17
markus@5727
    18
var hideAsserts = '[Hide Assert Summary]';
markus@5727
    19
var showAsserts = '[Show Assert Summary]';
markus@5727
    20
markus@5727
    21
var hideAllTests = '[Hide All Tests]';
markus@5727
    22
var showAllTests = '[Show All Tests]';
markus@5727
    23
markus@5727
    24
var hideEverything = '[Hide Everything]';
markus@5727
    25
var showEverything = '[Show Everything]';
markus@5727
    26
markus@5727
    27
var animationSpeed = 'fast';
markus@5727
    28
markus@5725
    29
$(document).ready(function() {
markus@5725
    30
	$("span.show-tests").click(function() {
markus@5725
    31
		var content = $(this).html();
markus@5725
    32
		var id = $(this).attr('uid');
markus@5725
    33
		var searchString = "div.tests[uid="+id+"]";
markus@5725
    34
	
markus@5727
    35
		if(content == hideTests) {
markus@5727
    36
			$(searchString).hide(animationSpeed);
markus@5727
    37
			$(this).text(showTests);
markus@5725
    38
		} else {
markus@5727
    39
			$(searchString).show(animationSpeed);
markus@5727
    40
			$(this).text(hideTests);
markus@5725
    41
		}
markus@5725
    42
	});
markus@5725
    43
markus@5725
    44
	$("span.show-asserts").click(function() {
markus@5725
    45
		var content = $(this).html();
markus@5725
    46
		var id = $(this).attr('uid');
markus@5725
    47
		var searchString = "div.asserts[uid="+id+"]";
markus@5725
    48
		
markus@5727
    49
		if(content == hideAsserts) {
markus@5727
    50
			$(searchString).hide(animationSpeed);
markus@5727
    51
			$(this).text(showAsserts);
markus@5725
    52
		} else {
markus@5727
    53
			$(searchString).show(animationSpeed);
markus@5727
    54
			$(this).text(hideAsserts);
markus@5725
    55
		}
markus@5725
    56
	});
markus@5725
    57
	
markus@5725
    58
	$("span.show-all-tests").click(function() {
markus@5725
    59
		var content = $(this).html();
markus@5725
    60
		var searchString = "div.tests";
markus@5725
    61
		
markus@5727
    62
		if(content == hideAllTests) {
markus@5727
    63
			$(searchString).hide(animationSpeed);
markus@5727
    64
			$(this).text(showAllTests);
markus@5725
    65
			
markus@5725
    66
			/* handle the individual '[show tests]' switcher */
markus@5727
    67
			$("span.show-tests[uid]").text(showTests);
markus@5725
    68
		} else {
markus@5727
    69
			$(searchString).show(animationSpeed);
markus@5727
    70
			$(this).text(hideAllTests);
markus@5725
    71
			
markus@5725
    72
			/* handle the individual '[show tests]' switcher */
markus@5727
    73
			$("span.show-tests[uid]").text(hideTests);
markus@5725
    74
		}
markus@5725
    75
	});
markus@5725
    76
	
markus@5725
    77
	$("span.show-everything").click(function() {
markus@5725
    78
		var content = $(this).html();
markus@5725
    79
		var searchString = "div.tests";
markus@5725
    80
		
markus@5727
    81
		if(content == hideEverything) {
markus@5727
    82
			$("div.tests").hide(animationSpeed);
markus@5727
    83
			$("div.asserts").hide(animationSpeed);
markus@5727
    84
			$(this).text(showEverything);
markus@5725
    85
			
markus@5725
    86
			/* handle the individual switchers */
markus@5727
    87
			$("span.show-tests[uid]").text(showTests);
markus@5727
    88
			$("span.show-asserts[uid]").text(showAsserts);
markus@5725
    89
		} else {
markus@5727
    90
			$("div.tests").show(animationSpeed);
markus@5727
    91
			$("div.asserts").show(animationSpeed);
markus@5727
    92
			$(this).text(hideEverything);
markus@5725
    93
			
markus@5725
    94
			/* handle the individual switchers */
markus@5727
    95
			$("span.show-tests[uid]").text(hideTests);
markus@5727
    96
			$("span.show-asserts[uid]").text(hideAsserts);
markus@5725
    97
		}
markus@5725
    98
	});
markus@5725
    99
markus@5725
   100
	/* Initially everything is hidden */
markus@5725
   101
	$("div.tests").hide();
markus@5725
   102
	$("div.asserts").hide();
markus@5726
   103
	
markus@5727
   104
	/* Color the tests based on the result */
markus@5748
   105
	$("span.testResult[result='passed']").addClass('passed');
markus@5748
   106
	$("span.testResult[result='failed']").addClass('failed');
markus@5727
   107
	
markus@5727
   108
	/* Color the asserts based on the result */
markus@5748
   109
	$("span.assertResult[result='pass']").addClass('passed');
markus@5748
   110
	$("span.assertResult[result='failure']").addClass('failed');
markus@5725
   111
});
markus@5725
   112
markus@5725
   113
</script>
markus@5723
   114
<style>
markus@5723
   115
markus@5725
   116
div, h1 {
markus@5748
   117
  padding: 2px 10px 2px 10px;
markus@5726
   118
  margin: 5px 0px 5px 0px;
markus@5725
   119
}
markus@5725
   120
markus@5748
   121
.assert {
markus@5748
   122
  padding: 0px 10px 0px 10px;
markus@5748
   123
  margin: 0px 0px 0px 0px;
markus@5748
   124
}
markus@5748
   125
markus@5723
   126
.document {
markus@5723
   127
  font-family: Arial;
markus@5723
   128
  font-size: 11pt;
markus@5725
   129
  background-color: #EDEDED;
markus@5723
   130
}
markus@5723
   131
	
markus@5723
   132
.description {
markus@5723
   133
  font-style: italic;
markus@5723
   134
}	
markus@5723
   135
	
markus@5726
   136
.bigtitle {
markus@5726
   137
  font-size: 14pt;
markus@5726
   138
  font-weight: bold;
markus@5726
   139
}
markus@5726
   140
	
markus@5723
   141
.title {
markus@5723
   142
  font-weight: bold;
markus@5723
   143
}
markus@5723
   144
	
markus@5725
   145
.switch {
markus@5725
   146
  font-style: italic;
markus@5748
   147
  color: rgb(10, 10, 200); 
markus@5725
   148
  font-size: 10pt;
markus@5725
   149
  cursor: pointer;
markus@5725
   150
}	
markus@5725
   151
	
markus@5727
   152
.passed {
markus@5748
   153
 color: green;
markus@5725
   154
}
markus@5725
   155
markus@5727
   156
.failed {
markus@5748
   157
 color: red;
markus@5723
   158
}
markus@5727
   159
markus@5723
   160
</style>
markus@5723
   161
markus@5723
   162
</head>
markus@5723
   163
<body class="document">
markus@5723
   164
  <h1>Test Report</h1>
markus@5723
   165
  <div>
markus@5723
   166
    <span class="title">Start time: </span><xsl:value-of select="testlog/startTime"/><br/>
markus@5723
   167
    <!-- and ended at <xsl:value-of select="testlog/endTime"/>.<br/>-->
markus@5723
   168
    <span class="title">Total runtime: </span><xsl:value-of select="testlog/totalRuntime"/> seconds.<br/>
markus@5723
   169
    <span class="title">Harness parameters: </span>
markus@5739
   170
	<span xml:space="preserve">
markus@5739
   171
      <xsl:for-each select="testlog/parameters/parameter">
markus@5739
   172
        <xsl:value-of select="."/> 	 
markus@5739
   173
      </xsl:for-each>
markus@5739
   174
    </span>
markus@5723
   175
	<br/>
markus@5723
   176
    <span class="title">Statistics:</span><br/>
markus@5723
   177
    <div class="statistics">
markus@5726
   178
      <span>Executed </span> <xsl:value-of select="testlog/numSuites"/> test suites. <br/>
markus@5727
   179
      <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"/>)
markus@5723
   180
    </div>
markus@5723
   181
  </div>
markus@5723
   182
markus@5725
   183
  <div>
markus@5726
   184
	<br/>
markus@5726
   185
	<span class="bigtitle">Test Results</span><br/>
markus@5726
   186
    <span class="switch show-all-tests">[Show All Tests] </span> | 
markus@5725
   187
    <span class="switch show-everything">[Show Everything]</span>
markus@5725
   188
  </div>
markus@5726
   189
	<br/>
markus@5726
   190
	
markus@5723
   191
  <xsl:for-each select="testlog/suite">
markus@5723
   192
    <div id="suite">
markus@5726
   193
    Suite: <span class="title"> <xsl:value-of select="name"/></span> (<xsl:value-of select="startTime"/>)
markus@5725
   194
	<div class="suiteInfo">
markus@5723
   195
		Tests: passed <xsl:value-of select="testsPassed"/>, failed <xsl:value-of select="testsFailed"/>, skipped <xsl:value-of select="testsSkipped"/>.<br/>
markus@5723
   196
		Total runtime: <xsl:value-of select="totalRuntime"/> seconds. <br/>
markus@5725
   197
		<span class="show-tests switch" uid="{generate-id(test)}">[Show tests]</span>
markus@5726
   198
        <div class="tests" uid="{generate-id(test)}">
markus@5726
   199
	      <xsl:for-each select="test">
markus@5726
   200
			<div class="test">
markus@5748
   201
			Test <span class="title"><xsl:value-of select="name"/>: </span>
markus@5748
   202
			<span class="testResult">
markus@5726
   203
			  <xsl:attribute name="result">
markus@5748
   204
			    <xsl:value-of select="result"/> 
markus@5748
   205
	           </xsl:attribute><xsl:value-of select="result"/> 
markus@5748
   206
	        </span> 
markus@5748
   207
			(Total runtime: <xsl:value-of select="totalRuntime"/> seconds)<br/>
markus@5748
   208
			Description: <span class="description"> <xsl:value-of select="description"/> </span><br/>
markus@5725
   209
		      <span class="switch show-asserts" uid="{generate-id(assertSummary)}">[Show Assert Summary]</span><br/>
markus@5725
   210
			  <div class="asserts" uid="{generate-id(assertSummary)}">
markus@5727
   211
		        <xsl:for-each select="assert"> 
markus@5727
   212
			      <div class="assert">
markus@5748
   213
					<xsl:value-of select="name"/>: 
markus@5748
   214
					<span class="assertResult">
markus@5748
   215
						<xsl:attribute name="result">
markus@5748
   216
					      <xsl:value-of select="result"/>
markus@5748
   217
					    </xsl:attribute>
markus@5748
   218
					  <xsl:value-of select="result"/>  
markus@5748
   219
					</span>.
markus@5748
   220
					 Message: <span class="description"><xsl:value-of select="message"/></span>
markus@5727
   221
		          </div>
markus@5727
   222
		        </xsl:for-each>
markus@5748
   223
				Asserts in total: <xsl:value-of select="assertSummary/assertCount"/> (passed: <xsl:value-of select="assertSummary/assertsPassed"/>, failed: <xsl:value-of select="assertSummary/assertsFailed"/>)
markus@5723
   224
		      </div>
markus@5723
   225
    		</div>
markus@5726
   226
		  </xsl:for-each>
markus@5726
   227
	    </div>
markus@5723
   228
	</div>
markus@5723
   229
  </div>
markus@5723
   230
  </xsl:for-each>
markus@5723
   231
  <br/>
markus@5723
   232
</body>
markus@5723
   233
</html>
markus@5723
   234
markus@5723
   235
</xsl:template>
markus@5723
   236
</xsl:stylesheet>
markus@5723
   237