Airtest

UI Test Automation Framework for Games and Apps

Github星跟踪图

Airtest · Build status

Cross-Platform UI Automation Framework for Games and Apps

跨平台的UI自动化框架,适用于游戏和App中文版点这里

image

Features

  • Write Once, Run Anywhere: Airtest provides cross-platform APIs, including app installation, simulated input, assertion and so forth. Airtest uses image recognition technology to locate UI elements so that you can automate games and apps without injecting any code.

  • Fully Scalable: Airtest cases can be easily run on large device farms, using commandline or python API. HTML reports with detailed info and screen recording allow you to quickly locate failure points. NetEase builds Airlab on top of the Airtest Project.

  • AirtestIDE: AirtestIDE is an out of the box GUI tool that helps to create and run cases in a user-friendly way. AirtestIDE supports a complete automation workflow: create -> run -> report.

  • Poco: Poco adds the ability to directly access object(UI widget) hierarchy across the major platforms and game engines. It allows writing instructions in Python, to achieve more advanced automation.

Get started from airtest homepage

Supported Platforms, -, -, -, -, -, -, -, -, Android, Emulator, iOS, Windows, Unity, Cocos2dx, Egret, WeChat, web

Installation

Use pip to install the Airtest python library.

pip install -U airtest

On MacOS/Linux platform, you need to grant adb execute permission.

# for mac
cd {your_python_path}/site-packages/airtest/core/android/static/adb/mac
# for linux
# cd {your_python_path}/site-packages/airtest/core/android/static/adb/linux
chmod +x adb

Download AirtestIDE from our homepage if you need to use the GUI tool.

Documentation

You can find the complete Airtest documentation on readthedocs.

Examples

Airtest aims at providing platform-independent API so that you can write automated cases once and run it on multiple devices and platforms.

  1. Using connect_device API you can connect to any android/iOS device or windows application.
  2. Then perform simulated input to automate your game or app.
  3. DO NOT forget to make assertions of the expected result.
from airtest.core.api import *

# connect an android phone with adb
init_device("Android")
# or use connect_device api
# connect_device("Android:///")

install("path/to/your/apk")
start_app("package_name_of_your_apk")
touch(Template("image_of_a_button.png"))
swipe(Template("slide_start.png"), Template("slide_end.png"))
assert_exists(Template("success.png"))
keyevent("BACK")
home()
uninstall("package_name_of_your_apk")

For more detailed info, please refer to Airtest Python API reference or take a look at API code

Running .air cases from CLI

Using AirtestIDE, you can easily create automated cases as .air directories.
Airtest CLI provides the possibility to execute cases on different host machines and target device platforms without using AirtestIDE itself.

# run cases targeting on Android phone connected to your host machine via ADB
airtest run "path to your .air dir" --device Android:///

# run cases targeting on Windows application whose title matches Unity.*
airtest run "path to your .air dir" --device "Windows:///?title_re=Unity.*"

# generate HTML report after running cases
airtest report "path to your .air dir"

# or use as a python module
python -m airtest run "path to your .air dir" --device Android:///

Try running provided example case: airtest/playground/test_blackjack.air and see Usage of CLI. Here is a multi-device runner sample.

Contribution

Pull requests are very welcome. Help needed here

Thanks

Thanks for all these great works that make this project better.

主要指标

概览
名称与所有者AirtestProject/Airtest
主编程语言Python
编程语言Python (语言数: 5)
平台
许可证Apache License 2.0
所有者活动
创建于2018-01-24 04:00:35
推送于2024-10-09 04:15:02
最后一次提交2024-09-26 14:55:23
发布数30
最新版本名称v1.3.5 (发布于 2024-09-26 14:56:02)
第一版名称v1.0.26 (发布于 2019-02-21 12:53:25)
用户参与
星数8.6k
关注者数211
派生数1.3k
提交数1k
已启用问题?
问题数1120
打开的问题数439
拉请求数75
打开的拉请求数13
关闭的拉请求数35
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?