Mobile application script test and traversal test collaboration method based on functional properties

By introducing a collaborative method of script testing and traversal testing based on functional properties in mobile application automation testing, the problem of the definition of properties in the existing technology is solved, and efficient and easy-to-use mobile application functional error detection is achieved.

CN120196551APending Publication Date: 2025-06-24EAST CHINA NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510426354.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-07
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

The existing mobile application functional properties automation testing technology has the problem that the nature definition method is not close to the tester's daily script specifications and the uncontrollable traversal engines and script engines, which raises the threshold for use and limits ease of use.

Method used

A synergy method for mobile application script testing and traversal testing based on functional properties is proposed. Combined with the client and the server, users can independently select script framework, script engine and traversal engine, so as to define the functional properties of applications under familiar script language specifications and reduce learning costs.

Benefits of technology

It realizes the advantages of efficiently covering the test space and clear direction, reducing the cost and difficulty of functional error detection of mobile applications, and is suitable for various scenarios that require high coverage and precise verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120196551A_ABST
    Figure CN120196551A_ABST
Patent Text Reader

Abstract

The invention discloses a mobile application script test and traversal test collaboration method based on functional properties, which comprises the following steps of: firstly, defining one or more functional properties by a user according to a frequently-used script engine and a script language corresponding to a script framework, and selecting a traversal engine to be used; in the testing process, logic control executed by the script is completed at the client side, an operation request is sent to the server side on the equipment, and the server side completes forwarding to the traversal engine or the script engine according to the request type. In the whole test process, the script test and the traversal test are carried out cooperatively, and the complete operation process of screenshot recording is used for generating a test defect report. The method is used for defining properties by using common script languages under a script framework familiar to a user and completing function correctness testing of the mobile application program, functional errors of the mobile application can be effectively found, and robustness and reliability of the mobile application are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of mobile software automated testing. It relates to a collaborative functional property testing method for various script engines and traversal engines. Specifically, it relates to a method for coordinating mobile application script testing and traversal testing based on functional properties. Background Art

[0002] As the core carrier of modern digital life, the event-driven characteristics of mobile applications based on graphical user interfaces have deeply penetrated into key fields such as social networking, finance, and healthcare. With the exponential growth of users' dependence on mobile services, the functional integrity of applications is directly related to the digital life experience of hundreds of millions of users, prompting leading companies in the industry to upgrade their quality assurance systems to a strategic investment direction. However, restricted by the Test Oracle problem, traditional testing methods have significant blind spots in detecting non-crash functional errors - research data shows that such errors account for up to 65.4% of mobile application defects, and existing tools can only detect approximately 30% of the crash errors among them. More severely, the fragmented characteristics of the mobile ecosystem (involving more than 5,000 Android device types and more than 20 mainstream operating system versions) further exacerbate the contradiction between test sufficiency and effectiveness. Current cutting-edge research is building a multi-dimensional testing framework through fuzz testing, metamorphic testing, and AI-driven intelligent detection technologies, and has successfully located complex functional anomalies such as privacy leaks and environment-sensitive defects that are difficult to discover by traditional methods in leading applications such as WeChat and Douyin, marking a strategic transformation of mobile application quality assurance from passive defect repair to proactive error prevention.

[0003] Although the testing method based on software functional properties solves the problems of high manual testing costs, limited coverage, susceptibility to human factors, and the fact that automated testing can only identify crash errors, it can detect complex functional problems, effectively and widely test the functional errors of mobile applications, and improve the robustness and reliability of mobile applications. However, there are problems such as the nature definition method not being close to the daily script specifications of testers, and the uncontrollability of traversal engines and script engines. To a certain extent, it raises the threshold for using this technology and limits the usability of this method. Summary of the Invention

