• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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="5.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>Assumption Failure</th>
132                            <th>Ignored</th>
133                            <th>Total Tests</th>
134                            <th>Done</th>
135                            <th>Reason</th>
136                        </tr>
137                        <xsl:for-each select="Result/Module">
138                            <tr>
139                                <td>
140                                    <xsl:variable name="href"><xsl:value-of select="@abi"/>&#xA0;<xsl:value-of select="@name"/></xsl:variable>
141                                    <a href="#{$href}"><xsl:value-of select="@abi"/>&#xA0;<xsl:value-of select="@name"/></a>
142                                </td>
143                                <td>
144                                    <xsl:value-of select="count(TestCase/Test[@result = 'pass'])"/>
145                                </td>
146                                <td>
147                                    <xsl:value-of select="count(TestCase/Test[@result = 'fail'])"/>
148                                </td>
149                                <td>
150                                    <xsl:value-of select="count(TestCase/Test[@result = 'ASSUMPTION_FAILURE'])"/>
151                                </td>
152                                <td>
153                                    <xsl:value-of select="count(TestCase/Test[@result = 'IGNORED'])"/>
154                                </td>
155                                <td>
156                                    <xsl:value-of select="count(TestCase/Test)"/>
157                                </td>
158                                <td>
159                                    <xsl:value-of select="@done"/>
160                                </td>
161                                <td>
162                                    <xsl:value-of select="Reason/@message"/>
163                                </td>
164                            </tr>
165                        </xsl:for-each> <!-- end Module -->
166                    </table>
167                </div>
168
169                <xsl:call-template name="filteredResultTestReport">
170                    <xsl:with-param name="header" select="'Failed Tests'" />
171                    <xsl:with-param name="resultFilter" select="'fail'" />
172                </xsl:call-template>
173
174                <xsl:call-template name="filteredResultTestReport">
175                    <xsl:with-param name="header" select="'Not Executed Tests'" />
176                    <xsl:with-param name="resultFilter" select="'not_executed'" />
177                </xsl:call-template>
178
179                <br/>
180                <xsl:call-template name="detailedTestReport" />
181
182            </body>
183        </html>
184    </xsl:template>
185
186    <xsl:template name="filteredResultTestReport">
187        <xsl:param name="header" />
188        <xsl:param name="resultFilter" />
189        <xsl:variable name="numMatching" select="count(Result/Module/TestCase/Test[@result=$resultFilter])" />
190        <xsl:if test="$numMatching &gt; 0">
191            <h2 align="center"><xsl:value-of select="$header" /> (<xsl:value-of select="$numMatching"/>)</h2>
192            <xsl:call-template name="detailedTestReport">
193                <xsl:with-param name="resultFilter" select="$resultFilter"/>
194                <xsl:with-param name="fullStackTrace" select="true()"/>
195            </xsl:call-template>
196        </xsl:if>
197    </xsl:template>
198
199    <xsl:template name="detailedTestReport">
200        <xsl:param name="resultFilter" />
201        <xsl:param name="fullStackTrace" />
202        <div>
203            <xsl:for-each select="Result/Module">
204                <xsl:if test="$resultFilter=''
205                        or count(TestCase/Test[@result=$resultFilter]) &gt; 0">
206
207                    <table class="testdetails">
208                        <tr>
209                            <td class="module" colspan="3">
210                                <xsl:variable name="href"><xsl:value-of select="@abi"/>&#xA0;<xsl:value-of select="@name"/></xsl:variable>
211                                <a name="{$href}"><xsl:value-of select="@abi"/>&#xA0;<xsl:value-of select="@name"/></a>
212                            </td>
213                        </tr>
214
215                        <tr>
216                            <th width="30%">Test</th>
217                            <th width="5%">Result</th>
218                            <th>Details</th>
219                        </tr>
220
221                        <xsl:for-each select="TestCase">
222                            <xsl:variable name="TestCase" select="."/>
223                            <!-- test -->
224                            <xsl:for-each select="Test">
225                                <xsl:if test="$resultFilter='' or @result=$resultFilter">
226                                    <tr>
227                                        <td class="testname"> <xsl:value-of select="$TestCase/@name"/>#<xsl:value-of select="@name"/></td>
228
229                                        <!-- test results -->
230                                        <xsl:if test="@result='pass'">
231                                            <td class="pass">
232                                                <div style="text-align: center; margin-left:auto; margin-right:auto;">
233                                                    <xsl:value-of select="@result"/>
234                                                </div>
235                                            </td>
236                                            <td class="failuredetails"/>
237                                        </xsl:if>
238
239                                        <xsl:if test="@result='IGNORED'">
240                                            <td class="pass">
241                                                <div style="text-align: center; margin-left:auto; margin-right:auto;">
242                                                    <xsl:value-of select="@result"/>
243                                                </div>
244                                            </td>
245                                            <td class="failuredetails"/>
246                                        </xsl:if>
247
248                                        <xsl:if test="@result='fail'">
249                                            <td class="failed">
250                                                <div style="text-align: center; margin-left:auto; margin-right:auto;">
251                                                    <xsl:value-of select="@result"/>
252                                                </div>
253                                            </td>
254                                            <td class="failuredetails">
255                                                <div class="details">
256                                                    <xsl:choose>
257                                                        <xsl:when test="boolean($fullStackTrace)=true()">
258                                                            <xsl:value-of select="Failure/StackTrace" />
259                                                        </xsl:when>
260                                                        <xsl:otherwise>
261                                                            <xsl:value-of select="Failure/@message"/>
262                                                        </xsl:otherwise>
263                                                    </xsl:choose>
264                                                </div>
265                                            </td>
266                                        </xsl:if>
267
268                                        <xsl:if test="@result='ASSUMPTION_FAILURE'">
269                                            <td class="pass">
270                                                <div style="text-align: center; margin-left:auto; margin-right:auto;">
271                                                    <xsl:value-of select="@result"/>
272                                                </div>
273                                            </td>
274                                            <td class="failuredetails">
275                                                <div class="details">
276                                                    <xsl:choose>
277                                                        <xsl:when test="boolean($fullStackTrace)=true()">
278                                                            <xsl:value-of select="Failure/StackTrace" />
279                                                        </xsl:when>
280                                                        <xsl:otherwise>
281                                                            <xsl:value-of select="Failure/@message"/>
282                                                        </xsl:otherwise>
283                                                    </xsl:choose>
284                                                </div>
285                                            </td>
286                                        </xsl:if>
287
288                                        <xsl:if test="@result='not_executed'">
289                                            <td class="not_executed">
290                                                <div style="text-align: center; margin-left:auto; margin-right:auto;">
291                                                    <xsl:value-of select="@result"/>
292                                                </div>
293                                            </td>
294                                            <td class="failuredetails"></td>
295                                        </xsl:if>
296                                    </tr> <!-- finished with a row -->
297                                </xsl:if>
298                            </xsl:for-each> <!-- end test -->
299                        </xsl:for-each>
300                    </table>
301                </xsl:if>
302            </xsl:for-each> <!-- end test Module -->
303        </div>
304    </xsl:template>
305
306    <!-- Take a delimited string and insert line breaks after a some number of elements. -->
307    <xsl:template name="formatDelimitedString">
308        <xsl:param name="string" />
309        <xsl:param name="numTokensPerRow" select="10" />
310        <xsl:param name="tokenIndex" select="1" />
311        <xsl:if test="$string">
312            <!-- Requires the last element to also have a delimiter after it. -->
313            <xsl:variable name="token" select="substring-before($string, ';')" />
314            <xsl:value-of select="$token" />
315            <xsl:text>&#160;</xsl:text>
316
317            <xsl:if test="$tokenIndex mod $numTokensPerRow = 0">
318                <br />
319            </xsl:if>
320
321            <xsl:call-template name="formatDelimitedString">
322                <xsl:with-param name="string" select="substring-after($string, ';')" />
323                <xsl:with-param name="numTokensPerRow" select="$numTokensPerRow" />
324                <xsl:with-param name="tokenIndex" select="$tokenIndex + 1" />
325            </xsl:call-template>
326        </xsl:if>
327    </xsl:template>
328
329</xsl:stylesheet>
330