Mastering Airtest: No‑Code Automation for Android & iOS Testing

This guide walks you through what Airtest is, how to install it, connect devices, use its visual interface for basic operations, and follow a step‑by‑step example that records actions and generates runnable test scripts for Android and iOS apps.

FunTester
FunTester
FunTester
Mastering Airtest: No‑Code Automation for Android & iOS Testing

Overview

Airtest is a visual UI automation framework for Android, iOS and Windows. It enables test creation through point‑and‑click recording, supports assertions, screen recording and runs on a free IDE.

Installation

Download the latest 1.2.x package from http://airtest.netease.com/ (no .exe installer).

Unzip the archive and launch AirtestIDE.exe.

Login is optional; the IDE can be used without an account.

Device Connection

Before connecting, ensure the device driver is installed, adb recognizes the device ( adb devices shows it), and no other process holds the ADB server. In the IDE, select the Android option (iOS requires a separate setup). Successful connection displays device information on the right panel.

Core Operations

Airtest provides the following actions, which can be recorded and later edited as Python code:

Click / double‑click

Swipe / pinch (multi‑finger)

Text input

Sleep (delay)

IDE Layout

The main window consists of a menu bar, a central code editor, a device panel on the right and a toolbar at the bottom left. Important toolbar buttons:

Lock – locks the current device view so subsequent actions affect only that screen.

Package info – shows the package name of the selected app.

Record – starts visual recording; after stopping, the generated script appears in the editor.

Practical Example

Step 1 – Create a Project

Click “New Project”. The IDE creates a default script file (e.g., test_demo.air) with basic imports.

Step 2 – Select Android Device

Choose the Android option in the lower‑left toolbar and confirm the “yes” prompt. The device panel shows the connected phone.

Step 3 – Record a Click

Press the “Touch” button, then click the Chrome icon on the device screen. Airtest records the action and inserts a line such as:

touch(Template(r"chrome_icon.png"))

Step 4 – Interact with the Address Bar

Use wait to ensure the address bar appears, then click it, pause, and input a URL. Example script fragment:

wait(Template(r"address_bar.png"), timeout=10)
touch(Template(r"address_bar.png"))
sleep(1)
text("https://www.baidu.com")

Step 5 – Run the Script

Press the Run button. The log window shows each step, and the device opens the target page, confirming the script works.

Key Considerations

Always verify that the device is recognized by adb before starting the IDE.

Use wait or explicit sleep to handle UI loading delays.

Image‑based selectors (templates) must be captured at the same resolution as the test device.

The lock icon is useful when multiple devices are connected to avoid cross‑device actions.

Conclusion

Airtest provides a “record‑and‑play” workflow that generates Python scripts without manual coding. It is suitable for quick functional UI tests on mobile devices, though more complex scenarios may require direct script editing or integration with other frameworks.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

iOSAndroidUI automationmobile testingAirtestno-code testing
FunTester
Written by

FunTester

10k followers, 1k articles | completely useless

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.