加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
run_main.py 1.98 KB
一键复制 编辑 原始数据 按行查看 历史
jiangsibei 提交于 2021-12-14 14:35 . add
# -*- coding: utf-8 -*-
# author:jiangsibei
import os
import pytest
from tools.AdbOperation import *
# 获取工程路径
pro_path = os.path.dirname(inspect.getfile(inspect.currentframe())) + os.path.sep
configPath = os.path.join(pro_path, 'config.ini')
mode = Config.getRunparam(configPath,"mode")
apkurl = Config.getRunparam(configPath,"apkurl")
reruns = Config.getRunparam(configPath,"reruns")
platform = Config.getRunparam(configPath,"platform")
buildNumber = Config.getRunparam(configPath,"buildNumber")
mark = Config.getRunparam(configPath,"mark")
reruns_delay = Config.getRunparam(configPath,"reruns_delay")
def Runcase(devices,reportpath,casepath,phone):
adboperarion = AdbOperation()
adboperarion.connect_device(devices)
print("链接成功",os.getpid())
if apkurl != "":
AdbOperation.InstallApp()
ReportPath = "reports/"+reportpath
cmdopt_str = "--cmdopt="+str(phone)
if mode == "2":
while not casepath.empty():
print("----",os.getpid())
filename = pro_path + 'testcase/'+casepath.get()
print("------------",filename)
pytest.main(["-sv",cmdopt_str, '--alluredir', ReportPath,filename,'--reruns=5', '--reruns-delay=3'])
elif mark != "":
mark_param = "-m="+mark
pytest.main(["-sv",cmdopt_str,mark_param, cmdopt_str,'--alluredir', ReportPath,'--reruns=5', '--reruns-delay=3',casepath])
else:
pytest.main(["-sv",cmdopt_str, '--alluredir', ReportPath,'--reruns=5', '--reruns-delay=3'])
#####该main函数方便调试单个文件
if __name__ == "__main__":
adboperarion = AdbOperation()
deviceslist = adboperarion.getdevices()
adboperarion = AdbOperation()
adboperarion.connect_device(deviceslist[0])
filename = pro_path + 'testcase/'+'test_complete_today_progress_L1_1.py'
ReportPath = "reports/"+"1"
#pytest.main(["-sv",'--alluredir', ReportPath,filename])
pytest.main([ '--alluredir', ReportPath,filename,'--reruns=5', '--reruns-delay=3'])
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化