A mobile UI automated testing method, device and medium for hybrid development APP

By introducing Native and Webview combined element positioning programs in the UI automation test of mobile APP, the problems of poor combination flexibility in the test scenario and unstable element positioning are solved, and more efficient and reliable automated testing is achieved.

CN116302962BActive Publication Date: 2025-03-25INSPUR GENERSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310084421.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-01
Publication Date
2025-03-25
Estimated Expiration
2043-02-01

AI Technical Summary

Technical Problem

The UI automation testing of existing mobile APPs does not support test scenario extraction and arbitrary combinations, resulting in poor flexibility in test scenario combinations and single element positioning methods, resulting in inaccurate positioning or inability to find elements, affecting the pass rate of automated test cases.

Method used

Provides a mobile UI automation testing method for hybrid development APP. By creating test tasks on the automated test management platform, and using automated script task scheduler, GitLab script management server and automated script runner, combining Native and Webview element positioning programs, the flexibility and reliability of element positioning are achieved.

Benefits of technology

It realizes flexible combination of test scenarios and reliability of element positioning, improves the efficiency and pass rate of automated testing, and reduces the cost of manual troubleshooting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116302962B_ABST
    Figure CN116302962B_ABST
Patent Text Reader

Abstract

The present application discloses a mobile UI automated testing method, device and medium for hybrid development APP. The method includes: the automated testing management platform creates a test task according to the preset automated testing requirements, and sends it to the automated script task scheduling machine; the automated script task scheduling machine forwards the test task to the automated script running machine to be executed according to the name of the automated script running machine to be executed contained in the test task; the automated script running machine to be executed pulls the script to be executed in the GitLab script management server; the automated script running machine to be executed converts the script to be executed into a test command and sends it to the mobile device, so that the mobile device locates the program based on the Native and Webview combination elements in the test command, and completes the test task for the mobile UI in the mobile terminal. The present application solves the technical problems of poor flexibility in the combination of test scenarios and single element positioning method in the current mobile APP UI automated testing through the above method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software testing technology, and in particular to a mobile UI automation testing method, device and medium for hybrid development APP. Background Art

[0002] With the further development of IT technology, the application of mobile APP has developed rapidly, and APP has brought great convenience to people's daily life. In the era of pursuing efficiency, hybrid APP development has emerged, which has absorbed the advantages of native system and H5 page development, saved development costs and improved development efficiency.

[0003] Before the hybrid development APP goes online, strict testing is required. With the continuous iteration of versions, mobile UI automated testing is essential to reduce labor costs. However, the current UI automated testing of mobile APPs does not support the extraction of test scenarios and the functions of arbitrary combination, resulting in poor flexibility in the combination of test scenarios; lack of task scheduling mechanism for mobile devices, all models must execute automated scripts each time the automation is run, and models cannot be freely selected according to needs, and the script execution time is long; the element positioning method is single, and the same element positioning method may also cause inaccurate element positioning or fail to find elements in the same hardware and software environment. After the element positioning throws an exception, there is no other positioning method to solve the positioning failure problem. Ultimately, due to non-functional problems, the pass rate of automated test cases is low, the cost of manual troubleshooting is high, or the preset number of retries is used, and the script is re-run when the positioning fails, and the script execution efficiency is low; in Native mode, due to the lack of unique attribute identification, the positioning method of some elements is cumbersome, and the script development cost is high; in the case of script execution failure, the problem cannot be quickly located. Summary of the invention

[0004] The embodiments of the present application provide a mobile UI automation testing method, device and medium for a hybrid development APP to solve the following technical problems: the current UI automation testing of mobile APPs does not support the functions of test scenario extraction and arbitrary combination, resulting in poor flexibility in the combination of test scenarios and a single element positioning method. The same element positioning method may result in inaccurate element positioning or the inability to find the element in the same hardware and software environment.

