From 1c9073b24ff1eb457aeb0d1ebe4239a9e00f7d73 Mon Sep 17 00:00:00 2001
From: gary_williams <gary_williams@localhost>
Date: Thu, 22 Nov 2007 20:56:08 +0000
Subject: [PATCH] Add extra information to report xml
---
opends/tests/functional-tests/testcases/runTestJob.xml | 58 ++++++++++++-----------------
opends/tests/shared/python/common.py | 37 +++++++++++++++++-
2 files changed, 58 insertions(+), 37 deletions(-)
diff --git a/opends/tests/functional-tests/testcases/runTestJob.xml b/opends/tests/functional-tests/testcases/runTestJob.xml
index 76fe72e..63666e1 100644
--- a/opends/tests/functional-tests/testcases/runTestJob.xml
+++ b/opends/tests/functional-tests/testcases/runTestJob.xml
@@ -31,6 +31,7 @@
<function name="start_job">
<sequence>
+
<script>
STAXLogMessage = 1
</script>
@@ -46,6 +47,15 @@
</sequence>
</if>
+ <!-- Load in the local shared python objects -->
+ <script>
+ import sys
+ sys.path.append("%s/shared/python" % TESTS_ROOT )
+ from common import *
+ </script>
+
+ <message>'PATH= %s' % sys.path</message>
+
<!-- Check some of the optional variables from config.py -->
<script>
try:
@@ -310,7 +320,7 @@
startValueDict['start']=timestamp
testDict[tcname]=startValueDict
- testCaseList.append(tcname)
+ testCaseList.append(tcname.strip())
else:
errorfh.write('Warning: No match Start element %s.\n' % element)
@@ -420,14 +430,14 @@
if testDict.has_key(tcname):
tcnamesplit=tcname.split(":")
if tcnamesplit[0]:
- testgroup=tcnamesplit[0]
+ tcgroup=tcnamesplit[0].strip()
if tcnamesplit[1]:
- testsuite=tcnamesplit[1]
+ tcsuite=tcnamesplit[1].strip()
else:
- testsuite=testgroup
+ tcsuite=tcgroup
else:
- testgroup=tcname
- testsuite=tcname
+ tcgroup=tcname
+ tcsuite=tcname
if testDict[tcname].has_key('pass'):
tcpass=testDict[tcname]['pass']
@@ -463,10 +473,12 @@
tcresult='unknown'
else:
tcresult='fail'
+
+ tcdurationsecs=test_time().timeToSeconds(tcduration)
- xmlfh.write(' <testgroup name="%s">\n' % testgroup)
- xmlfh.write(' <testsuite name="%s">\n' % testsuite)
- xmlfh.write(' <testcase name="%s" result="%s" start="%s" stop="%s" duration="%s"/>\n' % (tcname,tcresult,tcstart,tcstop,tcduration))
+ xmlfh.write(' <testgroup name="%s">\n' % tcgroup)
+ xmlfh.write(' <testsuite name="%s">\n' % tcsuite)
+ xmlfh.write(' <testcase group="%s" suite="%s" name="%s" result="%s" start="%s" stop="%s" duration="%s"/>\n' % (tcgroup,tcsuite,tcname,tcresult,tcstart,tcstop,tcdurationsecs))
xmlfh.write(' </testsuite>\n')
xmlfh.write(' </testgroup>\n')
</script>
@@ -487,35 +499,13 @@
'XML Report Written to %s.' % xmlfile
</message>
- <script>
- class reportGeneration:
- 'Test Report Generation'
- def transformReport(self,stylesheet,xml,output):
- 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.xslSource = StreamSource(FileInputStream("%s" % stylesheet))
- self.xslTemplate = TransformerFactory.newInstance().newTemplates(self.xslSource)
- self.transformer = self.xslTemplate.newTransformer()
-
- self.source = StreamSource(FileInputStream("%s" % xml))
- self.result = StreamResult(FileOutputStream("%s" % output))
-
- self.transformer.transform(self.source, self.result)
- </script>
-
<!-- Generate the standard test report showing all testcases -->
<script>
_message='Generated standard test report.'
xslfile= '%s/xsl/gen-alltests-report.xsl' % TESTS_SHARED_DIR
htmlfile= '%s/results.html' % logsReportDir
- standardReport=reportGeneration()
+ standardReport=report_generation()
try:
standardReport.transformReport(xslfile,xmlfile,htmlfile)
@@ -531,7 +521,7 @@
myreporthtml='%s/my-report.html' % logsReportDir
mytestslog='%s/tests-log.xml' % logsTestsDir
- drillDownReport=reportGeneration()
+ drillDownReport=report_generation()
try:
drillDownReport.transformReport(myreportxsl,mytestslog,myreporthtml)
@@ -547,7 +537,7 @@
mysummarytext='%s/summary.txt' % logsReportDir
mysummaryxml=xmlfile
- summaryReport=reportGeneration()
+ summaryReport=report_generation()
try:
summaryReport.transformReport(mysummaryxsl,mysummaryxml,mysummarytext)
diff --git a/opends/tests/shared/python/common.py b/opends/tests/shared/python/common.py
index 0fe7442..102bd26 100644
--- a/opends/tests/shared/python/common.py
+++ b/opends/tests/shared/python/common.py
@@ -29,10 +29,10 @@
# $Source$
# public symbols
-__all__ = [ "format_testcase", "directory_server_information" ]
+__all__ = [ "format_testcase", "directory_server_information", "test_time", "report_generation" ]
class format_testcase:
- "Format the Test name objects"
+ 'Format the Test name objects'
def group(self,string):
self.group=string.lower()
self.group=self.group.strip()
@@ -48,7 +48,7 @@
return '%s' % self.name
class directory_server_information:
- "Container for Information about Directory Servers"
+ 'Container for Information about Directory Servers'
def __init__(self):
self.line=''
self.key=''
@@ -79,3 +79,34 @@
def getServerValueFromKey(self,string,result):
return result[string]
+class test_time:
+ 'Simple time related manipulation objects'
+ def __init__(self):
+ self.seconds=0
+ self.minutes=0
+ self.hours=0
+
+ def timeToSeconds(self,clocktime):
+ self.hours,self.minutes,self.seconds=clocktime.split(':')
+ return int(self.hours)*7200+int(self.minutes)*60+int(self.seconds)
+
+class report_generation:
+ 'Test Report Generation'
+ def transformReport(self,stylesheet,xml,output):
+ 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.xslSource = StreamSource(FileInputStream("%s" % stylesheet))
+ self.xslTemplate = TransformerFactory.newInstance().newTemplates(self.xslSource)
+ self.transformer = self.xslTemplate.newTransformer()
+
+ self.source = StreamSource(FileInputStream("%s" % xml))
+ self.result = StreamResult(FileOutputStream("%s" % output))
+
+ self.transformer.transform(self.source, self.result)
+
--
Gitblit v1.10.0