多设备并行运行Airtest测试
For Readme in English, see readme.md
- 使用adb连接多台设备
- 安装 python3 环境以及 airtest
pip install airtest
- clone 或者下载样例,打开项目目录,运行代码
python run.py
A sample of running Airtest on multiple devices
Home Page: http://airtest.netease.com/
多设备并行运行Airtest测试
For Readme in English, see readme.md
pip install airtest
python run.py
坑死了··
ret = subprocess.call(cmd,
cwd=os.getcwd()
)
这里不能写shell=True
!!!!!
我在测试中,poco 只对一台设备起作用.
例如下面代码,每次只会对一台设备加快滑动操作,而且每一次手机都会弹出 安装 pocoservice 程序
# -*- encoding=utf8 -*-
__author__ = "to"
import logging
logger = logging.getLogger("airtest")
logger.setLevel(logging.ERROR)
from airtest.core.api import *
from airtest.cli.parser import cli_setup
from poco.drivers.android.uiautomation import AndroidUiautomationPoco
# script content
print("start...")
PWD = os.path.dirname(__file__)
PKG = "com.smile.gifmaker"
keyevent("HOME")
stop_app(PKG)
start_app(PKG)
sleep(6.0)
poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)
poco.swipe([0.5, 0.92], [0.5, 0.2], duration=(1))
poco("com.smile.gifmaker:id/right_btn").click()
使用安卓设备连接调试运行时报以下错误
pkg_resources.DistributionNotFound: The 'facebook-wda==0.2.1' distribution was not found and is required by airtest
网上查了一下facebook-wda是用于ios自动化,本地安装了这个模块也不行,麻烦问一下这个怎么解决
提交了太多log文件和图片,可以gitignore一下,不然仓库会变得太大
E:\TestDEV\multi-device-runner>python3 run.py
[08:36:20][DEBUG]<airtest.core.android.adb> D:\Python37\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe devices
failed to create process.
Report build Failed. File not found in dir test_blackjack.air\log\5LM0216219001163\log.txt
failed to create process.
Report build Failed. File not found in dir test_blackjack.air\log\R58M22CWDQT\log.txt
Traceback (most recent call last):
File "C:\Users\xyz\multi-device-runner-master\multi-device-runner-master\run.py", line 56, in run_on_multi_device
'process': subprocess.Popen(cmd,cwd=os.getcwd()),
File "subprocess.py", line 729, in init
File "subprocess.py", line 1017, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
Traceback (most recent call last):
File "C:\Users\xyz\multi-device-runner-master\multi-device-runner-master\run.py", line 113, in run_summary
html = env.get_template('report_tpl.html').render(data=summary)
File "site-packages\jinja2\asyncsupport.py", line 76, in render
File "site-packages\jinja2\environment.py", line 1008, in render
File "site-packages\jinja2\environment.py", line 780, in handle_exception
File "site-packages\jinja2_compat.py", line 37, in reraise
File "C:\Users\xyz\multi-device-runner-master\multi-device-runner-master\report_tpl.html", line 219, in top-level template code
我知道存在.get_current_resolution()方法,但是在您的例子里面,我不知道如何去调用这个方法,无法在子类中找到device对象
您好 作者,请问下load_jdon_data方法里的data.json 文件内容是怎么生成的,需要在编写脚本的时候自己写代码实现,生成data.json?
@yimelia
标题所说的这个函数运行后汇总的html报告能不能稍微改进下
具体情况如下:
某些测试情况比如assert_equal判断,有时值不等是个bug,但不影响整体功能进行,捕获这个异常后,脚本还是可以继续跑的。最后的汇总结果会显示该机型的脚本运行状态为成功,点开详情的时候会显示某步骤执行失败
希望的结果:
有步骤执行失败时,即使最后的脚本运行结束,也不显示状态成功,显示失败
运行环境:Darwin B-523FMD6M-2359.local 21.6.0 Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:25 PDT 2022; root:xnu-8020.140.41~1/RELEASE_X86_64 x86_64
python: Python 3.9.13
运行命令原来是数组形式的,在我的环境中报错了。修改成一个字符串就可以正常运行了。
cmd = 'airtest report {} --log_root {} --outfile {}'.format(
air, log_dir, os.path.join(log_dir, 'log.html'))
ret = subprocess.call(cmd, shell=True, cwd=os.getcwd())
感谢老板
thanks boss
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.