Files
InterfaceAutoTest/main.py
CNWei 1890918312 refactor(models): 优化项目
- 重构assert_all
- 优化目录结构
2025-02-28 17:48:20 +08:00

20 lines
726 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
import shutil
import datetime
import pytest
from commons.cases import TestAPI
TestAPI.find_yaml_case() # 加载yaml文件
if __name__ == '__main__':
now = datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')
# 1启动框架生成临时文件
# -x表示有一个用例失败后面将不执行;-v表示展示用例名称;-c,配置文件所在目录指定pytest.ini路径;--alluredir=temp。指定数据生成目录
pytest.main([__file__, "-x", "-v","--alluredir=temp"])
# 2生成HTML报告
os.system('allure generate temp -o report --clean') # java程序只能借助操作系统执行
# 3备份日志
# shutil.copy2("logs/pytest.log", f"logs/pytest_{now}.log")