Netease UI automation test exploration: Airtest+Poco

1. Automated testing

The purpose of automated testing is to find product problems "faster and better" and effectively improve product quality. Currently, mainstream automated testing includes unit test automation, interface automation, and UI automation.

Compared with interface automation testing, the cost of UI automation testing is much higher, because it directly faces the terminal interface, and this adjustment may be very frequent, resulting in higher maintenance costs of UI automation test scripts.

However, compared to NetEase games, which have many large-scale game projects, UI automation testing is also very necessary. Although the interface has been adjusted, the cycle of large-scale projects is usually relatively long. During this period, frequent regression testing of many functions is required. Automation has become an effective means to improve testing efficiency and reduce work costs.

2. The development history of the Airtest project

In 2014, there was no automated testing framework suitable for game projects on the market, so NetEase's self-developed AirtestProject was launched.

AirtestProject mainly includes two UI automation testing frameworks, Airtest and Poco. After successfully serving dozens of project teams within NetEase, it was invited to jointly release it with Google at the 2018 GDC conference. Since the project is open source, it has been used by hundreds of thousands of developers and thousands of companies.

3. The pain points that the Airtest project wants to solve

AirtestProject mainly wants to solve two pain points of UI automation testing, one is the problem of poor platform versatility, and the other is the problem of high barriers to entry.

Poor platform versatility means that some test frameworks are not suitable for testing products on all platforms, including Android, iOS, and various game engines; Airtest and Poco, both self-developed by Netease, are cross-platform test frameworks. Airtest uses the principle of image recognition. Be platform-independent, Poco supports native and engine-independent

The threshold for getting started is high, which means that some test frameworks need to build a complex test environment, and testers also need to have certain code programming skills and read very detailed documents to get started. AirtestIDE, the dedicated editor for Airtest and Poco, provides script recording and playback functions. Testers can record and run automated scripts with one click without writing their own code, which greatly reduces the threshold for writing automated test scripts.

4. Detailed introduction of the Airtest project

The Airtest project mainly includes 2 automated testing frameworks, and a dedicated editor AirtestIDE:

1) Airtest automated testing framework based on image recognition

The Airtest automated test framework based on the principle of image recognition, what you see in the script is what you get, common operations such as clicking, sliding, waiting to appear, assertion, etc.
In addition, the Airtest framework is compatible with various environments, and can be applied to all platforms without embedding code, which can help projects quickly realize automation.

2) Poco automated testing framework based on control identification

The Poco automated testing framework based on the control identification principle can accurately identify and locate each UI control on the interface; and can obtain detailed properties of the control in real time, making it easy to click, slide, and other operations on the control.

In addition, the iteration of the project interface has very little impact on the original Poco script, because there are relatively few changes to the controls on the page, so testers do not need to spend too much energy maintaining the Poco script.

3) Dedicated editor AirtestIDE

In order to lower the threshold for writing automated scripts, we have also developed a supporting editor for Airtest and Poco frameworks, which can help us easily connect devices on various platforms, and support one-click recording and playback of automated test scripts:

The main functions it provides are:

① Devices connected to various platforms

In the device connection window of AirtestIDE, it supports connecting Android, iOS devices and Windows windows, and you can view the device screen and operate the device in real time.

② One-click recording and playback of scripts

AirtestIDE supports functions such as one-click recording of Airtest and Poco scripts, one-click running of scripts (playback), and one-click viewing of test reports.

③ Simply drag and drop to complete the screenshot script
Click the API shortcut function of the Airtest auxiliary window to complete our Airtest screenshot script by simply clicking and dragging.

④ View the control tree of the device in real time
We can view the current control tree of the device in the Poco auxiliary window, and as we operate the device screen, the control tree in the auxiliary window will also be refreshed in real time. At present, it supports viewing the control tree of Android and iOS native applications, and the control tree of various game engine rendering applications such as unity and cocos. In the future, we will also support viewing the control tree information of Windows and Mac desktop applications.

Finally : In order to give back to the die-hard fans, I have compiled a complete software testing video learning tutorial for you. If you need it, you can get it for free【保证100%免费】

Software Testing Interview Documentation

We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Ali, Tencent, and Byte, and some Byte bosses have given authoritative answers. Finish this set The interview materials believe that everyone can find a satisfactory job.

全部资料获取:

insert image description here

Guess you like

Origin blog.csdn.net/weixin_54696666/article/details/131543388