HTMLTestRunner 报告


from HTMLTestRunner import HTMLTestRunner
import unittest,time,os

if __name__=='__main__':
case_path = 'E:\\自动化PPT\\study\\cwp\\login'
report_path = os.path.join(os.getcwd(),'report')
now = time.strftime('%Y-%m-%d-%H_%M_%S',time.localtime(time.time()))
report_path = os.path.join(report_path,'result_'+now+'.html')
report_file = open(report_path,'wb')

runner = HTMLTestRunner(stream=report_file,
title='test report',
description='result of cwp')
discover = unittest.defaultTestLoader.discover(case_path,pattern='cwp_*.py',top_level_dir=case_path)
suite = unittest.TestSuite()
for test_suite in discover:
for test_case in test_suite:
suite.addTest(test_case)

# runner.run(suite)
runner = unittest.TextTestRunner(suite)




免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM