gen-suites-report.xsl revision 4458
<?
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:
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 Suites Report Header Variables --> <
xsl:
variable name="ft" select="qa/$tests-type"/>
<
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="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="total-tests" select="count($testcase)"/>
<
xsl:
variable name="pass-tests" select="count($testcase[@result='pass'])"/>
<
xsl:
variable name="fail-tests" select="count($testcase[@result='fail'])"/>
<
xsl:
variable name="inconc-tests" select="count($testcase[@result='unknown'])"/>
<
xsl:
element name="html">
<
xsl:
element name="head">
<
xsl:
element name="title">
<
xsl:
value-
of select="concat('Test Suites Report for OpenDS ',$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 Suites Report for OpenDS ',$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 Suite'"/>
<
xsl:
value-
of select="'Start Time'"/>
<
xsl:
value-
of select="'End Time'"/>
<
xsl:
value-
of select="'Duration'"/>
<
xsl:
value-
of select="'Total'"/>
<
xsl:
value-
of select="'Pass'"/>
<
xsl:
value-
of select="'Fail'"/>
<
xsl:
value-
of select="'Inconc'"/>
<
xsl:
value-
of select="'Kfail'"/>
<
xsl:
value-
of select="'Percent'"/>
<
xsl:
for-
each select="$testsuite">
<
xsl:
sort select="suite" order="ascending"/>
<
xsl:
variable name="suite" select="@name"/>
<
xsl:
if test="generate-id(.)=generate-id($testsuite[@name = $suite])">
<
xsl:
variable name="all-tests" select="$testcase[@suite = $suite]"/>
<
xsl:
variable name="test-num" select="count($all-tests)"/>
<
xsl:
variable name="test-pass" select="count($all-tests[@result = 'pass'])"/>
<
xsl:
variable name="test-fail" select="count($all-tests[@result = 'fail'])"/>
<
xsl:
variable name="test-inc" select="count($all-tests[@result = 'unknown'])"/>
<
xsl:
variable name="test-kfail" select="count($all-tests[@suite=$suite]/issues)"/>
<
xsl:
variable name="test-percent" select="round((($test-pass div $test-num) * 100) - 0.5)"/>
<
xsl:
variable name="suitename" select="translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
<
xsl:
variable name="end-time">
<
xsl:
for-
each select="$all-tests/@stop">
<
xsl:
if test="position() = last()">
<
xsl:
value-
of select="."/>
<
xsl:
variable name="duration">
<
xsl:
call-
template name="countDuration">
<
xsl:
with-
param name="testList" select="$all-tests"/>
<
xsl:
attribute name="bgcolor">
<
xsl:
when test="$test-percent = '100'">
<
xsl:
value-
of select="'lightgreen'" />
<
xsl:
when test="$test-fail = $test-kfail">
<
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,'/',@shortname,'-report.html')"/>
<
xsl:
value-
of select="@name"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="testcase/@start[1]"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$end-time"/>
<
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="$test-num"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$test-pass"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$test-fail"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$test-inc"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="$test-kfail"/>
<
xsl:
attribute name="align">
<
xsl:
value-
of select="'center'"/>
<
xsl:
value-
of select="concat($test-percent,'%')"/>
<
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="'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="countDuration">
<
xsl:
param name="testList"/>
<
xsl:
when test="$testList">
<
xsl:
variable name="recursive_result">
<
xsl:
call-
template name="countDuration">
<
xsl:
with-
param name="testList" select="$testList[position() > 1]"/>
select="number($testList[1]/@duration) + $recursive_result"/>
<
xsl:
otherwise><
xsl:
value-
of select="0"/></
xsl:
otherwise>
<
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'" />