28 Star 290 Fork 2

Phoenix/requests+pytest+allure+yaml+redis接口自动化测试框架-更新接口加密

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
setupMain.py 1.97 KB
一键复制 编辑 原始数据 按行查看 历史
Phoenix 提交于 2022-05-20 14:57 +08:00 . 整理环境
# coding:utf-8
import logging
import os
import time
import pytest
from config.confManage import dir_manage
from util.tools.dingding import DingTalkSendMsg
from util.tools.mkDir import mk_dir
from util.tools import root_path
from util.tools.readYamlFile import threading_read
project_path = os.path.dirname(os.path.abspath(__file__))
# if ':' in project_path:
# project_path = project_path.replace('\\', '/')
# else:
# pass
threading_read()
def run():
date = time.strftime('%Y-%m-%d')
localtime = time.strftime('%Y%m%d%H%M%S', time.localtime())
test_case_path = project_path + dir_manage('${test_suite}$') + dir_manage('${case_dir}$') + "/" + dir_manage(
'${test_name}$')
# temp地址变量
temp_path = project_path + dir_manage('${report_xml_dir}$') + "/temp/"
# html地址变量
html_path = project_path + dir_manage('${report_html_dir}$')
# 如果不存在地址路径则创建文件夹
mk_dir(temp_path)
mk_dir(html_path)
# 执行命令行
args = ['-s', '-q', test_case_path, '--alluredir', temp_path, "--clean-alluredir", '-n', '3']
# args = ['-s', '-q', test_case_path,]
# args = ['-s', '-q', test_case_path, '--alluredir',
# '/var/jenkins_home/workspace/autotest/report/xml',"--clean-alluredir", '-n', '3'] # docker中 jenkins工作空间项目根路径
pytest.main(args)
# cmd = 'allure generate %s -o %s -c' % (temp_path, html_path)
# os.system(cmd)
# 发送报告
# send_email(localtime + "测试报告", "http://192.168.1.3:9999")
# 钉钉发送
# ding = DingTalkSendMsg()
# ding.send_text("点击链接打开测试报告 http://192.168.1.3:9999")
# 生成html报告
# os.system(r'allure generate {0} -o {1} --clean'.format(temp_path, html_path))
# 打开报告服务 并指定端口
# os.system(r'allure serve {0} -p 9999'.format(temp_path))
if __name__ == '__main__':
# print(project_path)
# print(root_paht)
run()
# print(ini_allyaml())
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/a529548204/apitest.git
git@gitee.com:a529548204/apitest.git
a529548204
apitest
requests+pytest+allure+yaml+redis接口自动化测试框架-更新接口加密
master

搜索帮助