1 <?xml version="1.0" encoding="utf-8"?> 2 <!-- Copyright (C) 2015 The Android Open Source Project 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 --> 16 17 <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]> 18 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 19 20 <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> 21 22 <xsl:template match="/"> 23 24 <html> 25 <head> 26 <title>Test Report</title> 27 <style type="text/css"> 28 @import "compatibility_result.css"; 29 </style> 30 </head> 31 <body> 32 <div> 33 <table class="title"> 34 <tr> 35 <td align="left"><img src="logo.png"/></td> 36 </tr> 37 </table> 38 </div> 39 40 <div> 41 <table class="summary"> 42 <tr> 43 <th colspan="2">Summary</th> 44 </tr> 45 <tr> 46 <td class="rowtitle">Suite / Plan</td> 47 <td> 48 <xsl:value-of select="Result/@suite_name"/> / <xsl:value-of select="Result/@suite_plan"/> 49 </td> 50 </tr> 51 <tr> 52 <td class="rowtitle">Suite / Build</td> 53 <td> 54 <xsl:value-of select="Result/@suite_version"/> / <xsl:value-of select="Result/@suite_build_number"/> 55 </td> 56 </tr> 57 <tr> 58 <td class="rowtitle">Host Info</td> 59 <td> 60 Result/@start 61 <xsl:value-of select="Result/@host_name"/> 62 (<xsl:value-of select="Result/@os_name"/> - <xsl:value-of select="Result/@os_version"/>) 63 </td> 64 </tr> 65 <tr> 66 <td class="rowtitle">Start time / End Time</td> 67 <td> 68 <xsl:value-of select="Result/@start_display"/> / 69 <xsl:value-of select="Result/@end_display"/> 70 </td> 71 </tr> 72 <tr> 73 <td class="rowtitle">Tests Passed</td> 74 <td> 75 <xsl:value-of select="Result/Summary/@pass"/> 76 </td> 77 </tr> 78 <tr> 79 <td class="rowtitle">Tests Failed</td> 80 <td> 81 <xsl:value-of select="Result/Summary/@failed"/> 82 </td> 83 </tr> 84 <tr> 85 <td class="rowtitle">Modules Done</td> 86 <td> 87 <xsl:value-of select="Result/Summary/@modules_done"/> 88 </td> 89 </tr> 90 <tr> 91 <td class="rowtitle">Modules Total</td> 92 <td> 93 <xsl:value-of select="Result/Summary/@modules_total"/> 94 </td> 95 </tr> 96 <tr> 97 <td class="rowtitle">Fingerprint</td> 98 <td> 99 <xsl:value-of select="Result/Build/@build_fingerprint"/> 100 </td> 101 </tr> 102 <tr> 103 <td class="rowtitle">Security Patch</td> 104 <td> 105 <xsl:value-of select="Result/Build/@build_version_security_patch"/> 106 </td> 107 </tr> 108 <tr> 109 <td class="rowtitle">Release (SDK)</td> 110 <td> 111 <xsl:value-of select="Result/Build/@build_version_release"/> (<xsl:value-of select="Result/Build/@build_version_sdk"/>) 112 </td> 113 </tr> 114 <tr> 115 <td class="rowtitle">ABIs</td> 116 <td> 117 <xsl:value-of select="Result/Build/@build_abis"/> 118 </td> 119 </tr> 120 </table> 121 </div> 122 123 <!-- High level summary of test execution --> 124 <br/> 125 <div> 126 <table class="testsummary"> 127 <tr> 128 <th>Module</th> 129 <th>Passed</th> 130 <th>Failed</th> 131 <th>Total Tests</th> 132 <th>Done</th> 133 </tr> 134 <xsl:for-each select="Result/Module"> 135 <tr> 136 <td> 137 <xsl:variable name="href"><xsl:value-of select="@abi"/> <xsl:value-of select="@name"/></xsl:variable> 138 <a href="#{$href}"><xsl:value-of select="@abi"/> <xsl:value-of select="@name"/></a> 139 </td> 140 <td> 141 <xsl:value-of select="count(TestCase/Test[@result = 'pass'])"/> 142 </td> 143 <td> 144 <xsl:value-of select="count(TestCase/Test[@result = 'fail'])"/> 145 </td> 146 <td> 147 <xsl:value-of select="count(TestCase/Test)"/> 148 </td> 149 <td> 150 <xsl:value-of select="@done"/> 151 </td> 152 </tr> 153 </xsl:for-each> <!-- end Module --> 154 </table> 155 </div> 156 157 <xsl:call-template name="filteredResultTestReport"> 158 <xsl:with-param name="header" select="'Failed Tests'" /> 159 <xsl:with-param name="resultFilter" select="'fail'" /> 160 </xsl:call-template> 161 162 <xsl:call-template name="filteredResultTestReport"> 163 <xsl:with-param name="header" select="'Not Executed Tests'" /> 164 <xsl:with-param name="resultFilter" select="'not_executed'" /> 165 </xsl:call-template> 166 167 <br/> 168 <xsl:call-template name="detailedTestReport" /> 169 170 </body> 171 </html> 172 </xsl:template> 173 174 <xsl:template name="filteredResultTestReport"> 175 <xsl:param name="header" /> 176 <xsl:param name="resultFilter" /> 177 <xsl:variable name="numMatching" select="count(Result/Module/TestCase/Test[@result=$resultFilter])" /> 178 <xsl:if test="$numMatching > 0"> 179 <h2 align="center"><xsl:value-of select="$header" /> (<xsl:value-of select="$numMatching"/>)</h2> 180 <xsl:call-template name="detailedTestReport"> 181 <xsl:with-param name="resultFilter" select="$resultFilter"/> 182 <xsl:with-param name="fullStackTrace" select="true()"/> 183 </xsl:call-template> 184 </xsl:if> 185 </xsl:template> 186 187 <xsl:template name="detailedTestReport"> 188 <xsl:param name="resultFilter" /> 189 <xsl:param name="fullStackTrace" /> 190 <div> 191 <xsl:for-each select="Result/Module"> 192 <xsl:if test="$resultFilter='' 193 or count(TestCase/Test[@result=$resultFilter]) > 0"> 194 195 <table class="testdetails"> 196 <tr> 197 <td class="module" colspan="3"> 198 <xsl:variable name="href"><xsl:value-of select="@abi"/> <xsl:value-of select="@name"/></xsl:variable> 199 <a name="{$href}"><xsl:value-of select="@abi"/> <xsl:value-of select="@name"/></a> 200 </td> 201 </tr> 202 203 <tr> 204 <th width="30%">Test</th> 205 <th width="5%">Result</th> 206 <th>Details</th> 207 </tr> 208 209 <xsl:for-each select="TestCase"> 210 <xsl:variable name="TestCase" select="."/> 211 <!-- test --> 212 <xsl:for-each select="Test"> 213 <xsl:if test="$resultFilter='' or @result=$resultFilter"> 214 <tr> 215 <td class="testname"> <xsl:value-of select="$TestCase/@name"/>#<xsl:value-of select="@name"/></td> 216 217 <!-- test results --> 218 <xsl:if test="@result='pass'"> 219 <td class="pass"> 220 <div style="text-align: center; margin-left:auto; margin-right:auto;"> 221 <xsl:value-of select="@result"/> 222 </div> 223 </td> 224 <td class="failuredetails"/> 225 </xsl:if> 226 227 <xsl:if test="@result='fail'"> 228 <td class="failed"> 229 <div style="text-align: center; margin-left:auto; margin-right:auto;"> 230 <xsl:value-of select="@result"/> 231 </div> 232 </td> 233 <td class="failuredetails"> 234 <div class="details"> 235 <xsl:choose> 236 <xsl:when test="$fullStackTrace=true()"> 237 <xsl:value-of select="Failure/StackTrace" /> 238 </xsl:when> 239 <xsl:otherwise> 240 <xsl:value-of select="Failure/@message"/> 241 </xsl:otherwise> 242 </xsl:choose> 243 </div> 244 </td> 245 </xsl:if> 246 247 <xsl:if test="@result='not_executed'"> 248 <td class="not_executed"> 249 <div style="text-align: center; margin-left:auto; margin-right:auto;"> 250 <xsl:value-of select="@result"/> 251 </div> 252 </td> 253 <td class="failuredetails"></td> 254 </xsl:if> 255 </tr> <!-- finished with a row --> 256 </xsl:if> 257 </xsl:for-each> <!-- end test --> 258 </xsl:for-each> 259 </table> 260 </xsl:if> 261 </xsl:for-each> <!-- end test Module --> 262 </div> 263 </xsl:template> 264 265 <!-- Take a delimited string and insert line breaks after a some number of elements. --> 266 <xsl:template name="formatDelimitedString"> 267 <xsl:param name="string" /> 268 <xsl:param name="numTokensPerRow" select="10" /> 269 <xsl:param name="tokenIndex" select="1" /> 270 <xsl:if test="$string"> 271 <!-- Requires the last element to also have a delimiter after it. --> 272 <xsl:variable name="token" select="substring-before($string, ';')" /> 273 <xsl:value-of select="$token" /> 274 <xsl:text> </xsl:text> 275 276 <xsl:if test="$tokenIndex mod $numTokensPerRow = 0"> 277 <br /> 278 </xsl:if> 279 280 <xsl:call-template name="formatDelimitedString"> 281 <xsl:with-param name="string" select="substring-after($string, ';')" /> 282 <xsl:with-param name="numTokensPerRow" select="$numTokensPerRow" /> 283 <xsl:with-param name="tokenIndex" select="$tokenIndex + 1" /> 284 </xsl:call-template> 285 </xsl:if> 286 </xsl:template> 287 288 </xsl:stylesheet> 289