美文网首页
python之生成测试报告

python之生成测试报告

作者: ying_728 | 来源:发表于2021-04-22 15:09 被阅读0次

    使用unittest的一个扩展HTMLTestRunner,先下载HTMLTestRunner,下载地址:http://tungwaiyip.info/software/HTMLTestRunner.html

    右击保存文件到python的安装路径lib下面。

    修改参数:

    第94行,将import StringIO修改成import io

    第539行,将self.outputBuffer = StringIO.StringIO()修改成self.outputBuffer = io.StringIO()

    第642行,将if not rmap.has_key(cls):修改成if not cls in rmap:

    第766行,将uo = o.decode('latin-1')修改成uo = e

    第775行,将ue = e.decode('latin-1')修改成ue = e

    第631行,将print >> sys.stderr, '\nTime Elapsed: %s' % (self.stopTime-self.startTime)修改成print(sys.stderr, '\nTime Elapsed: %s' % (self.stopTime-self.startTime))

    然后,cd到pip.exe安装文件目录下,执行pip命令,pip install html-testRunner 进行安装即可,安装完在python文件中可以正常导入即可 import HTMLTestRunner。

    相关文章

      网友评论

          本文标题:python之生成测试报告

          本文链接:https://www.haomeiwen.com/subject/tsxfrltx.html