test/test-automation/skeleton.xsl
author Markus Kauppila
Wed, 06 Jul 2011 23:49:36 +0300
changeset 5748 91a7152856f3
parent 5744 a5b70cefd30e
permissions -rw-r--r--
Made the default XSL style less blocky.
markus@5744
     1
<?xml version="1.0" encoding="ISO-8859-1"?>
markus@5744
     2
<xsl:stylesheet version="1.0" 
markus@5744
     3
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
markus@5744
     4
markus@5744
     5
<xsl:template match="/">
markus@5744
     6
	
markus@5744
     7
<html>
markus@5744
     8
<head>
markus@5744
     9
<title>Test report</title>
markus@5744
    10
markus@5744
    11
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"/>
markus@5744
    12
markus@5744
    13
<script type="text/javascript">
markus@5744
    14
markus@5744
    15
var hideTests = '[Hide tests]';
markus@5744
    16
var showTests = '[Show tests]';
markus@5744
    17
markus@5744
    18
var hideAsserts = '[Hide Assert Summary]';
markus@5744
    19
var showAsserts = '[Show Assert Summary]';
markus@5744
    20
markus@5744
    21
var hideAllTests = '[Hide All Tests]';
markus@5744
    22
var showAllTests = '[Show All Tests]';
markus@5744
    23
markus@5744
    24
var hideEverything = '[Hide Everything]';
markus@5744
    25
var showEverything = '[Show Everything]';
markus@5744
    26
markus@5744
    27
var animationSpeed = 'fast';
markus@5744
    28
markus@5744
    29
$(document).ready(function() {
markus@5744
    30
	$("span.show-tests").click(function() {
markus@5744
    31
		var content = $(this).html();
markus@5744
    32
		var id = $(this).attr('uid');
markus@5744
    33
		var searchString = "div.tests[uid="+id+"]";
markus@5744
    34
	
markus@5744
    35
		if(content == hideTests) {
markus@5744
    36
			$(searchString).hide(animationSpeed);
markus@5744
    37
			$(this).text(showTests);
markus@5744
    38
		} else {
markus@5744
    39
			$(searchString).show(animationSpeed);
markus@5744
    40
			$(this).text(hideTests);
markus@5744
    41
		}
markus@5744
    42
	});
markus@5744
    43
markus@5744
    44
	$("span.show-asserts").click(function() {
markus@5744
    45
		var content = $(this).html();
markus@5744
    46
		var id = $(this).attr('uid');
markus@5744
    47
		var searchString = "div.asserts[uid="+id+"]";
markus@5744
    48
		
markus@5744
    49
		if(content == hideAsserts) {
markus@5744
    50
			$(searchString).hide(animationSpeed);
markus@5744
    51
			$(this).text(showAsserts);
markus@5744
    52
		} else {
markus@5744
    53
			$(searchString).show(animationSpeed);
markus@5744
    54
			$(this).text(hideAsserts);
markus@5744
    55
		}
markus@5744
    56
	});
markus@5744
    57
	
markus@5744
    58
	$("span.show-all-tests").click(function() {
markus@5744
    59
		var content = $(this).html();
markus@5744
    60
		var searchString = "div.tests";
markus@5744
    61
		
markus@5744
    62
		if(content == hideAllTests) {
markus@5744
    63
			$(searchString).hide(animationSpeed);
markus@5744
    64
			$(this).text(showAllTests);
markus@5744
    65
			
markus@5744
    66
			/* handle the individual '[show tests]' switcher */
markus@5744
    67
			$("span.show-tests[uid]").text(showTests);
markus@5744
    68
		} else {
markus@5744
    69
			$(searchString).show(animationSpeed);
markus@5744
    70
			$(this).text(hideAllTests);
markus@5744
    71
			
markus@5744
    72
			/* handle the individual '[show tests]' switcher */
markus@5744
    73
			$("span.show-tests[uid]").text(hideTests);
markus@5744
    74
		}
markus@5744
    75
	});
markus@5744
    76
	
markus@5744
    77
	$("span.show-everything").click(function() {
markus@5744
    78
		var content = $(this).html();
markus@5744
    79
		var searchString = "div.tests";
markus@5744
    80
		
markus@5744
    81
		if(content == hideEverything) {
markus@5744
    82
			$("div.tests").hide(animationSpeed);
markus@5744
    83
			$("div.asserts").hide(animationSpeed);
markus@5744
    84
			$(this).text(showEverything);
markus@5744
    85
			
markus@5744
    86
			/* handle the individual switchers */
markus@5744
    87
			$("span.show-tests[uid]").text(showTests);
markus@5744
    88
			$("span.show-asserts[uid]").text(showAsserts);
markus@5744
    89
		} else {
markus@5744
    90
			$("div.tests").show(animationSpeed);
markus@5744
    91
			$("div.asserts").show(animationSpeed);
markus@5744
    92
			$(this).text(hideEverything);
markus@5744
    93
			
markus@5744
    94
			/* handle the individual switchers */
markus@5744
    95
			$("span.show-tests[uid]").text(hideTests);
markus@5744
    96
			$("span.show-asserts[uid]").text(hideAsserts);
markus@5744
    97
		}
markus@5744
    98
	});
markus@5744
    99
markus@5744
   100
	/* Initially everything is hidden */
markus@5744
   101
	$("div.tests").hide();
markus@5744
   102
	$("div.asserts").hide();
markus@5744
   103
	
markus@5744
   104
	/* Color the tests based on the result */
markus@5744
   105
	$("div.test[result='passed']").addClass('passed');
markus@5744
   106
	$("div.test[result='failed']").addClass('failed');
markus@5744
   107
	
markus@5744
   108
	/* Color the asserts based on the result */
markus@5744
   109
	$("div.assert[result='pass']").addClass('passed');
markus@5744
   110
	$("div.assert[result='failure']").addClass('failed');
markus@5744
   111
});
markus@5744
   112
