##run.py
import unittest
import os,datetime
from BeautifulReport import BeautifulReport
root_dir = os.path.dirname(os.path.abspath(__file__))
test_dir = root_dir + '/testCases'
discover = unittest.defaultTestLoader.discover(test_dir,'test*.py')
now = datetime.datetime.now().strftime('%Y-%m-%d %H_%M_%S')#'%Y-%m-%d 是中间线-;%H_%M_%S'是下划线_
fileName = "xx测试报告" + str(now)
report_dir = root_dir + '/test_report' #如果没有这个指定报告目录,他会把报告默认放在run.py的父目录同级别下
#D:\pythonXangmu\pythonproject01\testObjekt\test_report\xx测试报告2023-11-20 19_43_01.html
#D:\pythonXangmu\pythonproject01\testObjekt\run.py
#D:\pythonXangmu\pythonproject01\xx测试报告2023_11_20 19_30_09.html
BeautifulReport(discover).report(description='测试报告A',filename=fileName,log_path=report_dir)