Esempio n. 1
0
    def writeResultsPage(self):
        contents = '<?xml version="1.0" encoding="UTF-8"?>\n'
        contents += '<?xml-stylesheet type="text/xsl" href="index.xsl"?>\n'
        contents += '<TestRunList>\n'
        siteTestStatus = ""
        updateDateTime = time.strftime("%a %b %d %T UTC %Y", time.gmtime())
        contents += "<TestRunTime><![CDATA[%s]]></TestRunTime>\n" % updateDateTime

        for dict in self.output_files:
            file = dict["file"]
            type = dict["type"]
            fullPathItems = file.split("/")
            display = os.path.basename(file).replace("_", " ")[:-4]
            contents += "<TestDetail path='%s' type='%s'>%s</TestDetail>\n" % (
                os.path.basename(file), type, display)

            if type == 'critical':
                xml = open(file, "r")
                handler = GipResultsParser()
                parseXmlSax(xml, handler)
                crit_test_results = handler.getGipResults()
                cases = crit_test_results["cases"]
                for case in cases:
                    sitename = case["site"]
                    count = int(case["failure_count"]) + int(
                        case["error_count"]) + int(case["info_count"])
                    if count > 0:
                        result = "red"
                    else:
                        result = "green"
                    siteTestStatus += "<Site name='%s' test='%s' result='%s' path='%s'/>\n" % (
                        sitename, os.path.basename(file)[:-4], result,
                        os.path.basename(file))

        # need to build site status table here
        contents += siteTestStatus

        contents += '</TestRunList>'
        output_file = "%s/index.xml" % self.output_dir
        fileOverWrite(output_file, contents)

        return output_file
Esempio n. 2
0
    def writeResultsPage(self):
        contents = '<?xml version="1.0" encoding="UTF-8"?>\n'
        contents += '<?xml-stylesheet type="text/xsl" href="index.xsl"?>\n'
        contents += '<TestRunList>\n'
        siteTestStatus = ""
        updateDateTime = time.strftime("%a %b %d %T UTC %Y", time.gmtime())
        contents += "<TestRunTime><![CDATA[%s]]></TestRunTime>\n" % updateDateTime

        for dict in self.output_files:
            file = dict["file"]
            type = dict["type"]
            fullPathItems = file.split("/")
            display = os.path.basename(file).replace("_", " ")[:-4]
            contents += "<TestDetail path='%s' type='%s'>%s</TestDetail>\n" % (os.path.basename(file), type, display)

            if type == 'critical':
                xml = open(file, "r")
                handler = GipResultsParser()
                parseXmlSax(xml, handler)
                crit_test_results = handler.getGipResults()
                cases = crit_test_results["cases"]
                for case in cases:
                    sitename = case["site"]
                    count = int(case["failure_count"]) + int(case["error_count"]) + int(case["info_count"])
                    if count > 0:
                        result = "red"
                    else:
                        result = "green"
                    siteTestStatus += "<Site name='%s' test='%s' result='%s' path='%s'/>\n" % (sitename, os.path.basename(file)[:-4], result, os.path.basename(file))

        # need to build site status table here
        contents += siteTestStatus

        contents += '</TestRunList>'
        output_file = "%s/index.xml" % self.output_dir
        fileOverWrite(output_file, contents)

        return output_file
Esempio n. 3
0
def writeXML(dom, filename, pretty=False):
    if pretty:
        contents = dom.toprettyxml()
    else:
        contents = dom.toxml()
    fileOverWrite(filename, contents)
Esempio n. 4
0
    def write_results(self, test, contents):
        output_file = "%s/%s.xml" % (self.output_dir, os.path.basename(test))
        fileOverWrite(output_file, contents)

        return output_file
Esempio n. 5
0
    def write_results(self, test, contents):
        output_file = "%s/%s.xml" % (self.output_dir, os.path.basename(test))
        fileOverWrite(output_file, contents)

        return output_file