代码拉取完成,页面将自动刷新
#!/usr/bin/python
# -*- coding: UTF-8 _*_
import os
import sys
import time
import pytest
from common import Shell
from common.Logs import Log
from common.Uploadfile import Uploadfile
from common.emails import mail
# dp = Uploadfile()
if __name__ == "__main__":
file = os.path.basename(sys.argv[0])
log = Log(file)
logger = log.Logger
# 运行单个文件 pytest.main(['../test_case/test_login.py']) 运行多个文件 pytest.main(['../test_case/test_login_getVar.py',
# '../test_case/test_login.py']) 运行整个目录 pytest.main(['../test_case', '--html=../report/report.html'])
# logger.info("开始执行脚本") >pytest F:\Python_Porject\Python_pytest_Allure\Run\run_all_case.py
# --alluredir=F:\\\Python_Porject\\Python_pytest_Allure\\allure-results\\ allure generate report -o report\\allure-reports\\
try:
print("开始执行脚本")
logger.info("==================================" + time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) + "===================================")
pytest.main(["./test_case", "--alluredir", "./report/reportallure/"])
print("脚本执行完成")
except Exception as e:
logger.error("脚本批量执行失败!", e)
print("脚本批量执行失败!", e)
try:
shell = Shell.Shell()
cmd = 'allure generate %s -o %s --clean' % ('./report/reportallure/', './report/reporthtml/')
# logger.info("开始执行报告生成")
print("开始生成测试报告")
time.sleep(3)
shell.invoke(cmd)
# print(shell.invoke(cmd))
# logger.info("报告生成完毕")
print("报告生成完毕")
except Exception as e:
print("报告生成失败,请重新执行", e)
# logger.error("报告生成失败,请重新执行", e)
# log.error('执行用例失败,请检查环境配置')
raise
time.sleep(5)
# mail()
# dp.file_deploy()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。