test report show known fails as yellow
| | |
| | | |
| | | <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)"/> |
| | |
| | | <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)"/> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | <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> |
| | | |
| | |
| | | <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> |
| | | |
| | |
| | | <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"> |
| | |
| | | </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"> |
| | |
| | | </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"> |
| | |
| | | <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"/> |
| | |
| | | <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"> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | <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> |
| | | |
| | |
| | | <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> |
| | | |
| | |
| | | <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')"/> |
| | | |
| | |
| | | </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"> |
| | |
| | | </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"> |
| | |
| | | |
| | | 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> |
| | |
| | | _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: |
| | | |
| | |
| | | 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> |
| | |
| | | |
| | | 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> |
| | |
| | | |
| | | 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> |
| | |
| | | # $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' |
| | |
| | | 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 |
| | |
| | | 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' |