markus@5744
   113
</script>
markus@5744
   114
<style>
markus@5744
   115
markus@5744
   116
div, h1 {
markus@5744
   117
  padding: 3px 10px 2px 10px;
markus@5744
   118
  margin: 5px 0px 5px 0px;
markus@5744
   119
}
markus@5744
   120
markus@5744
   121
.document {
markus@5744
   122
  font-family: Arial;
markus@5744
   123
  font-size: 11pt;
markus@5744
   124
  background-color: #EDEDED;
markus@5744
   125
}
markus@5744
   126
	
markus@5744
   127
.title {
markus@5748
   128
  font-weight: bold; 
markus@5744
   129
}	
markus@5744
   130
</style>
markus@5744
   131
	
markus@5744
   132
</head>
markus@5744
   133
<body class="document">
markus@5744
   134
  <h1>Test Report</h1>
markus@5744
   135
  <div>
markus@5744
   136
    <span class="title">Start time: </span><xsl:value-of select="testlog/startTime"/><br/>
markus@5744
   137
    <!-- and ended at <xsl:value-of select="testlog/endTime"/>.<br/>-->
markus@5744
   138
    <span class="title">Total runtime: </span><xsl:value-of select="testlog/totalRuntime"/> seconds.<br/>
markus@5744
   139
    <span class="title">Harness parameters: </span>
markus@5744
   140
	<span xml:space="preserve">
markus@5744
   141
      <xsl:for-each select="testlog/parameters/parameter">
markus@5744
   142
        <xsl:value-of select="."/> 	 
markus@5744
   143
      </xsl:for-each>
markus@5744
   144
    </span>
markus@5744
   145
	<br/>
markus@5744
   146
    <span class="title">Statistics:</span><br/>
markus@5744
   147
    <div>
markus@5744
   148
      <span>Executed </span> <xsl:value-of select="testlog/numSuites"/> test suites. <br/>
markus@5744
   149
      <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@5744
   150
    </div>
markus@5744
   151
  </div>
markus@5744
   152
markus@5744
   153
</body>
markus@5744
   154
</html>
markus@5744
   155
markus@5744
   156
</xsl:template>
markus@5744
   157
</xsl:stylesheet>
markus@5744
   158