This article was first published on:Walker AI

AirtestProject is an automated testing framework, including Airtest, Poco and AirtestIDE.

Airtest is a cross-platform UI automatic test framework based on image recognition. Poco is a cross-platform UI automation framework; The AirtestIDE is a cross-platform UI automated test editor with built-in plugin functions for Airtest and Poco. Details you can refer to the official document: Airtest.doc.io.netease.com/

1. Airtest tool introduction

1.1 installation Airtest

Go to the official website to download and decompress, the path does not appear in Chinese. Decompress the software package and select airtestide. exe to start the software. Download url: Airtest.netease.com/index.html

Start the Airtest

AirtestIDE tool interface

1.2 Script Editing Window

To write scripts, you can use the preset commands of the auxiliary window.

1.3 Device connection window

Display the connected device, you can operate the phone directly in the window.

1.4 Connecting mobile Phones

Enter developer mode and open USB debug mode. You can check the device model in the device window, and the device status will be displayed as CONNECT when the mobile phone is connected to the computer. Tap the device model to display the content on the phone screen in real time.

1.5 Airtest Auxiliary box

The command explain
touch Click on the location
wait Wait for the specified picture to appear to proceed to the next step
swipe sliding
text Text input
keyevent Key input, including HOME/BACK/MENU, etc.
snapshot screenshots
sleep Wait for specified time

1.6 Poco Auxiliary subracks

The default is Stop. You can choose different platforms. To use Poco, you need to install Poco on your computer and integrate the POco-SDK into your game. Poco’s UI rendering tree functionality cannot be used if the POco-SDK is not integrated into the project.

As shown in figure:

The permissions and Settings required to connect to Airtest vary from brand to brand. Take Xiaomi mobile phone as an example: In developer mode, you need to enter the Developer option and open USB debugging, while USB installation (affecting users to install applications from the PC to the mobile) and USB debugging (safe mode) (affecting developers to execute automatic scripts) require you to log in to xiaomi account. Specific equipment special problems can look at the official documentation: Airtest.doc.io.netease.com/IDEdocs/dev…

To connect to the emulator, open USB debugging on the emulator, then connect using a remote device, type ‘ADB connect 127.0.0.1:’, and add the port number used by the corresponding emulator to connect.

2. Use the Airtest tool

2.1 Use Airtest framework for testing

Click on the file in the upper left corner to create a new script, either air or py. Enter the script in the script edit window and use the controls of the Airtest helper window. After the test, press CTRL +L to view the report.

2.2 Testing Web applications using the Selenium framework

You are advised to use Chrome. You need to download the Chrome Driver and install it in the corresponding installation path at the same level as the EXE file.

Script design:

From Selenium import webDriver # import time # import webDriver = webdriver.chrome () # rename driver.get(" url ") # open the corresponding urlCopy the code

Element positioning:

The command explain
find_element_by_id() Search by ID
find_element_by_name() Search by name
find_element_by_class_name() Search by class name
find_element_by_link_text() Search by connection text
find_element_by_tag_name() Search by tag name
find_element_by_xpath() Search by path
find_element_by_css_selector() Search by CSS selector

Keyboard operation:

The command explain
send_keys(Keys.BACK_SPACE) The delete key
send_keys(Keys.SPACE) The blank space key
send_keys(Keys.TAB) The TAB key
send_keys(Keys.ESCAPE) The back button
send_keys(Keys.ENTER) The enter key
send_keys(Keys.CONTROL,’a’) select all
send_keys(Keys,’c’) copy
send_keys(Keys,’x’) shear
send_keys(Keys,’v’) paste

2.3 Use Poco to test mobile app applications

Open the developer mode and USB debugging on the mobile phone, and install the corresponding Poco program. The emulator uses ADB connections. You can view it in the device window after connection. Select Android in the Poco window, the script editing window will be prompted to load the Poco library, select Yes to load the library.

Edit the script


PS: more dry technology, pay attention to the public, | xingzhe_ai 】, and walker to discuss together!