""" 框架执行入口 """ import unittest from tools.handle_path import case_dir,report_name from tools.handle_report_file import HandleReportFile import unittestreport #将测试报告移动到历史目录下 HandleReportFile.move_file() #创建测试套件,其中start_dir指测试文件目录,case_dir指os.path.dirname(__file__),pattern指测试用例文件名称,默认以test.开头的py文件; suite = unittest.defaultTestLoader.discover(start_dir=case_dir,pattern="test_6_place_order.py") #创建执行器 runner = unittestreport.TestRunner( suite=suite, filename=report_name,#测试报告名称 report_dir="./reports",#测试报告存放路径 title='测试报告标题', tester='测试人名称', desc="接口自动化测试报告", templates=1#样式模版 ) runner.run() runner.send_email( host='smtp.qq.com', port=465, user='320597860293@qq.com', password='oyukpnrnjirebahb', to_addrs='ewhgaeiug@qq.com' )