[0004] To overcome the deficiencies of existing automated testing technologies for the functional nature of mobile applications, the objective of the present invention is to propose a collaborative method for script testing and traversal testing of mobile applications based on functional nature, which combines a traversal testing tool and a script testing tool, enabling script testing to simultaneously possess the advantages of efficiently covering the test space and having a clear directivity. The present invention is divided into a client and a server. The client is responsible for processing component information, generating a test request according to the preconditions, sending it to the server, notifying the server whether to perform script testing or traversal testing, and verifying the test nature through a property-based testing method. The server is responsible for the scheduling of the script engine and the traversal engine, receiving requests from the client and performing corresponding test work. The script testing part is mainly used to ensure the accuracy of the test and verify specific functional properties; the traversal testing part is mainly used to ensure the comprehensiveness of the test and discover potential functional errors. The present invention allows users to independently select a script framework, a script engine, and a traversal engine, enabling users to define the functional properties of an application under a script language specification they are familiar with. This greatly reduces the learning cost of technology use and can quickly introduce functional testing technology for mobile applications based on nature in actual production, thereby detecting functional errors in mobile applications at a lower cost and more effectively.

[0005] To more efficiently implement communication between the client, the server, the script engine, and the traversal engine, the present invention places the event type decision operation on the client. The client is deployed in a computer and is mainly responsible for reading the application properties defined in the script framework, making a choice between traversal and property detection after determining the satisfaction of the preconditions, and sending a request. The present invention places the event execution operation on the server. The server is mainly deployed in a mobile device and is responsible for receiving requests from the client and scheduling the script engine and the traversal engine according to the requests.

[0006] The specific technical solution for achieving the objective of the present invention is as follows:

[0007] A collaborative method for script testing and traversal testing of mobile applications based on functional nature, comprising the following steps:

[0008] Step 1: Analyze the functional characteristics and test objectives of the mobile application to be tested, select a script framework and a script engine, and use the script language corresponding to the script engine to define the set of functional properties of the mobile application to be tested. Each functional property includes preconditions , interaction scenarios and postconditions ; after defining the functional properties, set the maximum test execution duration, and select a traversal engine and an algorithm;

[0009] Step 2: Based on the traversal engine and algorithm selected in Step 1, perform traversal and property detection, record the corresponding test results and user interface screenshots until the maximum test execution time is reached;

[0010] Step 3: Automatically generate a defect report for the mobile application under test based on the test results and user interface screenshots.

[0011] Furthermore, step 2 specifically includes:

[0012] Step A1: The client reads all properties and sends a component information request to the server.

[0013] Step A2: The server sends a component scraping request to the script engine.

[0014] Step A3: The script engine receives the component scraping request, calls the underlying interface of the mobile device operating system, scrapes the component information, and returns it to the server.

[0015] Step A4: The server records the component information and returns the component information to the client.

[0016] Step A5: The client makes a precondition judgment on all properties according to the received component information. If there is no satisfied precondition, a traversal operation request is generated. If there are satisfied preconditions, a satisfied property is randomly selected and a property detection request is generated.

[0017] Step A6: The client sends the request generated in step A5 to the server.

[0018] Step A7: The server performs a forwarding operation according to the component information and the type of operation request obtained. If the request type is a traversal operation, the server calls the traversal engine to execute the traversal event. If the request type is a property detection, the server calls the script engine to execute the property detection event sequence.

[0019] Step A8: Continue to execute steps A2 to A7 until the maximum execution time is reached, and the test ends.

[0020] The beneficial effect of the test method of the present invention is as follows:

[0021] The present invention introduces a communication mode among the client, the server, the script engine, and the traversal engine. This communication mode coordinates the work of the client and the server. It allows users to independently select the script framework, the script engine, and the traversal engine, enabling users to define the functional properties of the application under the script language specification they are familiar with. This greatly reduces the learning cost of technology use and can quickly introduce property-based mobile application function testing technology in actual production, thereby detecting functional errors in mobile applications at lower cost and more effectively. It is applicable to various scenarios that require high coverage and precise verification, such as mobile application testing in industries like finance, healthcare, and education. Description of the Drawings

