Skip to content

I. Introduction to Airtest

Note

​ This document is a supplement to the Airtest framework and will provide a detailed introduction to Airtest and its scripts writing techniques. Please refer to the Airtest project documentation for more detailed information on API during you script writing process.

1.Introduction to Airtest

Airtest is a cross-platform automated testing framework for UI, based on image recognition technologies, suitable for games and apps. The following are the links to Airtest related documents:

  • Airtest source code
  • Submitting bugs/suggestions for Airtest project
  • Airtest API query documentation

2.The Essence of Airtest

Airtest is essentially a third-party library for Python, similar to other Python third-party libraries. In the IDE usage document, we provide detailed instructions on how to use to create and run Airtest scripts with AirtestIDE which has a built-in Python environment where Airtest and other third-party libraries are already imported and available for immediate use.

So, you don't need to rely on AirtestIDE to write or run Airtest scripts but can do it on other Python editors. It should be noted that before writing or running Airtest scripts on other editors, make sure to install the Airtest library in the current project's Python environment:

pip install airtest

3.Support Status of Airtest

1) Devices supported by Airtest

  • Android (real device and emulator)
  • iOS (real device)
  • Windows (window and desktop)

2) Python versions supported by Airtest

3.0≤Python≤3.9 (Some old versions of Airtest support Python 2, but we do not recommend installing Airtest with Python 2 as it may result in unpredictable errors.)

3) Operating systems supported by Airtest

  • Windows
  • MacOS X
  • Linux

4) Support status of Airtest for various platforms

① Android

Most of the Android real devices and emulators on the market are supported, so are even some special devices with Android systems, such as translation pens, car computers, and tablets. If you find a device that Airtest does not support, please submit an issue to us here.

② iOS

At present, only real iOS devices are supported. The iOS emulator is not tested and may not be supported. The official iOS-Tagent by far only supports up to Xcode 12.1 and iOS 13.5.

③ Windows

Airtest supports the connection to Windows window/desktop for automated testing and provides various connection methods.

④ MacOS X

Airtest does not support the testing of applications or desktops on MacOS X. Relevant updates are expected in the future.

4.What Airtest Can Do?

1) Connect to the device to be tested

Airtest can be connected to one or multiple devices for testing, including Android devices, iOS devices, Windows apps, or Windows desktops.

2) Simulate operations on the tested devices

Airtest provides a series of cross-platform API for device operation. The following are some common ones:

  • Touch
  • Swipe
  • Text
  • Snapshot
  • Sleep
  • Assert
  • ...

3) Generate test reports

Airtest supports generating HTML-format test reports, making it convenient to view detailed information about the scripts and their execution.

5.What Airtest Can't Do?

1) Can Airtest perform API testing?

No, Airtest is a UI testing framework, rather than an API testing framework.

2) Can Airtest perform color detection?

No, Airtest is based on image recognition principles and is different from color detection tools. Currently, Airtest does not include the function of color detection.

3) Can Airtest extract text from images?

No, Airtest is not an OCR tool and cannot recognize the text in an image. It can only compare the similarity between images. However, you can take a snapshot with Airtest and use an OCR API to recognize the text in it.

4) Can Airtest get the image of the control?

No, Airtest is a non-invasive framework and cannot directly obtain images of controls inside the application, but it can take a snapshot of the entire or the partial screen.