[0005] In the first aspect, the embodiment of the present application provides a mobile UI automation testing method for hybrid development APP, which is characterized in that it is applied to a mobile UI automation testing system, the system includes: an automated testing management platform, an automated script task scheduling machine, a GitLab script management server, an automated script running machine, a mobile device and a file server, and the method includes: the automated testing management platform creates a test task according to preset automated testing requirements, and sends the test task to the automated script task scheduling machine; wherein the test task includes: the name of the script to be executed and the name of the automated script running machine to be executed; the automated script task scheduling machine receives and parses the test task to execute the automated script according to the automated script task to be executed. The script running machine name is determined, the automated script running machine to be executed is determined, and the test task is forwarded to the automated script running machine to be executed; the automated script running machine to be executed pulls all the automated scripts in the GitLab script management server, and determines the script to be executed in all the automated scripts according to the name of the script to be executed determined by parsing the test task; wherein, the automated script contains a Native and Webview combined element locator; the automated script running machine to be executed converts the script to be executed into a test command and sends it to the mobile device, so that the mobile device locates the program based on the Native and Webview combined element in the test command, and completes the test task for the mobile UI in the mobile terminal.

[0006] In one implementation of the present application, Native and Webview combine element positioning programs to implement combined element positioning, and the execution process is as follows: S1: run the program; S2: in Native mode, use xpath to locate the element and determine whether an exception occurs; if no exception occurs, execute S7;

[0007] S3: After catching the exception in the except block, switch to Webview mode, and use the unique attribute identifier class to locate the element through the Webview tag; S4: Determine whether the element positioning is abnormal in the Webview native mode; if no exception occurs, execute S7; S5: The exception is captured by the function called by the previous level; S6: Trigger the exception handling function, take a screenshot, record the error stack information, and execute S8; S7: Execute the operation of filling in the reimbursement form information and saving it; S8: End the program.

[0008] In one implementation of the present application, before locating the program based on the Native and Webview combination elements in the test command and completing the test task for the mobile UI in the mobile terminal, the method also includes: adding a Webview call in the hybrid development APP, and enabling Webview debugging through a preset loading function to generate a Debug package that can be debugged by Webview.

[0009] In one implementation of the present application, before completing the test task for the mobile UI in the mobile terminal based on the Native and Webview combined element positioning program in the test command, the method also includes: writing a mode switching function and writing the mode switching program into the Native and Webview combined element positioning program.

[0010] In one implementation of the present application, before creating a test task according to preset automated testing requirements, the method also includes: the automated testing management platform reads the GitLab script management server to create selectable controls corresponding to each automated script in the automated testing management platform based on the automated scripts in the GitLab script management server; obtains device information of each automated script running machine, and based on the device information, creates selectable controls corresponding to each automated script running machine in the automated testing management platform.

[0011] In one implementation of the present application, the automation script runner is also used to write automation scripts and upload the automation scripts to the GitLab script management server; and to generate test reports based on the mobile device's test task status and upload the test reports to the file server.

[0012] In one implementation of the present application, the file server is used to receive and store test reports and operation data uploaded by the automated script runner; wherein the operation data includes at least one or more of the following: execution logs of test cases, execution failure screenshots, and stack information.

[0013] In one implementation of the present application, the automated test management platform is also used to read the test report in the file server and send the test report to the front end for display; and to view the pass rate of the test case.

[0014] In the second aspect, the embodiment of the present application also provides a mobile UI automated testing system for hybrid development APP, characterized in that the system includes: an automated testing management platform, an automated script task scheduling machine, a GitLab script management server, an automated script running machine, a mobile device and a file server; the automated testing management platform is used to create test tasks according to preset automated testing requirements, and send the test tasks to the automated script task scheduling machine; wherein the test tasks include: the name of the script to be executed, the name of the automated script running machine to be executed; the automated script task scheduling machine is used to receive and parse the test tasks, so as to determine the name of the automated script running machine to be executed according to the name of the automated script running machine to be executed contained in the test tasks. Determine a machine for running automated scripts to be executed, and forward the test task to the machine for running automated scripts to be executed; the machine for running automated scripts to be executed is used to pull all automated scripts in the GitLab script management server, and determine the scripts to be executed in all automated scripts according to the names of the scripts to be executed determined by parsing the test task; wherein the automated scripts contain Native and Webview combined element locating programs; the machine for running automated scripts to be executed is also used to convert the scripts to be executed into test commands and send them to the mobile device, so that the mobile device locates the program based on the Native and Webview combined elements in the test command, and completes the test task for the mobile UI in the mobile terminal.