[0022] Figure 1It is the execution flow chart of the overall structure of the present invention;

[0023] Figure 2 It is a schematic diagram of an example of property definition using the nature of the script framework;

[0024] Figure 3 It is the communication process flow chart of the present invention. Specific embodiments

[0025] Combined with the following specific embodiments and drawings, the present invention will be further described in detail. The processes, conditions, experimental methods, etc. for implementing the present invention, except for the specifically mentioned content below, are all common knowledge and well-known common sense in the art, and the present invention has no particularly restricted content.

[0026] The present invention provides a collaborative method for mobile application script testing and traversal testing based on functional properties. After the user defines the functional properties using the script language corresponding to the commonly used script engine and script framework and selects the traversal engine, the testing process starts. The logical control of script execution is completed on the client side, and an operation request is sent to the server on the device. The server forwards the request to the traversal engine or the script engine according to the request type. The entire testing process realizes the collaborative execution of script testing and traversal testing, and captures screenshots to record the complete operation process for generating a test defect report. The overall execution flow is as Figure 1 shown, specifically including:

[0027] Step 1: Analyze the functional characteristics and test objectives of the mobile application to be tested, select a script framework and a script engine, and use the script language corresponding to the script engine to define the set of functional properties of the mobile application to be tested. Each functional property includes preconditions , interaction scenarios and postconditions ; after defining the functional properties, set the maximum test execution duration, and select a traversal engine and an algorithm;

[0028] Step 2: Based on the traversal engine and algorithm selected in Step 1, perform traversal and property detection, record the corresponding test results and user interface screenshots until the maximum test execution time is reached;

[0029] Step 3: Automatically generate a defect report for the mobile application to be tested based on the test results and user interface screenshots;

[0030] The selection of the script framework and script engine described in Step 1 can meet the daily script writing habits of testers. Complete the properties through the accustomed script syntax Define its definition, and at the same time, one or more functional properties can be defined according to requirements, set the maximum execution duration, select the traversal engine and algorithm. The functional properties of the mobile application mainly consist of three parts: preconditions, interaction scenarios, and postconditions. Specifically, it is manifested as follows:

[0031] Preconditions : Define the interface state in the traversal process where the property script can start to be executed, that is, the prerequisite for starting to perform property detection.

[0032] Interaction Scenarios : Define a series of operation steps required to verify the functional properties of the application.

[0033] Postconditions : Define the expected interface state that the mobile application needs to reach after all the operations that need to be executed.

[0034] Step 2: The test officially starts. Based on the traversal engine and algorithm selected in Step 1, the tool performs traversal and property detection, records the corresponding test results and screenshots of the user interface until the maximum test execution time is reached; in the present invention, the event type decision operation is placed on the client side, and the client is deployed in the computer, mainly responsible for reading the application properties defined in the script framework, and making a decision on traversal and property detection and sending a request after judging the satisfaction of the preconditions. The present invention places the event execution operation on the server side, and the server is mainly deployed in the mobile device, responsible for receiving the request from the client and scheduling the script engine and traversal engine according to the request. The communication process between the server and the client and the conversion of the execution rights of the traversal engine and the script engine during this execution process are as follows in detail:

[0035] Step A1: The client reads all properties and sends a component information request to the server.

[0036] Step A2: The server sends a component scraping request to the script engine.

[0037] Step A3: The script engine receives the component scraping request, calls the underlying interface of the mobile device operating system, scrapes the component information and returns it to the server.

[0038] Step A4: The server records the component information and returns the component information to the client.

[0039] Step A5: The client makes a judgment on the preconditions of all properties according to the received component information. If no preconditions are satisfied, a traversal operation request is generated. If there are preconditions satisfied, a satisfied property is randomly selected and a property detection request is generated.

[0040] Step A6: The client sends the request generated in Step A5 to the server.

