Esempio n. 1
0
    def end_report(self):
        super(HtmlTestReport, self).end_report()
        data = json.dumps(self._data)
        content = "var qta_report_data = %s" % data
        with codecs_open("qta-report.js", "w", encoding="utf-8") as fd:
            fd.write(content)

        qta_report_html = get_inner_resource("qta_statics", "qta-report.html")
        shutil.copy(qta_report_html, os.getcwd())
Esempio n. 2
0
    def end_report(self):
        '''结束测试执行
        :param passed: 测试是否通过
        :type passed: boolean
        '''
        time_end = datetime.now()
        timexml = "<RunTime><StartTime>%s</StartTime><EndTime>%s</EndTime><Duration>%s</Duration></RunTime>"
        timexml = timexml % (self._time_start.strftime("%Y-%m-%d %H:%M:%S"), time_end.strftime("%Y-%m-%d %H:%M:%S"), str(time_end - self._time_start).split('.')[0])
        timenodes = dom.parseString(timexml)
        self._runrstnode.appendChild(timenodes.childNodes[0])

        xmldata = to_pretty_xml(self._xmldoc)
        with codecs_open('TestReport.xml', 'wb') as fd:
            fd.write(xmldata)
        test_repor_xsl = get_inner_resource("qta_statics", "TestReport.xsl")
        shutil.copy(test_repor_xsl, os.getcwd())
        test_result_xsl = get_inner_resource("qta_statics", "TestResult.xsl")
        shutil.copy(test_result_xsl, os.getcwd())