Home | History | Annotate | Download | only in report
      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 "&#160;"> ]>
     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">Tests Not Executed</td>
     86                             <td>
     87                                 <xsl:value-of select="Result/Summary/@not_executed"/>
     88                             </td>
     89                         </tr>
     90                         <tr>
     91                             <td class="rowtitle">Fingerprint</td>
     92                             <td>
     93                                 <xsl:value-of select="Result/Build/@build_fingerprint"/>
     94                             </td>
     95                         </tr>
     96                         <tr>
     97                             <td class="rowtitle">Security Patch</td>
     98                             <td>
     99                                 <xsl:value-of select="Result/Build/@build_version_security_patch"/>
    100                             </td>
    101                         </tr>
    102                         <tr>
    103                             <td class="rowtitle">Release (SDK)</td>
    104                             <td>
    105                                 <xsl:value-of select="Result/Build/@build_version_release"/> (<xsl:value-of select="Result/Build/@build_version_sdk"/>)
    106                             </td>
    107                         </tr>
    108                         <tr>
    109                             <td class="rowtitle">ABIs</td>
    110                             <td>
    111                                 <xsl:value-of select="Result/Build/@build_abis"/>
    112                             </td>
    113                         </tr>
    114                     </table>
    115                 </div>
    116 
    117                 <!-- High level summary of test execution -->
    118                 <br/>
    119                 <div>
    120                     <table class="testsummary">
    121                         <tr>
    122                             <th>Module</th>
    123                             <th>Passed</th>
    124                             <th>Failed</th>
    125                             <th>Not Executed</th>
    126                             <th>Total Tests</th>
    127                         </tr>
    128                         <xsl:for-each select="Result/Module">
    129                             <tr>
    130                                 <td>
    131                                     <xsl:variable name="href"><xsl:value-of select="@name"/> - <xsl:value-of select="@abi"/></xsl:variable>
    132                                     <a href="#{$href}"><xsl:value-of select="@name"/> - <xsl:value-of select="@abi"/></a>
    133                                 </td>
    134                                 <td>
    135                                     <xsl:value-of select="count(TestCase/Test[@result = 'pass'])"/>
    136                                 </td>
    137                                 <td>
    138                                     <xsl:value-of select="count(TestCase/Test[@result = 'fail'])"/>
    139                                 </td>
    140                                 <td>
    141                                     <xsl:value-of select="count(TestCase/Test[@result = 'not_executed'])"/>
    142                                 </td>
    143                                 <td>
    144                                     <xsl:value-of select="count(TestCase/Test)"/>
    145                                 </td>
    146                             </tr>
    147                         </xsl:for-each> <!-- end Module -->
    148                     </table>
    149                 </div>
    150 
    151                 <xsl:call-template name="filteredResultTestReport">
    152                     <xsl:with-param name="header" select="'Failured Tests'" />
    153                     <xsl:with-param name="resultFilter" select="'fail'" />
    154                 </xsl:call-template>
    155 
    156                 <xsl:call-template name="filteredResultTestReport">
    157                     <xsl:with-param name="header" select="'Not Executed Tests'" />
    158                     <xsl:with-param name="resultFilter" select="'not_executed'" />
    159                 </xsl:call-template>
    160 
    161                 <br/>
    162                 <xsl:call-template name="detailedTestReport" />
    163 
    164             </body>
    165         </html>
    166     </xsl:template>
    167 
    168     <xsl:template name="filteredResultTestReport">
    169         <xsl:param name="header" />
    170         <xsl:param name="resultFilter" />
    171         <xsl:variable name="numMatching" select="count(Result/Module/Test[@result=$resultFilter])" />
    172         <xsl:if test="$numMatching &gt; 0">
    173             <h2 align="center"><xsl:value-of select="$header" /> (<xsl:value-of select="$numMatching"/>)</h2>
    174             <xsl:call-template name="detailedTestReport">
    175                 <xsl:with-param name="resultFilter" select="$resultFilter"/>
    176             </xsl:call-template>
    177         </xsl:if>
    178     </xsl:template>
    179 
    180     <xsl:template name="detailedTestReport">
    181         <xsl:param name="resultFilter" />
    182         <div>
    183             <xsl:for-each select="Result/Module">
    184                 <xsl:if test="$resultFilter=''
    185                         or count(Test[@result=$resultFilter]) &gt; 0">
    186 
    187                     <table class="testdetails">
    188                         <tr>
    189                             <td class="module" colspan="3">
    190                                 <xsl:variable name="href"><xsl:value-of select="@name"/> - <xsl:value-of select="@abi"/></xsl:variable>
    191                                 <a name="{$href}"><xsl:value-of select="@name"/> - <xsl:value-of select="@abi"/></a>
    192                             </td>
    193                         </tr>
    194 
    195                         <tr>
    196                             <th width="30%">Test</th>
    197                             <th width="5%">Result</th>
    198                             <th>Details</th>
    199                         </tr>
    200 
    201                         <xsl:for-each select="TestCase">
    202                             <xsl:variable name="TestCase" select="."/>
    203                             <!-- test -->
    204                             <xsl:for-each select="Test">
    205                                 <xsl:if test="$resultFilter='' or $resultFilter=@result">
    206                                     <tr>
    207                                         <td class="testname"> <xsl:value-of select="$TestCase/@name"/>#<xsl:value-of select="@name"/></td>
    208 
    209                                         <!-- test results -->
    210                                         <xsl:if test="@result='pass'">
    211                                             <td class="pass">
    212                                                 <div style="text-align: center; margin-left:auto; margin-right:auto;">
    213                                                     <xsl:value-of select="@result"/>
    214                                                 </div>
    215                                             </td>
    216                                             <td class="failuredetails"/>
    217                                         </xsl:if>
    218 
    219                                         <xsl:if test="@result='fail'">
    220                                             <td class="failed">
    221                                                 <div style="text-align: center; margin-left:auto; margin-right:auto;">
    222                                                     <xsl:value-of select="@result"/>
    223                                                 </div>
    224                                             </td>
    225                                             <td class="failuredetails">
    226                                                 <div class="details">
    227                                                     <xsl:value-of select="Failure/@message"/>
    228                                                 </div>
    229                                             </td>
    230                                         </xsl:if>
    231 
    232                                         <xsl:if test="@result='not_executed'">
    233                                             <td class="not_executed">
    234                                                 <div style="text-align: center; margin-left:auto; margin-right:auto;">
    235                                                     <xsl:value-of select="@result"/>
    236                                                 </div>
    237                                             </td>
    238                                             <td class="failuredetails"></td>
    239                                         </xsl:if>
    240                                     </tr> <!-- finished with a row -->
    241                                 </xsl:if>
    242                             </xsl:for-each> <!-- end test -->
    243                         </xsl:for-each>
    244                     </table>
    245                 </xsl:if>
    246             </xsl:for-each> <!-- end test Module -->
    247         </div>
    248     </xsl:template>
    249 
    250     <!-- Take a delimited string and insert line breaks after a some number of elements. -->
    251     <xsl:template name="formatDelimitedString">
    252         <xsl:param name="string" />
    253         <xsl:param name="numTokensPerRow" select="10" />
    254         <xsl:param name="tokenIndex" select="1" />
    255         <xsl:if test="$string">
    256             <!-- Requires the last element to also have a delimiter after it. -->
    257             <xsl:variable name="token" select="substring-before($string, ';')" />
    258             <xsl:value-of select="$token" />
    259             <xsl:text>&#160;</xsl:text>
    260 
    261             <xsl:if test="$tokenIndex mod $numTokensPerRow = 0">
    262                 <br />
    263             </xsl:if>
    264 
    265             <xsl:call-template name="formatDelimitedString">
    266                 <xsl:with-param name="string" select="substring-after($string, ';')" />
    267                 <xsl:with-param name="numTokensPerRow" select="$numTokensPerRow" />
    268                 <xsl:with-param name="tokenIndex" select="$tokenIndex + 1" />
    269             </xsl:call-template>
    270         </xsl:if>
    271     </xsl:template>
    272 
    273 </xsl:stylesheet>
    274