Today I want to tell you about a fairly new open-source tool for automated testing called Airtest . In the future I will make a few more articles with a detailed story about the individual elements of this toolkit and how to work with them, and now I have the goal of introducing you to it and giving a general idea of ​​it.
AirTest IDE was developed by NetEase and is designed for "hard-to-automate" applications, such as, for example, games. Actually they are the main focus of the developers, although this does not stop using AirTest for any other applications.
AirTest IDE runs on Windows, MacOS X and Linux and contains 2 frameworks: AirTest and Poco. This development was presented by Xin Liu at the Android Game Developer Summit 2018 . Python 2.7 and Python 3.3+ are used to write tests. Such important things as support for running tests immediately on a large number of devices, open source code and free application, as well as easy written tests - these are the advantages that are highlighted by developers. The application can be used on both Windows and MacOS and allows you to automate applications from the following OS: Windows, iOS, Android.
The AirTest Project on GitHub contains 4 projects: Airtest , Poco , iOS-Tangent , multi-device-runner .
It is also worth mentioning that NetEase provides its physical device farm for automated testing called AirLab .
Briefly about frameworks.
Airtest is an image recognition cross-platform framework for mobile games and applications based on image thersholding . AirTest IDE allows you to interact with the application using the following commands:
touch, wait, swipe, exists, text, keyevent, snapshot, sleep, assert_exists, assert_not_exists, assert_equal, assert_not_equal. I will talk about the features and parameters of the commands in a separate article devoted to a more detailed study of AirTest and Poco frames. Now it’s worth mentioning that the keyevent command is responsible for “pressing the physical buttons” of the device, such as Home, Power, Menu, Back. When using most commands, the user is prompted to highlight a part of the screen of the working device, a screenshot of which will be used for the corresponding command (touch, swipe, assert, etc.).
The advantages of Airtest that I can highlight after work:
Cons of Airtest, which I can highlight after work:
Poco is a universal framework for automating the user interface (UI), which provides powerful APIs independent of the (game) engine. Those, in turn, retrieve the hierarchy of the UI elements at runtime. Thanks to this, the user can "reach" the entire element hierarchy on the current page in a few clicks to the element he needs, etc. Also, this framework allows you to “freeze” the current screen for writing code based on the hierarchy of elements of the current window. Poco is designed to help AirTest understand what kind of UI element the tests are talking about, but no one bothers you writing all the tests using only this framework.
All tests are written in Python. Command implementations can be found in the corresponding APIs: airtest.core.api module , airtest.core.android package , airtest.core.ios package , airtest.core.win package
Poco advantages that I can highlight after work:
Poco cons that I can highlight after work:
To complete the picture, it is worth mentioning that Airtest IDE has its own Selenium plug-in , with which you can automate your web project, but using only a Chrome browser. The rest, at the moment, are not supported. Personally, I have not worked with him yet, so I can’t say about his work, but it was impossible to miss him in this brief description.
As a result, I would say that AirTest IDE is a very promising development that is designed to automate the UI in games, but, at the moment, is not suitable for testing the game process as such. If you have a lot of UI elements and / or many devices to check and you do not want to spend a lot of man-hours, then this IDE may well become your lifesaver. To start writing simple tests, you do not need deep knowledge in automation and programming, just have a basic understanding of working with Python. Of course, this way you will not go far and you will have to learn this programming language, but to start and understand how realistically this program suits you, it’s enough for your eyes. The only thing that is frustrating now is various annoying errors associated with, for example, the inability to resize a window with a working device (Windows application) after embedding it, overlapping a large selected object of the main program interface, etc., but it’s quite possible come to terms, especially considering the fact that the application is in Beta stage.
Source: https://habr.com/ru/post/461773/
All Articles