[0015] In a third aspect, an embodiment of the present application further provides a non-volatile computer storage medium for automated testing of mobile UI of a hybrid development APP, storing computer executable instructions, characterized in that the computer executable instructions are set as follows: the automated testing management platform creates a test task according to preset automated testing requirements, and sends the test task to an automated script task scheduling machine; wherein the test task includes: the name of the script to be executed and the name of the automated script running machine to be executed; the automated script task scheduling machine receives and parses the test task to determine the automated script running machine to be executed according to the name of the automated script running machine to be executed contained in the test task, and forwards the test task to the automated script running machine to be executed; the automated script running machine to be executed pulls all automated scripts in the GitLab script management server, and determines the script to be executed in all automated scripts according to the name of the script to be executed determined by parsing the test task; wherein the automated script contains a Native and Webview combination element locating program; the automated script running machine to be executed converts the script to be executed into a test command and sends it to the mobile device, so that the mobile device locates the program based on the Native and Webview combination elements in the test command to complete the test task for the mobile UI in the mobile terminal.

[0016] The mobile UI automated testing method, device and medium of a hybrid development APP provided in the embodiments of the present application have the following beneficial effects:

[0017] 1. The automated test management platform can extract test scenarios and arbitrarily combine automated test scenarios according to test requirements to meet the test requirements of different test scenarios. The automated script task scheduling machine can schedule mobile devices of different models and select specified types of mobile devices for automated testing.

[0018] 2. The combination of Native mode and Webview mode for element positioning avoids unstable positioning caused by a single element positioning method, which affects the automation pass rate, improves the reliability of element positioning, and saves the cost of manual troubleshooting due to automation failures caused by non-functional errors. Testers can switch between Native mode and Webview mode as needed and choose a convenient way to position elements, which increases the flexibility of element positioning.

[0019] 3. If the combination of Native mode and Webview mode for element positioning still fails, the upper-level calling function can capture the positioning exception, take a real-time screenshot of the UI where positioning failed, record the stack information, and generate relevant test reports. Users can view specific test reports on the automated test management platform to improve the efficiency of locating problems. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0021] Figure 1 A flow chart of a mobile UI automation testing method for a hybrid development APP provided in an embodiment of the present application;

[0022] Figure 2 A schematic diagram of the structure of a mobile UI automation testing system for a hybrid development APP provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0024] The embodiments of the present application provide a mobile UI automation testing method, device and medium for a hybrid development APP to solve the following technical problems: the current UI automation testing of mobile APPs does not support the functions of test scenario extraction and arbitrary combination, resulting in poor flexibility in the combination of test scenarios and a single element positioning method. The same element positioning method may result in inaccurate element positioning or the inability to find the element in the same hardware and software environment.

[0025] The technical solution proposed in the embodiments of the present application is described in detail below with reference to the accompanying drawings.

[0026] Figure 1 A flow chart of a mobile UI automation testing method for a hybrid development APP provided in an embodiment of the present application. Figure 1 As shown, an embodiment of the present application provides a mobile UI automated testing method for a hybrid development APP, which is applied to a mobile UI automated testing system. The system includes: an automated testing management platform, an automated script task scheduling machine, a GitLab script management server, an automated script running machine, a mobile device and a file server, and specifically includes the following steps:

[0027] Step 101: The automated test management platform creates a test task according to preset automated test requirements, and sends the test task to an automated script task scheduler.

[0028] In one embodiment of the present application, before creating a test task according to the preset automated testing requirements, the automated testing management platform is also required to read the GitLab script management server to create selectable controls corresponding to each automated script in the automated testing management platform based on the automated scripts in the GitLab script management server; obtain the device information of each automated script running machine, and create selectable controls corresponding to each automated script running machine in the automated testing management platform based on the device information.

[0029] It should be noted that the automation script information required to create the selectable controls corresponding to each automation script includes: the automation script name, the automation script address; the device information of the automation script running machine includes: the running machine name, the running machine type, the bound mobile device model, and the executed automation script name.

[0030] In one embodiment of the present application, after creating selectable controls corresponding to each automation script and creating selectable controls corresponding to each automation script running machine, if it is necessary to perform automated testing on the mobile UI, select the corresponding controls according to the preset automated testing requirements to complete the creation of the test task. It should be noted that the test task will include the name of the script to be executed and the name of the automation script running machine to be executed, as well as the task name, source code library type, task execution start time, and mobile device type.

