Skip to content

I. Introduction to Poco

Note

This document is a supplement to the Poco framework and will provide a detailed introduction to Poco scripts and their writing techniques. During the script writing process, please refer to the Poco project documentation for more detailed information on APIs.

1.Introduction to Poco

Poco is a cross-platform automated testing framework based on UI control search principles. It is suitable for Android, iOS native apps, and various mainstream game engines. Unlike Airtest, which is based on image recognition, Poco can obtain and operate nodes using a similar method to poco("OK").click().

image

The following are links of the Poco-related documents:

2.The Essence of Poco

Like the Airtest framework, Poco is actually a third-party library for Python. We are able to record, write, and run Poco scripts in AirtestIDE because the Python environment that comes with AirtestIDE already has pocoui installed.

If you need to write or run Poco scripts outside of AirtestIDE, all you need to do is prepare a local Python environment and install pocoui in that environment:

pip install pocoui

Note

​When installing the Poco framework in the local Python environment, please note that the library name for the framework is pocoui. Do not install both Poco and pocoui at the same time as it may cause conflicts. Also, if the Airtest framework is not installed before, it will be installed together with the Poco framework.

3.Support Status of Poco

Most platforms need to be integrated with the Poco-SDK before using Poco on them. However, some platforms (such as native Android apps and native iOS apps) are available for the immediate use of Poco. The currently supported platforms are as follows:

Platforms Airtest Poco
Native Android App Direct Use
Native iOS App Direct Use
Unity3D Poco-SDK Integration Documentation
Cocos2dx-lua Poco-SDK Integration Documentation
Cocos2dx-js Poco-SDK Integration Documentation
cocos-creator Poco-SDK Integration Documentation
Egret Poco-SDK Integration Documentation
UE4 Poco-SDK Integration Documentation
Other engines Can Be Self-Connected
WeChat Applet&webview Reference Documents (May become invalid with WeChat updates.)
Windows Currently only game windows that have integrated PocoSDK are supported.
MacOS Under development, please stay tuned.
Netease NetEase Internal Engine Help Documentation

More platforms are being added to the list. If there is a need for platform support, you can submit an issue on Poco-Github, or contact us.

4.Poco Trial Demo

As the SDK integration process is quite complicated, we have provided several simple demo examples on different platforms for you to download and get familiar with Poco. Please visit the Poco Examples and Tutorials page for more details.

5.How does Poco obtain information of controls for applications on various platforms?

1) Android

To obtain information on native controls on the Android platform, we must install pocoservice.apk on our Android device. (If pocoui version is lower than 1.0.84, then two pocoservice apks are required to be installed.) This application can be found in the directory of AirtestIDE:

image-20211119165145246

And the device needs to grant sufficient background activity permission to pocoservice.apk. Here are only some setting guides for common domestic mobile phone brands listed. If your phone brand is not on this list, please try to check if your phone has similar settings to the examples provided below.

  • Xiaomi: Enable Phone Manager - App Management - Permissions - Self-Start Management - PocoService, enable PocoService to self-start.
  • Huawei: Phone Manager (version greater than 8.0) - Application Startup Management - Enable PocoService to self-start and have background activity.
  • OPPO: Settings - Battery - App Power Consumption Management - Pocoservice - Enable Self-Start of the App and Full Background Activity.
  • VIVO: Battery - High Power Consumption in the Background - Enable PocoService.
  • Realme: Settings - Battery - App Power Consumption Management - Pocoservice - Enable Self-Start And Full Background Activity.
  • OnePlus: Settings - Battery - Battery Optimization - PocoService - Do Not Optimize.

2)iOS

To obtain information about native iOS controls, we need to rely on WebDriverAgent. Control operations on iOS are much slower than those on Android due to the information transmission time and operation response time restricted by WebDriverAgent. Currently, there is no good optimization solution.

3) Various game engines

Poco is able to obtain control information from various game applications because we have embedded the Poco-SDK in the game project. This enables the Poco communication service within the game to be activated when the game is launched, transmitting control information from within the game for the framework to use.

Therefore, game applications that have not integrated the Poco-SDK are unable to obtain control information because the corresponding Poco communication service has not been embedded within the game. As emphasized in the Poco-SDK integration tutorial, the Poco service must be mounted on a node that will never be destroyed. This is because once the node on which the Poco service is mounted is destroyed, the Poco communication ends, and we will be unable to obtain the control information of the game application.

6.What Can Poco Do?

Poco can help us obtain the attribute information of the controls, operate the controls, and set the text property of the controls, etc. However, operations such as connecting devices and assertions still require the use of Airtest's APIs. Therefore, in most cases, we need to use a combination of the Airtest and Poco frameworks to write automation scripts.