Airtest

AirtestProjectApache-2.0更新放缓

基于图像识别和 Poco 控件识别的跨平台 UI 自动化测试框架,用 Python 脚本驱动 Android、iOS、Windows 上的游戏和应用做自动化测试。

UI Automation Framework for Games and Apps

v1.4.3发布于 2025-12-04 07:11 UTC9,645star +3 / 7 天1,456fork同步于 2026-11-10 23:31 UTC

怎么上手

由 README 提炼,执行前请确认
pip install -U airtest
cd {your_python_path}/site-packages/airtest/core/android/static/adb/mac && chmod +x adb
硬件要求按 README 说明

README 未说明具体硬件要求;支持 Android、iOS 设备与 Windows 应用,Android 通过 ADB 连接。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

跨平台 UI 自动化框架,用图像识别定位元素,无需注入代码即可自动化游戏和 App

基于图像识别和 Poco 控件识别的跨平台 UI 自动化测试框架,用 Python 脚本驱动 Android、iOS、Windows 上的游戏和应用做自动化测试。

核心能力

  • 用图像识别定位 UI 元素,无需向游戏或 App 注入代码
  • 提供跨平台 API,覆盖安装、模拟输入、断言等操作
  • 支持通过命令行或 Python API 在设备集群上批量运行用例
  • 生成含详细信息和录屏的 HTML 报告,便于定位失败点
  • 配套 AirtestIDE 图形工具,覆盖创建、运行、报告全流程

容易踩的坑

MacOS/Linux 下需手动给内置 adb 加可执行权限;GUI 工具 AirtestIDE 需从官网单独下载,不在 pip 包内;图像识别依赖预先截取的模板图片,用例需自行准备素材。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v1.4.3
  1. v1.4.3最新正式版2025-12-04 · 2025-12-04 07:11 UTC

    锁定facebook-wda版本

  2. v1.4.22025-12-03 · 2025-12-03 11:35 UTC
    查看更新说明
    1. 支持ios17以上设备
    2. ios增加screen_size接口,替代原有window_size
  3. v1.3.62025-08-12 · 2025-08-12 03:31 UTC

    这个版本没有写更新说明。

  4. v1.3.52024-09-26 · 2024-09-26 06:57 UTC

    这个版本没有写更新说明。

  5. v1.3.42024-04-30 · 2024-04-30 07:18 UTC
    查看更新说明

    ADD:

    • 增加了minicap对于Android 14版本的支持

    ADD:

    • Added minicap support for Android 14 version.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    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

    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.

    Thanks

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