unittest快速装载目前下所有测试用例的方法

 import unittest
from BeautifulReport import BeautifulReport    #导入BeautifulReport

if __name__ == '__main__':
  suite_tests = unittest.defaultTestLoader.discover(".",pattern="*tests.py",top_level_dir=None)     #"."表示当前目录,"*tests.py"匹配当前目录下所有tests.py结尾的用例
  BeautifulReport(suite_tests).report(filename='百度测试报告', description='搜索测试', log_path='.')    #log_path='.'把report放到当前目录下


参考: https://www.cnblogs.com/cnkemi/p/9052930.html
posted @ 2019-08-31 15:47  凯宾斯基  阅读(483)  评论(0编辑  收藏  举报