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)