測(cè)試用例內(nèi)容:
web測(cè)試用例 百度搜索簡(jiǎn)書(shū)
代碼:
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()
執(zhí)行結(jié)果
測(cè)試報(bào)告效果