框架:
tests文件夹里放用例,最外层run.py运行用例生成报告
run.py代码示例:
""" 收集用例,执行用例 """ import unittest import unittestreport from BeautifulReport import BeautifulReport """发现文件夹的地址,收集用例,discover 是需要收集的用例模块属于哪个包""" suite = unittest.defaultTestLoader.discover('tests') # runner = unittestreport.TestRunner(suite) # runner.run() br = BeautifulReport(suite) br.report(description='测试报告')