[0031] Step 102: The automation script task dispatcher receives and parses the test task to determine the automation script running machine to be executed according to the name of the automation script running machine to be executed contained in the test task, and forwards the test task to the automation script running machine to be executed.

[0032] Step 103: The to-be-executed automation script running machine pulls all automation scripts from the GitLab script management server, and determines the to-be-executed scripts among all automation scripts according to the names of the to-be-executed scripts determined by parsing the test task.

[0033] In one embodiment of the present application, the automation script also includes a Native and Webview combined element locator. Among them, the Native and Webview combined element locator is used to realize combined element locating, and its execution process is as follows: S1: run the program; S2: in Native mode, use xpath to locate the element and determine whether an exception occurs; if no exception occurs, execute S7; S3: after capturing the exception in the except block, switch to Webview mode, and use the unique attribute identifier class to locate the element through the Webview tag; S4: determine whether the element positioning is abnormal in Webview native mode; if no exception occurs, execute S7; S5: the upper level calls the function to capture the exception; S6: trigger the exception handling function, take a screenshot, record the error stack information, and execute S8; S7: execute the operation of filling in the reimbursement form information and saving it; S8: end the program.

[0034] In one embodiment of the present application, the Native and Webview combined element locator further includes a mode switching function. The switching function is as follows:

[0035] Switch to Webview mode: self.idriver.switch_to.context('WEBVIEW_com.inspur.emmcloud'), where com.inspur.emmcloud is the name of the app package;

[0036] Switch to Native mode: self.idriver.switch_to.context('NATIVE_APP').

[0037] Step 104: The to-be-executed automated script runner converts the to-be-executed script into a test command and sends it to the mobile device, so that the mobile device locates the program based on the Native and Webview combination elements in the test command, and completes the test task for the mobile UI in the mobile terminal.

[0038] In one embodiment of the present application, after the to-be-executed automated script runner converts the to-be-executed script into a test command and sends it to the mobile device, the mobile device executes the test command to obtain the test situation. Among them, the element positioning in the mobile UI automated test is completed by the Native and Webview combined element positioning program contained in the test command.

[0039] It should also be noted that the automated script runner is based on Python and Appium for script development, and uses Webview to automate the positioning of combined elements.

[0040] Hybrid development APP, part of it is the native interface and code, part of it is the embedded H5 web page, which has an embedded browser kernel and is implemented by the browser kernel. The module for displaying web content embedded in the Android application is called Webview.

[0041] The premise of using Webview automation is to add Webview calls in the APP code, call Webview by loading the function WebView.setWebContentsDebuggingEnabled(true), and generate a debug package for Webview.

[0042] Webview is divided into two cases:

[0043] 1. The Webview content does not depend on the APP in which it is located. Directly open the URL corresponding to the application in Chrome, use the browser F12 mobile mode to open the corresponding web page, and you can see the Webview tag.

[0044] 2. The Webview of the application under test interacts with the APP natively and depends on the APP. Debugging is performed through the remote debugging function of the Chrome browser. The specific method is as follows:

[0045] (1) Use the Appium DeskTop tool to connect your phone to your computer;

[0046] (2) Open the chrome browser URL: chrome: / / inspect / #devices to view the chrome version number under Webview. Place the chromedriver with the corresponding version number in the resource / drivers folder of the script project. Visit chrome: / / inspect / #devices and click inspect to view the Webview tag and develop the script.

[0047] In one embodiment of the present application, the automation script runner is also used to write automation scripts and upload the automation scripts to the GitLab script management server; and to generate test reports based on the mobile device's response to the test task, and upload the test reports to the file server.

[0048] In one embodiment of the present application, the file server is used to receive and store test reports and operation data uploaded by the automated script runner; wherein the operation data includes at least one or more of the following: execution logs of test cases, execution failure screenshots, and stack information.

[0049] In one embodiment of the present application, the automated test management platform is also used to read the test report in the file server and send the test report to the front end for display; and to view the pass rate of the test case.

[0050] The above is an embodiment of the method proposed in this application. Based on the same inventive concept, this application embodiment also provides a mobile UI automation testing system for hybrid development APP, whose structure is as follows: Figure 2 shown.

