测试用例内容:
web测试用例 百度搜索简书
代码:
unittest
test_dir='./'
discover=unittest.defaultTestLoader.discover(test_dir,pattern='test_baidu.py')
from BSTestRunnerimport BSTestRunner
import time
if __name__ =='__main__':
report_dir='./test_report'
now=time.strftime('%Y-%m-%d %H_%M_%S')
report_name=report_dir+'/'+now+'result.html'
with open(report_name,'wb')as f:
runner=BSTestRunner(stream=f,title='Test Report',description='test case result')
runner.run(discover)
f.close()
执行结果
测试报告效果