gen-tests-report.xsl revision 7e53a70ee255f062e8456215ea13967621d9c60a
<?
xml version="1.0" encoding="ISO-8859-1"?>
<
xsl:
stylesheet version="1.0" ! The contents of this file are subject to the terms of the ! Common Development and Distribution License, Version 1.0 only ! (the "License"). You may not use this file except in compliance ! You can obtain a copy of the license at ! See the License for the specific language governing permissions ! and limitations under the License. ! When distributing Covered Code, include this CDDL HEADER in each ! file and include the License file at ! add the following below this CDDL HEADER, with the fields enclosed ! by brackets "[]" replaced with your own identifying information: ! Portions Copyright [yyyy] [name of copyright owner] ! Copyright 2008-2009 Sun Microsystems, Inc. <
xsl:
output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/>
<
xsl:
param name="group">''</
xsl:
param>
<
xsl:
param name="suite">''</
xsl:
param>
<
xsl:
variable name="groupdir" select="translate($group, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
<
xsl:
apply-
templates select="qa"/>
<
xsl:
template match="qa">
<
xsl:
apply-
templates select="stress-tests"/>
<
xsl:
apply-
templates select="functional-tests"/>
<
xsl:
template match="stress-tests">
<
xsl:
call-
template name="main">
<
xsl:
with-
param name="tests-type" select="normalize-space('Stress Tests')"/>
<
xsl:
template match="functional-tests">
<
xsl:
call-
template name="main">
<
xsl:
with-
param name="tests-type" select="normalize-space('Functional Tests')"/>
<
xsl:
template name="main">
<
xsl:
param name="tests-type"/>
<!--- Test Report Header Variables --> <
xsl:
variable name="id" select="identification"/>
<
xsl:
variable name="sut" select="$id/sut"/>
<
xsl:
variable name="mailto" select="normalize-space($id/mailto)"/>
<
xsl:
variable name="tests-dir" select="normalize-space($id/tests-dir)"/>
<
xsl:
variable name="url" select="normalize-space($id/tests-url)"/>
<
xsl:
variable name="coverage-url" select="normalize-space($id/coverage-url)"/>
<
xsl:
variable name="productname" select="normalize-space($sut/name)"/>
<
xsl:
variable name="hostname" select="normalize-space($sut/hostname)"/>
<
xsl:
variable name="version" select="normalize-space($sut/version)"/>
<
xsl:
variable name="buildid" select="normalize-space($sut/buildid)"/>
<
xsl:
variable name="revision" select="normalize-space($sut/revision)"/>
<
xsl:
variable name="os" select="normalize-space($sut/os-label)"/>
<
xsl:
variable name="jvm" select="normalize-space($sut/jvm-label)"/>
<
xsl:
variable name="testgroup" select="results/testgroup[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz') = $groupdir]"/>
<
xsl:
variable name="count-tests" select="count($testcase)"/>
<
xsl:
variable name="total-tests" select="count($testcase[@suite=$suite])"/>
<
xsl:
variable name="pass-tests" select="count($testcase[@result='pass' and @suite=$suite])"/>
<
xsl:
variable name="fail-tests" select="count($testcase[@result='fail' and @suite=$suite])"/>
<
xsl:
variable name="inconc-tests" select="count($testcase[@result='unknown' and @suite=$suite])"/>
<
xsl:
variable name="kfail-tests" select="count($testcase[@suite=$suite]/issues)"/>
<
xsl:
element name="html">
<
xsl:
element name="head">
<
xsl:
element name="link">
<
xsl:
attribute name="rel">
<
xsl:
value-
of select="'stylesheet'"/>
<
xsl:
attribute name="type">
<
xsl:
value-
of select="'text/css'"/>
<
xsl:
attribute name="href">
<
xsl:
attribute name="media">
<
xsl:
value-
of select="'print'"/>
<
xsl:
element name="title">
<
xsl:
value-
of select="concat('Test Cases Report for ',$productname,' ',$version)"/>
<
table class="tertmasttable" width="100%" cellspacing="0">
<
td align="center"><
div class="collectionheader"><
xsl:
value-
of select="$tests-type"/></
div></
td>
<
table class="tertmasttable" width="100%" cellspacing="0">
<
td><
div class="collectionheader"><
xsl:
value-
of select="concat('Test Cases Report for ',$productname,' ',$version)"/></
div></
td>
<!-- Overall Test Percentage --> <
xsl:
variable name="percent-tests">
<
xsl:
when test="$total-tests > 0">
<
xsl:
value-
of select="round((($pass-tests div $total-tests) * 100) - 0.5)"/>
<
xsl:
value-
of select="0"/>
<
xsl:
attribute name="noshade">
<
xsl:
value-
of select="'noshade'"/>
<
xsl:
attribute name="size">
<
xsl:
value-
of select="1"/>
<!-- Percentage Result --> <
xsl:
element name="table">
<
xsl:
attribute name="width">
<
xsl:
value-
of select="'100%'"/>
<
xsl:
call-
template name="setColour">
<
xsl:
with-
param name="percent" select="$percent-tests"/>
<
xsl:
with-
param name="red" select="'70'"/>
<
xsl:
with-
param name="yellow" select="'95'"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
element name="font">
<
xsl:
attribute name="size">
<
xsl:
value-
of select="'+2'"/>
<
xsl:
value-
of select="concat($percent-tests,'%')"/>
<
xsl:
attribute name="noshade">
<
xsl:
value-
of select="'noshade'"/>
<
xsl:
attribute name="size">
<
xsl:
value-
of select="1"/>
<
xsl:
element name="table">
<
xsl:
attribute name="width">
<
xsl:
value-
of select="'100%'"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="'Build'"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="'Revision'"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="'Host'"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="'Platform'"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="'JVM'"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="'Total'"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="'Pass'"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="'Fail'"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="'Inconc'"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="'Kfail'"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$buildid"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$revision"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$hostname"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$os"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$jvm"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$total-tests"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$pass-tests"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$fail-tests"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$inconc-tests"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$kfail-tests"/>
<
xsl:
attribute name="noshade">
<
xsl:
value-
of select="'noshade'"/>
<
xsl:
attribute name="size">
<
xsl:
value-
of select="1"/>
<
xsl:
element name="body">
<!-- Test Results Table --> <
xsl:
element name="table">
<
xsl:
attribute name="width">
<
xsl:
value-
of select="'100%'"/>
<
xsl:
attribute name="border">
<
xsl:
value-
of select="1"/>
<
xsl:
attribute name="cellpadding">
<
xsl:
value-
of select="2"/>
<
xsl:
attribute name="bgcolor">
<
xsl:
value-
of select="'lightblue'"/>
<
xsl:
value-
of select="'Test Case'"/>
<
xsl:
value-
of select="'Start Time'"/>
<
xsl:
value-
of select="'End Time'"/>
<
xsl:
value-
of select="'Duration'"/>
<
xsl:
value-
of select="'Result'"/>
<
xsl:
value-
of select="'Issues'"/>
<
xsl:
for-
each select="$testcase[@suite = $suite]">
<
xsl:
variable name="suitename" select="translate(@suite, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
<
xsl:
variable name="tcname" select="normalize-space(@shortname)"/>
<
xsl:
attribute name="bgcolor">
<
xsl:
when test="@result = 'pass'">
<
xsl:
value-
of select="'lightgreen'" />
<
xsl:
value-
of select="'yellow'" />
<
xsl:
value-
of select="'red'" />
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'left'"/>
<
xsl:
attribute name="href">
<
xsl:
value-
of select="concat($url,$tests-dir,'/testlogs/',$groupdir,'/',$suitename,'-log.html#',@shortname)"/>
<
xsl:
value-
of select="@shortname"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="@start"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="@stop"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="concat(@duration,'s')"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="@result"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="' '"/>
<
xsl:
attribute name="href">
<
xsl:
value-
of select="@id"/>
<
xsl:
attribute name="noshade">
<
xsl:
value-
of select="'noshade'"/>
<
xsl:
attribute name="size">
<
xsl:
value-
of select="1"/>
<!-- Additional Information --> <
xsl:
value-
of select="'Additional Information'"/>
<
xsl:
element name="table">
<
xsl:
value-
of select="'Test Archive: '"/>
<
xsl:
attribute name="href">
<
xsl:
value-
of select="concat($url,$tests-dir)"/>
<
xsl:
value-
of select="concat($url,$tests-dir)"/>
<
xsl:
value-
of select="'Product Identification: '"/>
<
xsl:
attribute name="href">
<
xsl:
value-
of select="'Coverage: '"/>
<
xsl:
attribute name="href">
<
xsl:
value-
of select="$coverage-url"/>
<
xsl:
value-
of select="$coverage-url"/>
<
xsl:
value-
of select="'Mail Sent to: '"/>
<
xsl:
attribute name="href">
<
xsl:
value-
of select="concat('mailto:',normalize-space($mailto))"/>
<
xsl:
value-
of select="normalize-space($mailto)"/>
<
xsl:
attribute name="noshade">
<
xsl:
value-
of select="'noshade'"/>
<
xsl:
attribute name="size">
<
xsl:
value-
of select="1"/>
<
xsl:
template name="setColour">
<
xsl:
param name="percent"/>
<
xsl:
param name="yellow"/>
<
xsl:
attribute name="bgcolor">
<
xsl:
when test="$percent < $red">
<
xsl:
value-
of select="'red'" />
<
xsl:
when test="$percent < $yellow">
<
xsl:
value-
of select="'yellow'" />
<
xsl:
value-
of select="'lightgreen'" />