1 Star 0 Fork 37

xuefeng365/pytest-webUI-selenium自动化框架

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
run.py 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
lovingd 提交于 2021-09-15 16:08 . 优化
import pytest
import os
import shutil
if __name__ == '__main__':
print("开始删除allure-results")
filepath = (os.path.abspath(os.path.dirname(__file__)) + "/allure-results/")
if os.path.exists(filepath):
shutil.rmtree("{}".format(filepath))
os.makedirs("{}".format(filepath))
else:
os.makedirs("{}".format(filepath))
path_report = (os.path.abspath(os.path.dirname(__file__)) + "/allure-report")
if os.path.exists(path_report):
shutil.rmtree("{}".format(path_report))
# pytest.main(['-m','smoke'])
pytest.main()
os.system(r"allure generate ./allure-results -o ./allure-report --clean")
os.system('allure open allure-report') # 打开报告
#失败重试
# • 测试失败后要重新运行n次,要在重新运行之间添加延迟时 间,间隔n秒再运行。
# • 执行:
# • 安装:pip install pytest-rerunfailures
# • pytest -v - -reruns 5 --reruns-delay 1 —每次等1秒 重试5次
#并发运行
# 前提:用例之间都是独立的,没有先后顺序,随机都能执行,可重复运行不 影响其他用例。
# 安装:Pip3 install pytest-xdist
# • 多个CPU并行执行用例,直接加-n 3是并行数量:pytest -n 3 • 在多个终端下一起执行
# os.system('--alluredir=allure-results --clean-alluredir')#清理之前的
# os.system('allure generate allure-results -o allure-report -c ')#allure generate命令的时候会从这些测试结果集中去生成HTML报告
# pytest.main(["-sq",
# "--alluredir", "./allure-results"])
# os.system(r"allure generate --clean allure-results -o allure-report")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/xuefeng365/xin-pytest-web-ui.git
git@gitee.com:xuefeng365/xin-pytest-web-ui.git
xuefeng365
xin-pytest-web-ui
pytest-webUI-selenium自动化框架
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385