BeautifulReport
一个基于unittest.TestResult模块实现的测试用例模板, 可把测试中的结果通过BeautifulReport整合成一个可视化的报表。
安装
pip install BeautifulReport
使用
import unittest
from BeautifulReport import BeautifulReport
if __name__ == '__main__':
test_suite = unittest.defaultTestLoader.discover(xxx)
BeautifulReport(suit).report(description='项目测试报告',
filename='project_report',
report_dir=report_path,
theme='theme_default')
API
def report(self, description, filename: str = None, report_dir='.', log_path=None, theme='theme_default'):
生成测试报告,并放在当前运行路径下
:param report_dir: 生成report的文件存储路径
:param filename: 生成文件的filename
:param description: 生成文件的注释
:param theme: 报告主题名 theme_default theme_cyan theme_candy theme_memories
:return:
实现效果
配置用例截图
参考:
https://www.cnblogs.com/hao2018/p/10093343.html
https://www.cnblogs.com/xuzhongtao/p/11282430.html
致谢博主!!!