1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (C) 2008 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    <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
20
21    <xsl:template match="/">
22
23        <html>
24            <head>
25                <title>Test Report for <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@build_model" /> - <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@deviceID"/></title>
26                <script>
27                    function toggle(id) {
28                        e = document.getElementById(id)
29                        e.style.display = e.style.display == "none" ? "block" : "none"
30                    }
31                </script>
32                <STYLE type="text/css">
33                    @import "cts_result.css";
34                </STYLE>
35            </head>
36            <body>
37                <DIV>
38                    <TABLE class="title">
39                        <TR>
40                            <TD width="40%" align="left"><img src="logo.gif"></img></TD>
41                            <TD width="60%" align="left">
42                                <h1>Test Report for <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@build_model"/> -
43                                    <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@deviceID"/>
44                                </h1>
45                            </TD>
46                        </TR>
47                    </TABLE>
48                </DIV>
49                <img src="newrule-green.png" align="left"></img>
50
51                <br></br>
52
53                <center>
54                    <a href="#" onclick="toggle('summary');">Show Device Information</a>
55                </center>
56
57                <br></br>
58
59                <DIV id="summary" style="display: none">
60                    <TABLE class="summary">
61                        <TR>
62                            <TH colspan="2">Device Information</TH>
63                        </TR>
64                        <TR>
65                            <TD width="50%">
66                                <!-- Device information -->
67                                <TABLE>
68                                    <TR>
69                                        <TD class="rowtitle">Build Model</TD>
70                                        <TD>
71                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@build_model"/>
72                                        </TD>
73                                    </TR>
74                                    <TR>
75                                        <TD class="rowtitle">Build Product</TD>
76                                        <TD>
77                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@buildName"/>
78                                        </TD>
79                                    </TR>
80                                    <TR>
81                                        <TD class="rowtitle">Build Brand</TD>
82                                        <TD>
83                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@build_brand"/>
84                                        </TD>
85                                    </TR>
86                                    <TR>
87                                        <TD class="rowtitle">Build Manufacturer</TD>
88                                        <TD>
89                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@build_manufacturer"/>
90                                        </TD>
91                                    </TR>
92                                    <TR>
93                                        <TD class="rowtitle">Device ID</TD>
94                                        <TD>
95                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@deviceID"/>
96                                        </TD>
97                                    </TR>
98                                    <TR>
99                                        <TD class="rowtitle">Android Version</TD>
100                                        <TD>
101                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@buildVersion"/>
102                                        </TD>
103                                    </TR>
104                                    <TR>
105                                        <TD class="rowtitle">Build ID</TD>
106                                        <TD>
107                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@buildID"/>
108                                        </TD>
109                                    </TR>
110                                    <TR>
111                                        <TD class="rowtitle">Build Fingerprint</TD>
112                                        <TD>
113                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@build_fingerprint"/>
114                                        </TD>
115                                    </TR>
116                                    <TR>
117                                        <TD class="rowtitle">Build ABI</TD>
118                                        <TD>
119                                            <xsl:value-of
120                                              select="TestResult/DeviceInfo/BuildInfo/@build_abi"/>
121                                        </TD>
122                                    </TR>
123                                    <TR>
124                                        <TD class="rowtitle">Build ABI2</TD>
125                                        <TD>
126                                            <xsl:value-of
127                                              select="TestResult/DeviceInfo/BuildInfo/@build_abi2"/>
128                                        </TD>
129                                    </TR>
130                                    <TR>
131                                        <TD class="rowtitle">Android API Level</TD>
132                                        <TD>
133                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@androidPlatformVersion"/>
134                                        </TD>
135                                    </TR>
136                                    <TR>
137                                        <TD class="rowtitle">Supported Locales</TD>
138                                        <TD>
139                                            <xsl:call-template name="formatDelimitedString">
140                                                <xsl:with-param name="string" select="TestResult/DeviceInfo/BuildInfo/@locales"/>
141                                            </xsl:call-template>
142                                        </TD>
143                                    </TR>
144                                    <TR>
145                                        <TD class="rowtitle">Screen Size</TD>
146                                        <TD>
147                                            <xsl:value-of select="TestResult/DeviceInfo/Screen/@screen_size"/>
148                                        </TD>
149                                    </TR>
150                                    <TR>
151                                        <TD class="rowtitle">Resolution</TD>
152                                        <TD>
153                                            <xsl:value-of select="TestResult/DeviceInfo/Screen/@resolution"/>
154                                        </TD>
155                                    </TR>
156                                    <TR>
157                                        <TD class="rowtitle">Density</TD>
158                                        <TD>
159                                            <xsl:value-of select="TestResult/DeviceInfo/Screen/@screen_density"/>
160                                            (<xsl:value-of select="TestResult/DeviceInfo/Screen/@screen_density_bucket"/>)
161                                        </TD>
162                                    </TR>
163                                    <TR>
164                                        <TD class="rowtitle">Phone number</TD>
165                                        <TD>
166                                            <xsl:value-of select="TestResult/DeviceInfo/PhoneSubInfo/@subscriberId"/>
167                                        </TD>
168                                    </TR>
169                                    <TR>
170                                        <TD class="rowtitle">X dpi</TD>
171                                        <TD>
172                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@Xdpi"/>
173                                        </TD>
174                                    </TR>
175                                    <TR>
176                                        <TD class="rowtitle">Y dpi</TD>
177                                        <TD>
178                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@Ydpi"/>
179                                        </TD>
180                                    </TR>
181                                    <TR>
182                                        <TD class="rowtitle">Touch</TD>
183                                        <TD>
184                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@touch"/>
185                                        </TD>
186                                    </TR>
187                                    <TR>
188                                        <TD class="rowtitle">Navigation</TD>
189                                        <TD>
190                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@navigation"/>
191                                        </TD>
192                                    </TR>
193                                    <TR>
194                                        <TD class="rowtitle">Keypad</TD>
195                                        <TD>
196                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@keypad"/>
197                                        </TD>
198                                    </TR>
199                                    <TR>
200                                        <TD class="rowtitle">Network</TD>
201                                        <TD>
202                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@network"/>
203                                        </TD>
204                                    </TR>
205                                    <TR>
206                                        <TD class="rowtitle">IMEI</TD>
207                                        <TD>
208                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@imei"/>
209                                        </TD>
210                                    </TR>
211                                    <TR>
212                                        <TD class="rowtitle">IMSI</TD>
213                                        <TD>
214                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@imsi"/>
215                                        </TD>
216                                    </TR>
217                                    <TR>
218                                        <TD class="rowtitle">Open GL ES Version</TD>
219                                        <TD>
220                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@openGlEsVersion"/>
221                                        </TD>
222                                    </TR>
223                                    <TR>
224                                        <TD class="rowtitle">Open GL Compressed Texture Formats</TD>
225                                        <TD>
226                                            <UL>
227                                                <xsl:for-each select="TestResult/DeviceInfo/OpenGLCompressedTextureFormatsInfo/TextureFormat">
228                                                    <LI><xsl:value-of select="@name" /></LI>
229                                                </xsl:for-each>
230                                            </UL>
231                                        </TD>
232                                    </TR>
233                                    <TR>
234                                        <TD class="rowtitle">Root Processes</TD>
235                                        <TD>
236                                            <UL>
237                                                <xsl:for-each select="TestResult/DeviceInfo/ProcessInfo/Process[@uid='0']">
238                                                    <LI><xsl:value-of select="@name" /></LI>
239                                                </xsl:for-each>
240                                            </UL>
241                                        </TD>
242                                    </TR>
243
244                                </TABLE>
245                            </TD>
246
247                            <TD width="50%">
248                                <TABLE>
249
250                                    <TR>
251                                        <TD class="rowtitle">Features</TD>
252                                        <TD>
253                                            <xsl:for-each select="TestResult/DeviceInfo/FeatureInfo/Feature[@type='sdk']">
254                                                <xsl:text>[</xsl:text>
255                                                <xsl:choose>
256                                                    <xsl:when test="@available = 'true'">
257                                                        <xsl:text>X</xsl:text>
258                                                    </xsl:when>
259                                                    <xsl:otherwise>
260                                                        <xsl:text>_</xsl:text>
261                                                    </xsl:otherwise>
262                                                </xsl:choose>
263                                                <xsl:text>] </xsl:text>
264
265                                                <xsl:value-of select="@name" />
266                                                <br />
267                                            </xsl:for-each>
268                                        </TD>
269                                    </TR>
270                                    <TR>
271                                        <TD class="rowtitle">Other Features</TD>
272                                        <TD>
273                                            <UL>
274                                                <xsl:for-each select="TestResult/DeviceInfo/FeatureInfo/Feature[@type='other']">
275                                                    <LI><xsl:value-of select="@name" /></LI>
276                                                </xsl:for-each>
277                                            </UL>
278                                        </TD>
279                                    </TR>
280                                    <TR>
281                                        <TD class="rowtitle">System Libraries</TD>
282                                        <TD>
283                                            <UL>
284                                                <xsl:for-each select="TestResult/DeviceInfo/SystemLibrariesInfo/Library">
285                                                    <LI><xsl:value-of select="@name" /></LI>
286                                                </xsl:for-each>
287                                            </UL>
288                                        </TD>
289                                    </TR>
290                                    <TR>
291                                        <TD class="rowtitle">Partitions</TD>
292                                        <TD>
293                                            <pre>
294                                                <xsl:call-template name="formatDelimitedString">
295                                                    <xsl:with-param name="string" select="TestResult/DeviceInfo/BuildInfo/@partitions" />
296                                                    <xsl:with-param name="numTokensPerRow" select="1" />
297                                                </xsl:call-template>
298                                            </pre>
299                                        </TD>
300                                    </TR>
301                                    <TR>
302                                        <TD class="rowtitle">Storage devices</TD>
303                                        <TD>
304                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@storage_devices"/>
305                                        </TD>
306                                    </TR>
307                                    <TR>
308                                        <TD class="rowtitle">Multi-user support</TD>
309                                        <TD>
310                                            <xsl:value-of select="TestResult/DeviceInfo/BuildInfo/@multi_user"/>
311                                        </TD>
312                                    </TR>
313                                </TABLE>
314                            </TD>
315                        </TR>
316                    </TABLE>
317                    <br />
318                    <br />
319                </DIV>
320
321                <DIV>
322                    <TABLE class="summary">
323                        <TR>
324                            <TH colspan="2">Test Summary</TH>
325                        </TR>
326                        <TR>
327                            <TD class="rowtitle">CTS version</TD>
328                            <TD>
329                                <xsl:value-of select="TestResult/HostInfo/Cts/@version"/>
330                            </TD>
331                        </TR>
332                        <TR>
333                            <TD class="rowtitle">Test timeout</TD>
334                            <TD>
335                                <xsl:value-of select="TestResult/HostInfo/Cts/IntValue[@name='testStatusTimeoutMs']/@value" /> ms
336                            </TD>
337                        </TR>
338                        <TR>
339                            <TD class="rowtitle">Host Info</TD>
340                            <TD>
341                                <xsl:value-of select="TestResult/HostInfo/@name"/>
342                                (<xsl:value-of select="TestResult/HostInfo/Os/@name"/> - <xsl:value-of select="TestResult/HostInfo/Os/@version"/>)
343                            </TD>
344                        </TR>
345                        <TR>
346                            <TD class="rowtitle">Plan name</TD>
347                            <TD>
348                                <xsl:value-of select="TestResult/@testPlan"/>
349                            </TD>
350                        </TR>
351                        <TR>
352                            <TD class="rowtitle">Start time</TD>
353                            <TD>
354                                <xsl:value-of select="TestResult/@starttime"/>
355                            </TD>
356                        </TR>
357                        <TR>
358                            <TD class="rowtitle">End time</TD>
359                            <TD>
360                                <xsl:value-of select="TestResult/@endtime"/>
361                            </TD>
362                        </TR>
363                        <TR>
364                            <TD class="rowtitle">Tests Passed</TD>
365                            <TD>
366                                <xsl:value-of select="TestResult/Summary/@pass"/>
367                            </TD>
368                        </TR>
369                        <TR>
370                            <TD class="rowtitle">Tests Failed</TD>
371                            <TD>
372                                <xsl:value-of select="TestResult/Summary/@failed"/>
373                            </TD>
374                        </TR>
375                        <TR>
376                            <TD class="rowtitle">Tests Timed out</TD>
377                            <TD>
378                                <xsl:value-of select="TestResult/Summary/@timeout"/>
379                            </TD>
380                        </TR>
381                        <TR>
382                            <TD class="rowtitle">Tests Not Executed</TD>
383                            <TD>
384                                <xsl:value-of select="TestResult/Summary/@notExecuted"/>
385                            </TD>
386                        </TR>
387                    </TABLE>
388                </DIV>
389
390                <!-- High level summary of test execution -->
391                <h2 align="center">Test Summary by Package</h2>
392                <DIV>
393                    <TABLE class="testsummary">
394                        <TR>
395                            <TH>Test Package</TH>
396                            <TH>Passed</TH>
397                            <TH>Failed</TH>
398                            <TH>Timed Out</TH>
399                            <TH>Not Executed</TH>
400                            <TH>Total Tests</TH>
401                        </TR>
402                        <xsl:for-each select="TestResult/TestPackage">
403                            <TR>
404                                <TD>
405                                    <xsl:variable name="href"><xsl:value-of select="@appPackageName"/></xsl:variable>
406                                    <a href="#{$href}"><xsl:value-of select="@appPackageName"/></a>
407                                </TD>
408                                <TD>
409                                    <xsl:value-of select="count(TestSuite//Test[@result = 'pass'])"/>
410                                </TD>
411                                <TD>
412                                    <xsl:value-of select="count(TestSuite//Test[@result = 'fail'])"/>
413                                </TD>
414                                <TD>
415                                    <xsl:value-of select="count(TestSuite//Test[@result = 'timeout'])"/>
416                                </TD>
417                                <TD>
418                                    <xsl:value-of select="count(TestSuite//Test[@result = 'notExecuted'])"/>
419                                </TD>
420                                <TD>
421                                    <xsl:value-of select="count(TestSuite//Test)"/>
422                                </TD>
423                            </TR>
424                        </xsl:for-each> <!-- end package -->
425                    </TABLE>
426                </DIV>
427
428                <xsl:call-template name="filteredResultTestReport">
429                    <xsl:with-param name="header" select="'Test Failures'" />
430                    <xsl:with-param name="resultFilter" select="'fail'" />
431                </xsl:call-template>
432
433                <xsl:call-template name="filteredResultTestReport">
434                    <xsl:with-param name="header" select="'Test Timeouts'" />
435                    <xsl:with-param name="resultFilter" select="'timeout'" />
436                </xsl:call-template>
437
438                <h2 align="center">Detailed Test Report</h2>
439                <xsl:call-template name="detailedTestReport" />
440
441            </body>
442        </html>
443    </xsl:template>
444
445    <xsl:template name="filteredResultTestReport">
446        <xsl:param name="header" />
447        <xsl:param name="resultFilter" />
448        <xsl:variable name="numMatching" select="count(TestResult/TestPackage/TestSuite//TestCase/Test[@result=$resultFilter])" />
449        <xsl:if test="$numMatching &gt; 0">
450            <h2 align="center"><xsl:value-of select="$header" /> (<xsl:value-of select="$numMatching"/>)</h2>
451            <xsl:call-template name="detailedTestReport">
452                <xsl:with-param name="resultFilter" select="$resultFilter"/>
453            </xsl:call-template>
454        </xsl:if>
455    </xsl:template>
456
457    <xsl:template name="detailedTestReport">
458        <xsl:param name="resultFilter" />
459        <DIV>
460            <xsl:for-each select="TestResult/TestPackage">
461                <xsl:if test="$resultFilter=''
462                        or count(TestSuite//TestCase/Test[@result=$resultFilter]) &gt; 0">
463
464                    <TABLE class="testdetails">
465                        <TR>
466                            <TD class="package" colspan="3">
467                                <xsl:variable name="href"><xsl:value-of select="@appPackageName"/></xsl:variable>
468                                <a name="{$href}">Compatibility Test Package: <xsl:value-of select="@appPackageName"/>
469                                <xsl:if test="@abi">
470                                  ABI: <xsl:value-of select="@abi"/>
471                                </xsl:if>
472                                </a>
473                            </TD>
474                        </TR>
475
476                        <TR>
477                            <TH width="30%">Test</TH>
478                            <TH width="5%">Result</TH>
479                            <TH>Details</TH>
480                        </TR>
481
482                        <!-- test case -->
483                        <xsl:for-each select="TestSuite//TestCase">
484
485                            <xsl:if test="$resultFilter='' or count(Test[@result=$resultFilter]) &gt; 0">
486                                <!-- emit a blank row before every test suite name -->
487                                <xsl:if test="position()!=1">
488                                    <TR><TD class="testcasespacer" colspan="3"></TD></TR>
489                                </xsl:if>
490
491                                <TR>
492                                    <TD class="testcase" colspan="3">
493                                        <xsl:for-each select="ancestor::TestSuite">
494                                            <xsl:if test="position()!=1">.</xsl:if>
495                                            <xsl:value-of select="@name"/>
496                                        </xsl:for-each>
497                                        <xsl:text>.</xsl:text>
498                                        <xsl:value-of select="@name"/>
499                                    </TD>
500                                </TR>
501                            </xsl:if>
502
503                            <!-- test -->
504                            <xsl:for-each select="Test">
505                                <xsl:if test="$resultFilter='' or $resultFilter=@result">
506                                    <TR>
507                                        <TD class="testname"> -- <xsl:value-of select="@name"/></TD>
508
509                                        <!-- test results -->
510                                        <xsl:choose>
511                                            <xsl:when test="string(@KnownFailure)">
512                                                <!-- "pass" indicates the that test actually passed (results have been inverted already) -->
513                                                <xsl:if test="@result='pass'">
514                                                    <TD class="pass">
515                                                        <div style="text-align: center; margin-left:auto; margin-right:auto;">
516                                                            Known problem
517                                                        </div>
518                                                    </TD>
519                                                    <TD class="failuredetails"></TD>
520                                                </xsl:if>
521
522                                                <!-- "fail" indicates that a known failure actually passed (results have been inverted already) -->
523                                                <xsl:if test="@result='fail'">
524                                                    <TD class="failed">
525                                                        <div style="text-align: center; margin-left:auto; margin-right:auto;">
526                                                            <xsl:value-of select="@result"/>
527                                                        </div>
528                                                    </TD>
529                                                   <TD class="failuredetails">
530                                                        <div class="details">
531                                                            A test that was a known failure actually passed. Please check.
532                                                        </div>
533                                                   </TD>
534                                                </xsl:if>
535                                            </xsl:when>
536
537                                            <xsl:otherwise>
538                                                <xsl:if test="@result='pass'">
539                                                    <TD class="pass">
540                                                        <div style="text-align: center; margin-left:auto; margin-right:auto;">
541                                                            <xsl:value-of select="@result"/>
542                                                        </div>
543                                                    </TD>
544                                                    <TD class="failuredetails"/>
545                                                </xsl:if>
546
547                                                <xsl:if test="@result='fail'">
548                                                    <TD class="failed">
549                                                        <div style="text-align: center; margin-left:auto; margin-right:auto;">
550                                                            <xsl:value-of select="@result"/>
551                                                        </div>
552                                                    </TD>
553                                                    <TD class="failuredetails">
554                                                        <div class="details">
555                                                            <xsl:value-of select="FailedScene/@message"/>
556                                                        </div>
557                                                    </TD>
558                                                </xsl:if>
559
560                                                <xsl:if test="@result='timeout'">
561                                                    <TD class="timeout">
562                                                        <div style="text-align: center; margin-left:auto; margin-right:auto;">
563                                                            <xsl:value-of select="@result"/>
564                                                        </div>
565                                                    <TD class="failuredetails"></TD>
566                                                    </TD>
567                                                </xsl:if>
568
569                                                <xsl:if test="@result='notExecuted'">
570                                                    <TD class="notExecuted">
571                                                        <div style="text-align: center; margin-left:auto; margin-right:auto;">
572                                                            <xsl:value-of select="@result"/>
573                                                        </div>
574                                                    </TD>
575                                                    <TD class="failuredetails"></TD>
576                                                </xsl:if>
577                                            </xsl:otherwise>
578                                        </xsl:choose>
579                                    </TR> <!-- finished with a row -->
580                                </xsl:if>
581                            </xsl:for-each> <!-- end test -->
582                        </xsl:for-each> <!-- end test case -->
583                    </TABLE>
584                </xsl:if>
585            </xsl:for-each> <!-- end test package -->
586        </DIV>
587    </xsl:template>
588
589    <!-- Take a delimited string and insert line breaks after a some number of elements. -->
590    <xsl:template name="formatDelimitedString">
591        <xsl:param name="string" />
592        <xsl:param name="numTokensPerRow" select="10" />
593        <xsl:param name="tokenIndex" select="1" />
594        <xsl:if test="$string">
595            <!-- Requires the last element to also have a delimiter after it. -->
596            <xsl:variable name="token" select="substring-before($string, ';')" />
597            <xsl:value-of select="$token" />
598            <xsl:text>&#160;</xsl:text>
599
600            <xsl:if test="$tokenIndex mod $numTokensPerRow = 0">
601                <br />
602            </xsl:if>
603
604            <xsl:call-template name="formatDelimitedString">
605                <xsl:with-param name="string" select="substring-after($string, ';')" />
606                <xsl:with-param name="numTokensPerRow" select="$numTokensPerRow" />
607                <xsl:with-param name="tokenIndex" select="$tokenIndex + 1" />
608            </xsl:call-template>
609        </xsl:if>
610    </xsl:template>
611
612</xsl:stylesheet>
613