Airtest-UI, the master of automation
I. Introduction
Airtest is a Python-based, cross-platform UI automated testing framework developed by NetEase. Based on the principle of image recognition, it is suitable for games and apps.
The project is currently open sourced on Github:
https://github.com/AirtestProject/Airtest
Official website address:
http://airtest.netease.com/
The official documentation manual is very detailed, and it is recommended that you start by looking at the relevant documentation.
2. Why do we need Airtest
As we all know, UI layer testing is divided into Windows, Linux, Android, Web, applets, etc. according to the type of platform.
For mobile Android & IOS platforms, there is the most popular Appium testing framework
http://appium.io/
Selenium testing framework on the web
http://seleniumhq.org/
Windows application platforms include AutoIT and Pywinauto
However, the industry does not have a better solution for game applications, and the Airtest test framework came into being, based on the underlying Airtest and poco:
◆ Airtest: Python-based, cross-platform UI automated testing framework, based on the principle of image recognition, suitable for games and apps.
◆ Poco: An automated testing framework based on UI control search. Its core advantage is that in addition to Android and IOS, it also supports games, as well as WeChat mini programs, WeChat mini games and H5 applications.
Airtest is also very intimately equipped with Airtest IDE, which can record the script without writing a line of script.
Three, Airtest IDE recording
Record Android platform automation script
step1 Check the device link status
Locally installed lightning simulator
step2 Airtest IDE connection device
You can see that Airtest can directly map the device screen, which is different from Appium's inspector or UIAutomatorViewer.bat tool
step3 Record script
Click to record to start the recording function, and provide many different element operations, such as: click, wait, slide, assert, etc.
Here, take the Lemon Class App as an example to record the login test case
Recording and playback
Airtest adopts an image recognition method, which is more suitable for game automation, but there are some problems in script compatibility (screen resolution, icon size, etc.).
The official also gave a few small tips:
1. Improve screenshot skills-try to take screenshots of complete pictures
2. Adjust the image recognition threshold
3. Use gray-scale image recognition
These methods can only be optimized as much as possible, and cannot be solved fundamentally, so the official final recommendation is to use poco as much as possible: positioning by UI element attribute information
四 、 LITTLE
Airtest provides another more robust element operation method-based on the UI control search framework poco
You can see that the poco model is more suitable for company projects. If you know Python yourself, you can continue to expand on the basis of scripts.
For example: application of PO design pattern, layered design and so on.
Recommend a software testing learning exchange group: 785128166, there are shared videos, interview guidance, test materials, mind maps, and videos in the group. They are all dry goods, you can download and watch. Mainly share test foundation, interface test, performance test, automated test, TestOps architecture, Jmeter, LoadRunner, Fiddler, MySql, Linux, resume optimization, interview skills, and actual video data of large-scale test projects. Use every minute and every second of your time to learn to improve yourself, and don't use "no time" to conceal your mental laziness! Try hard while you are young, and give your future self an explanation!
Public number: Programmer Erhei, after paying attention, you can receive a large amount of learning materials for free.
Good things should be shared with friends