1 Star 0 Fork 0

jeffsui/api-framework

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
run.py 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
jeffsui 提交于 2024-01-05 09:43 . project init
# -*- coding: utf-8 -*-
"""
Author: Jeffsui
"""
import shutil
import subprocess
import pytest
from common.mergeHistoryReport import *
from conf.setting import FilePath
if __name__ == '__main__':
# 获取coding参数 codingmode 1:True,0:False
codingmode = os.environ.get("codingmode")
if platform.system().lower() == "windows":
result_path = FilePath.ALLURE_RESULT
html_path = FilePath.ALLURE_HTML
else:
result_path = FilePath.LINUX_ALLURE_RESULT
html_path = FilePath.LINUX_ALLURE_HTML
buildOrder = get_dir() # 整合历史报告
# 忽略testcase的话添加--ignore=./testcase/{dirname}
pytest.main(['-v', '-s',
r'./testcase',
f'--alluredir={os.path.join(result_path, str(buildOrder))}',
r'--clean-alluredir'])
# 添加allure报告environment显示
shutil.copy("environment.properties", os.path.join(result_path, str(buildOrder), "environment.properties"))
# 将report目录下生成的json数据转换成html测试报告文件
os.system(f"allure generate {os.path.join(result_path, str(buildOrder))} "
f"-o {os.path.join(html_path, str(buildOrder))} --clean ")
update_new_single(buildOrder)
if buildOrder != 1:
update_file(buildOrder)
# 打开报告。本机地址+自定义端口。
if codingmode is None:
cmd = f"allure open -p 8080 {html_path}"
process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
start_new_session=True)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/pinghailinfeng/api-framework.git
git@gitee.com:pinghailinfeng/api-framework.git
pinghailinfeng
api-framework
api-framework
master

搜索帮助