unittest生成报告

# html报告文件路径
    report_abspath = os.path.join(report_path, "result.html")
    fp = open(report_abspath, "wb")
    runner = HTMLTestRunner.HTMLTestRunner(stream=fp,
                                           title=u'自动化测试报告,测试结果如下:',
                                           description=u'用例执行情况:')

    # 调用add_case函数返回值
    runner.run(all_case())
    fp.close()

posted @ 2019-09-26 17:55  千年妖狐  阅读(346)  评论(0编辑  收藏  举报