[0051] Figure 2 A schematic diagram of the structure of a mobile UI automated testing system for a hybrid development APP provided in an embodiment of the present application. Figure 2As shown, the system includes: an automated test management platform, an automated script task scheduling machine, a GitLab script management server, an automated script running machine, a mobile device and a file server; the automated test management platform is used to create a test task according to preset automated test requirements, and send the test task to the automated script task scheduling machine; wherein the test task includes: the name of the script to be executed and the name of the automated script running machine to be executed; the automated script task scheduling machine is used to receive and parse the test task, so as to determine the automated script running machine to be executed according to the name of the automated script running machine to be executed contained in the test task, and forward the test task to the The to-be-executed automation script running machine; the to-be-executed automation script running machine is used to pull all the automation scripts in the GitLab script management server, and determine the to-be-executed scripts in all the automation scripts according to the names of the to-be-executed scripts determined by parsing the test task; wherein the automation script contains a Native and Webview combined element locator; the to-be-executed automation script running machine is also used to convert the to-be-executed script into a test command and send it to a mobile device, so that the mobile device can complete the test task for the mobile UI in the mobile terminal based on the Native and Webview combined element locator in the test command.

[0052] Some embodiments of the present application provide corresponding Figure 1 A non-volatile computer storage medium for mobile UI automated testing of a hybrid development APP stores computer executable instructions, wherein the computer executable instructions are set as follows:

[0053] The automated test management platform creates a test task according to preset automated test requirements, and sends the test task to the automated script task scheduling machine; wherein the test task includes: the name of the script to be executed and the name of the automated script running machine to be executed; the automated script task scheduling machine receives and parses the test task to determine the automated script running machine to be executed according to the name of the automated script running machine to be executed contained in the test task, and forwards the test task to the automated script running machine to be executed; the automated script running machine to be executed pulls all the automated scripts in the GitLab script management server, and determines the script to be executed in all the automated scripts according to the name of the script to be executed determined by parsing the test task; wherein the automated script contains a Native and Webview combined element locating program; the automated script running machine to be executed converts the script to be executed into a test command and sends it to the mobile device, so that the mobile device completes the test task for the mobile UI in the mobile terminal based on the Native and Webview combined element locating program in the test command.

[0054] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the IoT device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0055] The system and medium provided in the embodiments of the present application correspond one-to-one to the method. Therefore, the system and medium also have similar beneficial technical effects to the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the system and medium will not be repeated here.

[0056] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0057] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0058] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0059] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0060] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0061] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0062] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0063] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0064] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A mobile UI automation testing method for hybrid development APP, characterized in that: Applied to a mobile UI automated testing system, the system includes: an automated testing management platform, an automated script task scheduling machine, a GitLab script management server, an automated script running machine, a mobile device and a file server, and the method includes: The automated test management platform creates a test task according to preset automated test requirements, and sends the test task to the automated script task scheduling machine; wherein the test task includes: the name of the script to be executed and the name of the automated script running machine to be executed; The automated script task scheduling machine receives and parses the test task to determine the automated script running machine to be executed according to the name of the automated script running machine to be executed contained in the test task, and forwards the test task to the automated script running machine to be executed; The to-be-executed automation script running machine pulls all the automation scripts in the GitLab script management server, and determines the to-be-executed scripts among all the automation scripts according to the names of the to-be-executed scripts determined by parsing the test task; wherein the automation scripts contain Native and Webview combination element locator; The to-be-executed automated script runner converts the to-be-executed script into a test command and sends it to the mobile device, so that the mobile device locates the program based on the Native and Webview combination elements in the test command to complete the test task for the mobile UI in the mobile terminal.

2. According to the mobile UI automation testing method of hybrid development APP in claim 1, it is characterized in that: The Native and Webview combined element positioning program is used to implement combined element positioning, and its execution process is as follows: S1: Run the program; S2: In Native mode, use xpath to locate the element and determine whether an exception occurs. If no exception occurs, execute S7. S3: After catching the exception in the except block, switch to Webview mode and use the unique attribute identifier class to locate the element through the Webview tag; S4: Determine whether the element positioning is abnormal in the Webview native mode; If no abnormality occurs, execute S7; S5: The exception is caught by the calling function at the previous level; S6: trigger the exception handling function, take a screenshot, record the error stack information, and execute S8; S7: Fill in the reimbursement form information and save it; S8: End the program.

