Detailed use of Airtest

Airtest is a cross-platform UI automation testing framework open sourced by NetEase.

The project is divided into four parts: AirtestIDE, Airtest, Poco, and Testlab. Based on python scripts, it is used for automated testing of web, windows programs, and apps.
AirtestIDE: A cross-platform UI automated test editor with built-in Airtest and Poco related plug-in functions, which can be used to quickly and easily write scripts;
Airtest: is a cross-platform, image recognition-based UI automation test framework, suitable for games and App testing currently supports Windows, Android, and IOS platforms. Principle: Use screenshots to find matching pictures in the displayed mobile interface;
Poco: An automated testing framework based on UI control recognition, currently supports Unity3D/ cocos2dx-*/Android native app/iOS native app/WeChat applet, you can also access poco-sdk in other engines to use. Principle: similar to appium, an automated testing framework based on UI control search, locate the target control, and then Call the function method to operate the target control.

Airtest environment construction

Since the Airtest framework is developed based on the python language, it is necessary to build a python-related environment locally, and python3 is recommended.
1. Python (2.7 or <=3.6) download address: https://www.python.org/downloads/
2. AirtestIDE client download: http://airtest.netease.com
3. Airtest framework installation: pip install- U airtest 4.
Poco framework installation: pip install pocoui
AirtestIDE tutorial and documentation: http://airtest.netease.com/docs/cn/index.html
Open AirtestIDE, download and unzip, double-click AirtestIDE.exe to run

1. Install AirtestIDE first

AirtestIDE download address

I downloaded the 1.2.5win version. After downloading, unzip it and install it directly, and log in with the github account

After double-clicking, enter the airtest page

The premise is that you need to install the Android SDK and configure the environment variables. I will not introduce it here. The previous blog has written how to configure it.

There are two ways to connect to the phone:

One is to connect the phone directly to the computer by wire

The second is wireless connection, which must be in a local area network

I have used a wired connection method. Through the adb command, it can be seen that the phone has been successfully connected.

Then click the red box in the upper corner to connect.

There are two ways to write a script. One is through the auxiliary box on the left. After clicking the auxiliary box on the left, the clicked box is drawn on the phone screen on the right. This is the same for each step, borrowing the actions on the left.

The second way is to directly record and click the red box on the right to start recording, and then operate the page on the left, such as an order process, the script window will automatically record each step of the action. Then visit this script back.

Finally, you can view the report.

 

Guess you like

Origin blog.csdn.net/qq_30353203/article/details/108841524