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