Airtest是网易游戏开源的一款自动化测试框架,基于Python脚本的方式,可用于web,Windows程序、APP自动化测试。
一、IDE运行
二、还可用命令方式在命令窗口运行
点击运行按钮时,在log viewer窗口也可以看到运行时执行的命令,如下:
下面是对命令的详解:
1、运行
命令:
Airtest编译器位置 runner 运行脚本位置 --device android://安卓设备号 --log 输出log位置 -recording录屏
"D:\download\AirtestIDE-win-1.2.10\AirtestIDE\AirtestIDE" runner "C:\Users\EDZ\Desktop\work\Airtest program\crash plus.air" --device android://127.0.0.1:5037/ae24d3c0?cap_method=JAVACAP&&ori_method=MINICAPORI&&touch_method=MAXTOUCH --log
"C:\Users\EDZ\Desktop\work\Airtest program\report\1"
参数说明:
run 后边接脚本路径
--device 手机设备,adbhost是adb server所在主机的ip(本地host为127.0.0.1),adb port默认是5037,serialno是android手机的序列号。更多adb的方面的内容请参考文档developer.google。
# 连接本机默认端口连的一台设备号为ae24d3c0?的手机:Android://127.0.0.1:5037/ae24d3c0?
--log log输出目录
--recording 运行时录屏
2、查看报告
命令:
Airtest编译器位置 reporter Airtest脚本位置 --log_root 报告存储位置 --outfile html报告位置 --static_root 测试报告静态文件资源根目录 --lang zh设置中文 --plugin加载报告插件
D:\download\AirtestIDE-win-1.2.10\AirtestIDE\AirtestIDE reporter C:\Users\EDZ\Desktop\work\Airtest program\crash plus.air --log_root C:\Users\EDZ\Desktop\work\Airtest program\report\1 --outfile C:\Users\EDZ\Desktop\work\Airtest program\report\1\log.html --static_root D:\download\AirtestIDE-win-1.2.10\AirtestIDE\airtest\report --lang zh --plugin airtest_selenium.report poco.utils.airtest.report
参数说明:
reporter: 生成报告命令
--log_root:运行报告后的log截图,录屏根目录
--outfile :输出html测试报告文件
--static_root:静态资源文件路径
--lang zh:语音设置,英文--en,中文--zh
--plugin:加载报告插件,selenium或poco插件
下面贴上官网:批量执行脚本 - Airtest Project Docs