1 Star 0 Fork 4

张威/APP自动化测试框架pytest+allure+uiautomator2+pom

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
run.py 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
默金 提交于 2022-08-05 10:25 . 1.update
# coding: utf-8
import shutil,pytest,os
from multiprocessing import Pool
def run(device_info):
pytest.main([ f"--cmdopt={device_info}",'%s'%device_info['test_case_path'] , "-vs", "--alluredir","target/allure-results"])
os.system('allure generate ./target/allure-results -o ./target/allure-report --clean')
def start_run():
try:
shutil.rmtree("./target") # 删除报告目录,删除后只能看到当前执行后的报告结果,不删除能看到执行的历史执行结果
except:
pass
device_info1 = [
{"devices_list":['0123456789ABCDEF'],"test_case_path":'./test_case','test_data_yaml':"group_data_1.yaml",'NO':"1"},
{"devices_list":['Q5S5T19423012718'],"test_case_path":'./test_case','test_data_yaml':"group_data_2.yaml",'NO':"2"}
]#非交互用例
device_info2 = [
{"devices_list": ['0123456789ABCDEF', 'Q5S5T19423012718', ], "test_case_path": './test_case_jh', 'test_data_yaml': "group_data_1.yaml",'NO':"1"},
#{"devices_list": ['0123456789ABCDEF', 'Q5S5T19423012718', ], "test_case_path": './test_case_jh','test_data_yaml': "group_data_2.yaml",'NO':"2"},
]#交互用例
device_info_list=[device_info1,device_info2]
for device_info in device_info_list:
with Pool(len(device_info)) as pool:#len(device_info)拿到配置的设备数,实现多进程执行,
pool.map(run, (device_info))
pool.close()
pool.join()
if __name__=="__main__":
start_run()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/pyj-zw/20220728_wx.git
git@gitee.com:pyj-zw/20220728_wx.git
pyj-zw
20220728_wx
APP自动化测试框架pytest+allure+uiautomator2+pom
master

搜索帮助

A270a887 8829481 3d7a4017 8829481