[0041] Step A7: The server performs a forwarding operation based on the component information and the obtained operation request type. If the request type is a traversal operation, the server calls the traversal engine to execute the traversal event. If the request type is property detection, the server calls the script engine to execute the property detection event sequence.

[0042] Step A8: Continue to execute Step A2 to Step A7 until the maximum execution time is reached, and the test ends.

[0043] Step 3: Automatically generate a defect report for the mobile application under test based on the property detection results and the screenshots of the user interface recorded during the test.

[0044] Embodiment

[0045] In this embodiment, a popular note mobile application OmniNotes open-sourced on GitHub is used as the object, unittest is selected as the test framework, uiautomator2 is used as the script engine, and fastbot is used as the traversal engine. OmniNotes is an application for recording and managing notes. unittest is the standard unit test framework for Python, which provides functions for creating and running test cases, supports test organization, assertion, and test reports. uiautomator2 is an Android automation test script driver that allows developers to interact with and test the user interface of Android devices through Python scripts. Fastbot is a traversal engine for automated testing, aiming to quickly create and execute UI tests for mobile applications.

[0046] The event type decision operation is placed on the client side. The client side of this embodiment is jointly composed of the client module of uiautomator2 (abbreviated as u2 client) and the script framework of unittest. The client is deployed in the computer and is mainly responsible for reading the application properties defined in the script framework, and making a choice between traversal and property detection and sending a request after judging the satisfaction of the preconditions. The event execution operation is placed on the server side. The server side of this embodiment is mainly composed of the script engine of uiautomator2 and the traversal engine of fastbot. The server is mainly deployed in the mobile device and is responsible for receiving the requests from the client and scheduling the script engine and the traversal engine according to the requests.

[0047] Here, a specific description of a collaborative method for script testing and traversal testing of mobile applications based on functional properties is given through this embodiment:

[0048] Step 1: Use the unittest test framework and uiautomator2 as the script engine to define the properties of the software Use uiautomator2 as the script engine. The common event operations mainly include the content shown in Table 1.

[0049] Table 1 Common Event Types

[0050]

[0051] Select a property of OmniNotes: Rotate the screen in the search interface and then rotate it back, the search box should remain present.

[0052] For this basic function, use the script language to define the functional property that "after rotating the screen and then rotating it back in the search interface, the search box should still be present". Prerequisites are that when the application state is in the search interface, that is, the search box exists on the interface. In addition, in this scenario, the influence of the semi-screen pop-up window bar covering the search box needs to be excluded, and a condition item of "the'settings' button does not exist" needs to be added to the prerequisites. Interaction Scenario is to rotate the screen and rotate back. Postconditions are the expected results after rotating the screen and rotating back, that is, the search box should still be present. The specific method of defining properties using the unittest test framework and uiautomator2 as the script engine is as Figure 2 shown.

[0053] Step 2: Based on the traversal engine and algorithm selected in Step 1, perform property detection, record the corresponding test results and user interface screenshots until the maximum test execution time is reached; with the support of the uiauromator2 script engine and the fastbot traversal engine, the scheduling logic of the server can be integrated into fastbot. The specific content of the communication process is:

[0054] Step A1: The u2 client reads all properties and sends a component information request to the server.

[0055] Step A2: The server sends a component capture request to the u2 script engine.

[0056] Step A3: The u2 script engine receives the component capture request, calls the underlying accessibility interface of the mobile device operating system, captures the component information and returns it to the fastbot server.

[0057] Step A4: The server records the component information and returns the component information to the u2 client.

[0058] Step A5: The u2 client makes precondition judgments for all properties based on the received component information. If no precondition is met, it generates a traversal operation request. If there is a precondition met, it randomly selects a met property and generates a property detection request.

[0059] Step A6: The u2 client sends the request generated in Step A5 to the fastbot server.

