From afb397d3b711f98760c6ccd738cc48d9cf4bc7bb Mon Sep 17 00:00:00 2001
From: gary_williams <gary_williams@localhost>
Date: Tue, 04 Mar 2008 21:30:09 +0000
Subject: [PATCH] test report show known fails as yellow
---
opendj-sdk/opends/tests/functional-tests/testcases/runTestJob.xml | 25 ++++--
opendj-sdk/opends/tests/functional-tests/shared/xsl/gen-groups-report.xsl | 60 ++++++++++++--
opendj-sdk/opends/tests/shared/python/common.py | 44 ++--------
opendj-sdk/opends/tests/functional-tests/shared/xsl/gen-suites-report.xsl | 58 ++++++++++++--
4 files changed, 128 insertions(+), 59 deletions(-)
diff --git a/opendj-sdk/opends/tests/functional-tests/shared/xsl/gen-groups-report.xsl b/opendj-sdk/opends/tests/functional-tests/shared/xsl/gen-groups-report.xsl
index 076c33b..5b29588 100644
--- a/opendj-sdk/opends/tests/functional-tests/shared/xsl/gen-groups-report.xsl
+++ b/opendj-sdk/opends/tests/functional-tests/shared/xsl/gen-groups-report.xsl
@@ -29,9 +29,14 @@
<xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/>
+<xsl:param name="tests-log">''</xsl:param>
+
<xsl:template match="/">
- <!--- Test Report Header Variables -->
+ <!-- Tests log XML document -->
+ <xsl:variable name="tests-log-doc" select="document($tests-log)"/>
+
+ <!-- Test Report Header Variables -->
<xsl:variable name="ft" select="qa/functional-tests"/>
<xsl:variable name="identification" select="$ft/identification"/>
<xsl:variable name="url" select="normalize-space($identification/tests-url)"/>
@@ -46,6 +51,7 @@
<xsl:variable name="testcase" select="$testsuite/testcase"/>
<xsl:variable name="total-tests" select="count($testcase)"/>
<xsl:variable name="pass-tests" select="count($testcase[@result='pass'])"/>
+ <xsl:variable name="kfail-tests" select="count($tests-log-doc/qa/functional-tests/results/test[result='known'])"/>
<xsl:variable name="fail-tests" select="count($testcase[@result='fail'])"/>
<xsl:variable name="inconc-tests" select="count($testcase[@result='unknown'])"/>
<xsl:variable name="tests-dir" select="normalize-space($identification/tests-dir)"/>
@@ -206,12 +212,20 @@
<xsl:value-of select="'Fail'"/>
</xsl:element>
</xsl:element>
- <xsl:element name="td">
+ <xsl:element name="td">
<xsl:attribute name="align">
<xsl:value-of select="'center'"/>
</xsl:attribute>
<xsl:element name="b">
- <xsl:value-of select="'Inconclusive'"/>
+ <xsl:value-of select="'Inconc'"/>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="td">
+ <xsl:attribute name="align">
+ <xsl:value-of select="'center'"/>
+ </xsl:attribute>
+ <xsl:element name="b">
+ <xsl:value-of select="'Kfail'"/>
</xsl:element>
</xsl:element>
</xsl:element>
@@ -280,7 +294,7 @@
<xsl:value-of select="$fail-tests"/>
</xsl:element>
</xsl:element>
- <xsl:element name="td">
+ <xsl:element name="td">
<xsl:attribute name="align">
<xsl:value-of select="'center'"/>
</xsl:attribute>
@@ -288,6 +302,14 @@
<xsl:value-of select="$inconc-tests"/>
</xsl:element>
</xsl:element>
+ <xsl:element name="td">
+ <xsl:attribute name="align">
+ <xsl:value-of select="'center'"/>
+ </xsl:attribute>
+ <xsl:element name="b">
+ <xsl:value-of select="$kfail-tests"/>
+ </xsl:element>
+ </xsl:element>
</xsl:element>
</xsl:element>
@@ -345,6 +367,9 @@
<xsl:value-of select="'Inconc'"/>
</xsl:element>
<xsl:element name="th">
+ <xsl:value-of select="'Kfail'"/>
+ </xsl:element>
+ <xsl:element name="th">
<xsl:value-of select="'Percent'"/>
</xsl:element>
@@ -360,6 +385,7 @@
<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($tests-log-doc/qa/functional-tests/results/test[group=$group and result='known'])"/>
<xsl:variable name="test-percent" select="round((($test-pass div $test-num) * 100) - 0.5)"/>
<xsl:variable name="end-time">
@@ -381,11 +407,19 @@
</xsl:variable>
<xsl:element name="tr">
- <xsl:call-template name="setColour">
- <xsl:with-param name="percent" select="$test-percent"/>
- <xsl:with-param name="red" select="'100'"/>
- <xsl:with-param name="yellow" select="'100'"/>
- </xsl:call-template>
+ <xsl:attribute name="bgcolor">
+ <xsl:choose>
+ <xsl:when test="$test-percent = '100'">
+ <xsl:value-of select="'lightgreen'" />
+ </xsl:when>
+ <xsl:when test="$test-fail = $test-kfail">
+ <xsl:value-of select="'yellow'" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'red'" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
<!-- Group Name -->
<xsl:element name="td">
@@ -455,6 +489,14 @@
</xsl:attribute>
<xsl:value-of select="$test-inc"/>
</xsl:element>
+
+ <!-- Kfail -->
+ <xsl:element name="td">
+ <xsl:attribute name="align">
+ <xsl:value-of select="'center'"/>
+ </xsl:attribute>
+ <xsl:value-of select="$test-kfail"/>
+ </xsl:element>
<!-- Percent -->
<xsl:element name="td">
diff --git a/opendj-sdk/opends/tests/functional-tests/shared/xsl/gen-suites-report.xsl b/opendj-sdk/opends/tests/functional-tests/shared/xsl/gen-suites-report.xsl
index 8eb2e07..a7afee0 100644
--- a/opendj-sdk/opends/tests/functional-tests/shared/xsl/gen-suites-report.xsl
+++ b/opendj-sdk/opends/tests/functional-tests/shared/xsl/gen-suites-report.xsl
@@ -30,10 +30,15 @@
<xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/>
<xsl:param name="group">''</xsl:param>
+<xsl:param name="tests-log">''</xsl:param>
+
<xsl:variable name="groupdir" select="translate($group, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
<xsl:template match="/">
+ <!-- Tests log XML document -->
+ <xsl:variable name="tests-log-doc" select="document($tests-log)"/>
+
<!--- Test Report Header Variables -->
<xsl:variable name="ft" select="qa/functional-tests"/>
<xsl:variable name="identification" select="$ft/identification"/>
@@ -51,6 +56,7 @@
<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:variable name="kfail-tests" select="count($tests-log-doc/qa/functional-tests/results/test[result='known'])"/>
<xsl:variable name="tests-dir" select="normalize-space($identification/tests-dir)"/>
<xsl:element name="html">
@@ -209,12 +215,20 @@
<xsl:value-of select="'Fail'"/>
</xsl:element>
</xsl:element>
- <xsl:element name="td">
+ <xsl:element name="td">
<xsl:attribute name="align">
<xsl:value-of select="'center'"/>
</xsl:attribute>
<xsl:element name="b">
- <xsl:value-of select="'Inconclusive'"/>
+ <xsl:value-of select="'Inconc'"/>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="td">
+ <xsl:attribute name="align">
+ <xsl:value-of select="'center'"/>
+ </xsl:attribute>
+ <xsl:element name="b">
+ <xsl:value-of select="'Kfail'"/>
</xsl:element>
</xsl:element>
</xsl:element>
@@ -283,7 +297,7 @@
<xsl:value-of select="$fail-tests"/>
</xsl:element>
</xsl:element>
- <xsl:element name="td">
+ <xsl:element name="td">
<xsl:attribute name="align">
<xsl:value-of select="'center'"/>
</xsl:attribute>
@@ -291,6 +305,14 @@
<xsl:value-of select="$inconc-tests"/>
</xsl:element>
</xsl:element>
+ <xsl:element name="td">
+ <xsl:attribute name="align">
+ <xsl:value-of select="'center'"/>
+ </xsl:attribute>
+ <xsl:element name="b">
+ <xsl:value-of select="$kfail-tests"/>
+ </xsl:element>
+ </xsl:element>
</xsl:element>
</xsl:element>
@@ -348,6 +370,9 @@
<xsl:value-of select="'Inconc'"/>
</xsl:element>
<xsl:element name="th">
+ <xsl:value-of select="'Kfail'"/>
+ </xsl:element>
+ <xsl:element name="th">
<xsl:value-of select="'Percent'"/>
</xsl:element>
@@ -363,6 +388,7 @@
<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($tests-log-doc/qa/functional-tests/results/test[suite=$suite and result='known'])"/>
<xsl:variable name="test-percent" select="round((($test-pass div $test-num) * 100) - 0.5)"/>
<xsl:variable name="suitename" select="translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
@@ -383,11 +409,19 @@
</xsl:variable>
<xsl:element name="tr">
- <xsl:call-template name="setColour">
- <xsl:with-param name="percent" select="$test-percent"/>
- <xsl:with-param name="red" select="'100'"/>
- <xsl:with-param name="yellow" select="'100'"/>
- </xsl:call-template>
+ <xsl:attribute name="bgcolor">
+ <xsl:choose>
+ <xsl:when test="$test-percent = '100'">
+ <xsl:value-of select="'lightgreen'" />
+ </xsl:when>
+ <xsl:when test="$test-fail = $test-kfail">
+ <xsl:value-of select="'yellow'" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'red'" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
<!-- Group Name -->
<xsl:element name="td">
@@ -457,6 +491,14 @@
</xsl:attribute>
<xsl:value-of select="$test-inc"/>
</xsl:element>
+
+ <!-- Kfail -->
+ <xsl:element name="td">
+ <xsl:attribute name="align">
+ <xsl:value-of select="'center'"/>
+ </xsl:attribute>
+ <xsl:value-of select="$test-kfail"/>
+ </xsl:element>
<!-- Percent -->
<xsl:element name="td">
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/runTestJob.xml b/opendj-sdk/opends/tests/functional-tests/testcases/runTestJob.xml
index 3afb865..a4cf581 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/runTestJob.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/runTestJob.xml
@@ -515,8 +515,10 @@
standardReport=report_generation()
+ stringParamsDict={}
+
try:
- standardReport.transformReport(xslfile,xmlfile,htmlfile)
+ standardReport.transformReport(xslfile,xmlfile,htmlfile,stringParamsDict)
except IOError,details:
_message='Unable to generate standard test report %s.' % details
</script>
@@ -527,18 +529,21 @@
_message='Generated groups test report.'
xslfile= '%s/xsl/gen-groups-report.xsl' % TESTS_SHARED_DIR
htmlfile= '%s/groups.html' % logsReportDir
+ testslog= '%s/tests-log.xml' % logsTestsDir
groupsReport=report_generation()
-
+ stringParamsDict={ 'tests-log' : testslog }
+
try:
- groupsReport.transformReport(xslfile,xmlfile,htmlfile)
+ groupsReport.transformReport(xslfile,xmlfile,htmlfile,stringParamsDict)
except IOError,details:
- _message='Unable to generate groups test report %s.' % details
+ _message='Unable to generate groups test report %s.' % details
</script>
<message>_message</message>
<!-- Generate the test report by test suites -->
<script>
_message='Generated suites test reports.'
+
testGroupDirsList=os.listdir(logsTestsDir)
for testGroupName in testGroupDirsList:
@@ -551,10 +556,10 @@
xslfile= '%s/xsl/gen-suites-report.xsl' % TESTS_SHARED_DIR
suitesReport=report_generation()
- stringParamsDict={ 'group' : testGroupName }
+ stringParamsDict={ 'group' : testGroupName, 'tests-log' : testslog }
try:
- suitesReport.transformSuitesReport(xslfile,xmlfile,htmlfile,stringParamsDict)
+ suitesReport.transformReport(xslfile,xmlfile,htmlfile,stringParamsDict)
except IOError,details:
_message='Unable to generate suites test report %s.' % details
</script>
@@ -569,8 +574,10 @@
drillDownReport=report_generation()
+ stringParamsDict={}
+
try:
- drillDownReport.transformReport(myreportxsl,mytestslog,myreporthtml)
+ drillDownReport.transformReport(myreportxsl,mytestslog,myreporthtml,stringParamsDict)
except IOError,details:
_message='Unable to generate drill down test report %s.' % details
</script>
@@ -585,8 +592,10 @@
summaryReport=report_generation()
+ stringParamsDict={}
+
try:
- summaryReport.transformReport(mysummaryxsl,mysummaryxml,mysummarytext)
+ summaryReport.transformReport(mysummaryxsl,mysummaryxml,mysummarytext,stringParamsDict)
except IOError,details:
_message='Unable to generate summary text file %s.' % details
</script>
diff --git a/opendj-sdk/opends/tests/shared/python/common.py b/opendj-sdk/opends/tests/shared/python/common.py
index 2dc6997..7d97eba 100644
--- a/opendj-sdk/opends/tests/shared/python/common.py
+++ b/opendj-sdk/opends/tests/shared/python/common.py
@@ -29,8 +29,7 @@
# $Source$
# public symbols
-__all__ = [ "format_testcase", "directory_server_information", "test_time", \
- "report_generation" , "compare_file" ]
+__all__ = [ "format_testcase", "directory_server_information", "test_time", "report_generation", "compare_file", "exception_thrown" ]
class format_testcase:
'Format the Test name objects'
@@ -104,7 +103,7 @@
class report_generation:
'Test Report Generation'
- def transformReport(self,stylesheet,xml,output):
+ def transformReport(self,stylesheet,xml,output,params):
from java.io import FileInputStream
from java.io import FileOutputStream
from java.io import ByteArrayOutputStream
@@ -126,43 +125,20 @@
self.source = StreamSource(self.xml)
self.result = StreamResult(self.html)
+ for self.key,self.value in params.items():
+ self.transformer.setParameter(self.key, self.value)
+
self.transformer.transform(self.source, self.result)
finally:
self.xsl.close()
self.xml.close()
self.html.close()
- def transformSuitesReport(self,stylesheet,xml,output,params):
- from java.io import FileInputStream
- from java.io import FileOutputStream
- from java.io import ByteArrayOutputStream
-
- from javax.xml.transform import TransformerFactory
- from javax.xml.transform.stream import StreamSource
- from javax.xml.transform.stream import StreamResult
-
- self.xsl = FileInputStream("%s" % stylesheet)
- self.xml = FileInputStream("%s" % xml)
- self.html = FileOutputStream("%s" % output)
-
- try:
- self.xslSource = StreamSource(self.xsl)
- self.tfactory = TransformerFactory.newInstance()
- self.xslTemplate = self.tfactory.newTemplates(self.xslSource)
- self.transformer = self.xslTemplate.newTransformer()
-
- self.source = StreamSource(self.xml)
- self.result = StreamResult(self.html)
-
- self.myAttr = basic_utils().printKey(params)
- self.myValue = basic_utils().printKeyValue(params)
-
- self.transformer.setParameter(self.myAttr, self.myValue)
- self.transformer.transform(self.source, self.result)
- finally:
- self.xsl.close()
- self.xml.close()
- self.html.close()
+class exception_thrown:
+ 'User defined exceptions handlers'
+ def __init__(self):
+ self.message = ''
+ self.flag = ''
class compare_file:
'Compare two files'
--
Gitblit v1.10.0