Youku quality assurance series (2) – basic ability construction of client automation test


Reading guide for entertainment girls
In the process of automatic test capability building, the selection of automation framework, the core and idea of framework design, and the access of automation capability platform are important links in the process of automatic test capability building. This article shares the experience in the process of building Youku app automatic testing capability
This series of articles will be published one after another, interested friends continue to pay attention!


With the acceleration of mobile version iteration, fast testing and fast feedback has become a normal process. With the increase of release frequency in the cycle, the time of various tests is sharply shortened, and the task of regression is constantly full. Regression testing is needed in all stages to ensure the correctness of each module after integration.

In the current regression test, we mainly focus on the following pain points

  • It is difficult to complete a large number of regression cases in a short period of time because the primary and secondary of test regression is fuzzy and the key content of regression cannot be grasped
  • Most of the regression use cases are executed by hand, which leads to more repetitive work and low regression efficiency
  • Each business team has more or less some automated research and access, but the development tools themselves are all in their own way, and they do not play the role of mutual cooperation and complement, so they can not achieve the tool dividend.

Based on the automation capability of the client, the test framework is encapsulated to realize the seamless connection between script writing & execution and the platform, and the platform automation capability is implemented in combination with the business scenario. At the same time, the development of the unified automation framework and the integration of the core case use cases reduce the overall regression test cost.

Basic ability of client automation

Automatic test driver selection

Youku quality assurance series (2) - basic ability construction of client automation test

How to choose an automated testing framework?

A good testing framework has the following characteristics:
Two terminal consistencyIn other words, IOS and Android can write use cases under the same framework to improve the efficiency of script development;
Operation stabilityFor the instability of UI automation itself, the framework needs to run stably to better support testing;
Easy to useThe framework access itself needs to be simple and easy to understand, reduce the threshold of entry, convenient and fast to use;
Low couplingHigh scalability refers to the ability to connect with the platform and to call scripts easily.

Design of automatic test framework

The core scenario automation structure design is mainly divided into three layers: the lowest layer is the driving ability, which provides the core driving force and operation ability, and maintains the whole case execution life cycle.

The middle layer is the framework encapsulation layer, which directly depends on the driver layer. It provides the entry of general basecase, the use of tool classes, and the abstraction of general business capabilities. The top layer is testcase, which directly depends on the framework encapsulation layer, encapsulates the business logic and the writing of testcase.
Youku quality assurance series (2) - basic ability construction of client automation test
The frame layer structure is mainly divided into four parts

  • The first part is framework_ Core, which is mainly extended around basecase. Basecase, as the entrance of the framework, is the parent class of all cases and holds the driver object according to the life cycle of the framework
  • The second part is device_ Config, which mainly initializes some devices and configuration information, such as deviceid, pkgname, etc
  • The third part is utility, which is the encapsulation of tool class, including image related processing and routing jump function. The purpose of rich util classes is to make the verification of test cases more comprehensive and accurate.
  • The fourth part is report. This part is mainly about the generation of test report and the generation of standardized report results of docking platform

Framework log system & check system & basic operation encapsulation

The framework also encapsulates a complete log system, which is mainly used to trace the test process and generate test reports. The log system mainly includes:

  • Add case step
  • Add screenshot
  • Add verification point
  • Add action

In addition to the log system, business Logic also encapsulates the check system. The check system mainly includes element check and page layout check. The check contents include whether the check element is empty, whether the string is equal, whether the element text is empty, and the similarity between two pictures. A perfect check system can increase the verification content of case, which is more suitable for the use of UI automation than assertion.

The framework also encapsulates the basic operation of baseoperation. For example, pageswipe will slide the page according to the screen size to ensure that the sliding range of case on different devices is the same. Modulswipe can slide according to the range of incoming elements. The input parameters include sliding direction, sliding range and sliding times, The basic operation content is provided to facilitate the call of the upper script more smoothly.

Image recognition ability

With the improvement of the basic capabilities of the framework, only to meet the traditional UI automation has limited the coverage of automation itself, and the limitations are also relatively large. At present, we can make the traditional UI automation extensibility better through the supplement of data and image.

On the data side, it mainly refers to some input data content of automatic test, such as the setting of mock data. On the other hand, it is image. The automatic test framework also encapsulates the image related API for supplement and improvement.

In terms of images, the framework also has the ability of screenshot processing. For example, the function of screenshot marking can improve the test report and enhance the means of investigation, as shown in the figure below. When the check element is passed in, the screenshot image will be automatically marked with the verified area or element. The framework also supports the ability of image clipping, which is mainly convenient to support regional OCR recognition and image similarity Verification of comparison. Finally, it also supports the ability of image flipping, which is mainly to solve the problem of incorrect screenshots after the iPad screen is turned, which affects the accuracy of image recognition.

Youku quality assurance series (2) - basic ability construction of client automation test

Access to automation capability platform

Automatic test scheme

Youku quality assurance series (2) - basic ability construction of client automation test

Automatic execution result display

one . The test result page supports the display of test duration, test case set, number of test cases, number of successful and failed cases, and pass rate. See the following figure for details:
Youku quality assurance series (2) - basic ability construction of client automation test
Youku quality assurance series (2) - basic ability construction of client automation test
2. Other supporting functions of test report:

  • Testcase dimension crash analysis results and crash.log download
  • Failure cases support bug submission
  • Failure case also supports failure screenshot + failure trace information display

As shown in the figure below:
Youku quality assurance series (2) - basic ability construction of client automation test

Future planning

The platform has achieved certain results in the basic ability construction of client automation testing. With the continuous access and use of business, the overall regression efficiency and labor cost savings have been significantly improved.

However, there will be more challenges in the future. In the future, we will focus on the construction of image ability combined with the automation platform to produce more valuable automation test solutions.

Youku quality assurance series (2) - basic ability construction of client automation test

Recommended Today

Review of SQL Sever basic command

catalogue preface Installation of virtual machine Commands and operations Basic command syntax Case sensitive SQL keyword and function name Column and Index Names alias Too long to see? Space Database connection Connection of SSMS Connection of command line Database operation establish delete constraint integrity constraint Common constraints NOT NULL UNIQUE PRIMARY KEY FOREIGN KEY DEFAULT […]