####################################################################### ## J U N I T D V S L S T Y L E S H E E T ## ####################################################################### ## This stylesheet is used to transform the output of JUnit's xml ## generator. The XML is transformed into a standard xdoc that can ## then be transformed (yet again) using whatever stylesheet is used ## to format one's site. ## ## Based on the XSL stylesheet junit-noframes.xsl from Ant. ## ## Version: $Id: cactus.dvsl,v 1.1 2003/01/24 03:44:37 jvanzyl Exp $ ####################################################################### ## G L O B A L V A R I A B L E S ## ####################################################################### ## Used to facilitate quoting in the template. ## #set ($quote = '"') ####################################################################### ## V E L O C I T Y M A C R O S ## ####################################################################### ## Convert a string that represents a number using the specified ## pattern. ## #macro (formatAsNumber $string $pattern) #set ($value = $context.toolbox.numbers.parse($string)) $context.toolbox.formatter.formatNumber($value, $pattern) #end ## Prints a standard navbar for navigation. ## #macro (navbar)

[summary] [package list] [test cases]

#end ## Prints a standard header for a test suite. ## #macro (testSuiteHeader) Name Tests Errors Failures Time(s) #end ## Prints a standard header for a test case. ## #macro (testCaseHeader) Name Status Type Time(s) #end ## Prints the message from a failure. ## #macro (displayFailure $current) #if ($current.attribute("message")) $context.toolbox.htmlescape.getText($current.attribute("message")) #else N/A #end

$context.toolbox.htmlescape.getText($current.value()) #end ## Generates the report if unit tests were present. ## #macro (generateReport) #navbar ()

The following document contains the results of the Cactus tests.

###################################################################
#navbar () #set ($testCount = $node.valueOf("sum(testsuite/@tests)")) #set ($errorCount = $node.valueOf("sum(testsuite/@errors)")) #set ($failureCount = $node.valueOf("sum(testsuite/@failures)")) #set ($timeCount = $node.valueOf("sum(testsuite/@time)")) #set ($successRate = $node.valueOf("($testCount - ($failureCount + $errorCount)) div $testCount"))
Tests Errors Failures Success rate Time(s)
#formatAsNumber ($testCount "0") #formatAsNumber ($errorCount "0") #formatAsNumber ($failureCount "0") #formatAsNumber ($successRate "0.00%") #formatAsNumber ($timeCount "0.000")

Note: failures are anticipated and checked for with assertions while errors are unanticipated.

###################################################################
#navbar () #testSuiteHeader () #foreach ($testsuite in $node.selectNodes("./testsuite[not(./@package = preceding-sibling::testsuite/@package)]")) #set ($package = $testsuite.attribute('package')) #set ($quotedPackage = "$quote$package$quote") #set ($testCount = $node.valueOf("sum(./testsuite[./@package = $quotedPackage]/@tests)")) #set ($errorCount = $node.valueOf("sum(./testsuite[./@package = $quotedPackage]/@errors)")) #set ($failureCount = $node.valueOf("sum(./testsuite[./@package = $quotedPackage]/@failures)")) #set ($timeCount = $node.valueOf("sum(./testsuite[./@package = $quotedPackage]/@time)")) #end
$package #formatAsNumber ($testCount "0") #formatAsNumber ($failureCount "0") #formatAsNumber ($errorCount "0") #formatAsNumber ($timeCount "0.000")

Note: package statistics are not computed recursively, they only sum up all of its testsuites numbers.

#foreach ($testsuite in $node.selectNodes("./testsuite[not(./@package = preceding-sibling::testsuite/@package)]")) #set ($package = "$testsuite.attribute('package')") #set ($quotedPackage = "$quote$package$quote") #testSuiteHeader () #foreach ($test in $node.selectNodes("/testsuites/testsuite[./@package = $quotedPackage]")) #end
$test.attribute('name') #formatAsNumber ($test.attribute('tests') "0") #formatAsNumber ($test.attribute('errors') "0") #formatAsNumber ($test.attribute('failures') "0") #formatAsNumber ($test.attribute('time') "0.000")
#end
###################################################################
#navbar () #foreach ($testsuite in $node.selectNodes("./testsuite")) #testCaseHeader () ## test can even not be started at all (failure to load the class) ## so report the error directly ## #foreach ($error in $testsuite.selectNodes("./error")) #end #foreach ($testcase in $testsuite.selectNodes("./testcase")) #if ($testcase.get("failure")) #elseif ($testcase.get("error")) #else #end #if ($testcase.attribute("time")) #else #end #end
#displayFailure ($error)
$testcase.attribute("name")Failure #displayFailure ($testcase.selectSingleNode("failure")) Error #displayFailure ($testcase.selectSingleNode("error")) Success #formatAsNumber ($testcase.attribute("time") "0.000")
#end
#end ####################################################################### ## T E M P L A T E D E F I N I T I O N S ## ####################################################################### ## Matches the root element of the JUnit XML report. ## #match ("testsuites") Cactus Test Results
#if (! $node.get("testsuite"))

This project does not contain any unit tests.

#else #generateReport() #end
#end