3. According to the mobile UI automation testing method of a hybrid development APP according to claim 1, it is characterized in that: Before completing the test task for the mobile UI in the mobile terminal based on the Native and Webview combined element positioning program in the test command, the method further includes: Add a Webview call in the hybrid development APP, and call the Webview call through a preset loading function to generate a debug package for the Webview call to debug.

4. According to the mobile UI automation testing method of a hybrid development APP according to claim 1, it is characterized in that: Before completing the test task for the mobile UI in the mobile terminal based on the Native and Webview combined element positioning program in the test command, the method further includes: Write a mode switching function and write the mode switching program into the Native and Webview combined element positioning program.

5. According to the mobile UI automation testing method of hybrid development APP in claim 1, it is characterized in that: Before creating a test task according to the preset automated test requirements, the method further includes: The automated test management platform reads the GitLab script management server to create selectable controls corresponding to each automated script on the automated test management platform based on the automated script in the GitLab script management server; The device information of each automated script running machine is obtained, and based on the device information, a selectable control corresponding to each automated script running machine is created on the automated test management platform.

6. According to the mobile UI automation testing method of a hybrid development APP according to claim 1, it is characterized in that: The automation script running machine is also used to write the automation script and upload the automation script to the GitLab script management server; as well as, It is used to generate a test report according to the situation of the mobile device for the test task, and upload the test report to the file server.

7. According to claim 6, a mobile UI automated testing method for hybrid development APP is characterized in that: The file server is used to receive and store the test report and operation data uploaded by the automated script runner; wherein the operation data includes at least one or more of the following: execution log of the test case, execution failure screenshot, and stack information.

8. According to the mobile UI automation testing method of hybrid development APP according to claim 7, it is characterized in that: The automated test management platform is also used to read the test report in the file server and send the test report to the front end for display; as well as Used to view the pass rate of the test case.

9. A mobile UI automation testing system for hybrid development APP, characterized in that: The system includes: an automated test management platform, an automated script task scheduling machine, a GitLab script management server, an automated script running machine, a mobile device and a file server; The automated test management platform is used to create a test task according to the preset automated test requirements, and send the test task to the automated script task scheduling machine; wherein the test task includes: the name of the script to be executed and the name of the machine running the automated script to be executed; The automation script task scheduling machine is used to receive and parse the test task, determine the automation script running machine to be executed according to the name of the automation script running machine to be executed contained in the test task, and forward the test task to the automation script running machine to be executed; The to-be-executed automation script running machine is used to pull all the automation scripts in the GitLab script management server, and determine the to-be-executed scripts among all the automation scripts according to the names of the to-be-executed scripts determined by parsing the test task; wherein the automation script contains a Native and Webview combination element locator; The to-be-executed automated script running machine is also used to convert the to-be-executed script into a test command and send it to a mobile device, so that the mobile device locates the program based on the Native and Webview combination elements in the test command to complete the test task for the mobile UI in the mobile terminal.

10. A non-volatile computer storage medium for mobile UI automated testing of hybrid development APP, storing computer executable instructions, characterized in that: The computer executable instructions are configured to: The automated test management platform creates a test task according to the preset automated test requirements, and sends the test task to the automated script task scheduling machine; wherein the test task includes: the name of the script to be executed and the name of the automated script running machine to be executed; The automated script task scheduling machine receives and parses the test task to determine the automated script running machine to be executed according to the name of the automated script running machine to be executed contained in the test task, and forwards the test task to the automated script running machine to be executed; The to-be-executed automation script running machine pulls all the automation scripts in the GitLab script management server, and determines the to-be-executed scripts among all the automation scripts according to the names of the to-be-executed scripts determined by parsing the test task; wherein the automation scripts contain Native and Webview combination element locator; The to-be-executed automated script runner converts the to-be-executed script into a test command and sends it to the mobile device, so that the mobile device locates the program based on the Native and Webview combination elements in the test command to complete the test task for the mobile UI in the mobile terminal.

Citation Information

Patent Citations

  • Method and device for testing applications on mobile terminal

    CN104765678A

  • Webpage test method and device, equipment and medium

    CN112269739A