[0060] Step A7: The server performs a forwarding operation based on the component information and the type of operation request obtained. If the request type is a traversal operation, the server calls the traversal algorithm of fastbot and uses Monkey to execute the traversal event. If the request type is property detection, the server calls the script engine to execute the property detection event sequence.

[0061] Step A8: Continue to execute Steps A2 to A7 until the maximum execution time is reached and the test ends.

[0062] Timing Figure 3 The process shown is to start testing after defining the properties. The u2 client sends a signal request for component information, "request xml", to the server integrated in fastbot (Step A1). The fastbot server receives this request and sends a signal of "request xml" to the u2 script engine (Step A2). The u2 script engine receives the component capture request, calls the underlying accessibility interface of the mobile device operating system, captures the component information and returns it to the server integrated in fastbot (Step A3). The server records the component information and returns the component information to the u2 client (Step A4). After receiving the component information, the u2 client determines that no precondition is met and generates a traversal operation request (Step A5). The u2 client sends the traversal operation request to the fastbot server (Step A6). The server receives the traversal operation request, calls the traversal algorithm of fastbot and uses Monkey to execute the traversal event (Step A7).

[0063] Then, the server continues to send a component capture request to the u2 script engine (Step A2). The u2 script engine receives the component capture request, calls the underlying accessibility interface of the mobile device operating system, captures the component information and returns it to the server integrated in fastbot (Step A3). The server records the component information and returns the component information to the u2 client (Step A4). After receiving the component information, the U2 client determines that there is a precondition met and generates a property check request (Step A5). The U2 client sends the property check request to the fastbot server (Step A6). The server receives the property check request and forwards it to the u2 script engine to perform the property check (Step A7). Then, continue to loop and execute Steps A2 to A7 until the maximum execution time is reached and the test ends.

[0064] Step 3: After the test, based on the property detection results and the screenshots of the user interface recorded during the test, automatically generate a defect report for the mobile application under test.

Claims

1. A method for coordinating mobile application script testing and traversal testing based on functional properties, characterized in that: The following steps are involved: Step 1: According to the functional logic of each module of the mobile application, sort out the application functions that need to be tested; select the script framework and script engine and use the script language corresponding to the script engine to define the functional property set of the tested mobile application, set the maximum test execution time, and select the traversal engine and algorithm; each functional property includes preconditions, interaction scenarios and postconditions; Step 2: Based on the traversal engine and algorithm selected in step 1, perform property detection and record the corresponding test results and user interface screenshots until the maximum test execution time is reached; Step 3: Automatically generate a defect report for the tested mobile application based on the test results and the user interface screenshots; wherein: The step 2 specifically includes: Step A1: The client reads all properties and sends a component information request to the server; Step A2: The server sends a component fetching request to the script engine; Step A3: The script engine receives the component fetching request, calls the underlying interface of the mobile device operating system, fetches the component information and returns it to the server; Step A4: The server records the component information and returns the component information to the client; Step A5: The client performs precondition judgment on all properties according to the received component information. If no precondition is satisfied, a traversal operation request is generated. If a precondition is satisfied, a property that satisfies the precondition is randomly selected and a property detection request is generated. Step A6: The client sends the request generated in step A5 to the server; Step A7: The server performs a forwarding operation according to the component information and the acquired operation request type; if the request type is a traversal operation, the server calls the traversal engine to execute the traversal event; if the request type is a property detection, the server calls the script engine to execute the property detection event sequence; Step A8: Continue to execute steps A2 to A7 until the maximum execution time is reached and the test ends.

2. The method for coordinating mobile application script testing and traversal testing based on functional properties according to claim 1, characterized in that: The precondition: defines the interface state in which the property script can be executed during the traversal process, that is, the prerequisite for starting the property detection; Interaction scenarios: define the series of steps that need to be performed to verify the functional properties of the application; Postconditions: Define the expected UI state that the mobile app needs to reach after all the operations that need to be performed.