Node-based mobile terminal software automatic testing method, system and equipment and medium
By adopting a Node-based automated testing method for mobile software, integrating device interaction and data parsing units, and using subprocesses to isolate test tasks, the problem of poor device compatibility and multi-device testing blockage in existing technologies is solved, and an efficient and stable testing process is achieved.
Patent Information
- Application Number
- CN202511421673.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2026-01-23
AI Technical Summary
Existing mobile automated testing methods suffer from problems such as complex local debugging, high script learning threshold, low scalability, poor device compatibility, and easy blocking during multi-device testing, resulting in insufficient testing efficiency and stability.
A Node-based automated testing method for mobile software is adopted. By integrating the first and second test units, device interaction and data parsing are realized. Test tasks are isolated by subprocesses, and polling cycles and fallback logic are configured to ensure the continuity of the test process and device compatibility.
It improves the ease of starting tests, the efficiency of multi-device concurrency, and the stability of the process, reduces operating and maintenance costs, and improves test accuracy and compatibility.
Smart Images

Figure CN121387718A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computers, in particular to a mobile terminal software automatic testing method, system, device and medium based on Node. BACKGROUND
[0002] In the current mobile terminal software automatic testing field, in order to achieve the testing tasks such as function verification and interface interaction of mobile terminal software, the industry generally relies on existing test frameworks to carry out work. These frameworks can meet the basic automatic testing needs, but in the actual landing process, problems related to local development debugging, script learning threshold, function expansion adaptation and the like gradually appear, resulting in constraints on the starting efficiency, maintenance cost and flexible adaptability of the testing work, and a lighter, easier-to-operate and highly expandable technical solution is urgently needed to optimize the mobile terminal software automatic testing process.
[0003] The existing mobile terminal automatic testing is mainly implemented by using mature test frameworks, and the commonly used frameworks include Appium, MobileRunner, UIAutomator and the like. In the implementation process, the corresponding test scripts need to be written for the selected framework, and the development languages of these scripts are mostly limited to Java or Python; through the cooperation of the function interfaces provided by the framework and the instructions of the above-mentioned scripts, the interaction with mobile terminal devices such as Android is realized, and then the automatic testing operations such as simulated clicking and function testing are completed, and finally the testing target of the mobile terminal software is achieved.
[0004] However, the existing technology has many technical defects. The testing scheme based on Java, Python scripts and traditional frameworks is not convenient for local debugging, and the local development starting process is complex, making it difficult to quickly verify the modification effect of the scripts; secondly, the learning threshold of Java and Python languages is higher than that of JavaScript, increasing the learning and use cost of the testers; thirdly, the expandability is low, and the testing functions are limited by the framework, making it difficult to expand the functions according to new testing requirements; at the same time, the compatibility for different models of mobile phones is poor, and it is difficult to customize the adaptive testing logic for different models; in addition, it cannot support multiple different models of mobile phones to execute testing tasks at the same time, and task blocking is easy to occur in the multi-device testing scenario, affecting the testing progress. SUMMARY
[0005] In order to solve the problems existing in the existing mobile terminal automatic testing method, the present application provides a mobile terminal software automatic testing method, system, device and medium based on Node.
[0006] In a first aspect, the present application provides a mobile terminal software automatic testing method based on Node, comprising: Start the Node service, and connect the mobile terminal device, the Node service integrates the first test unit and the second test unit, the first and second test units are used to realize test interaction with the mobile terminal device; In the Node service, a first polling is performed to obtain test task information to be executed, and a second polling is performed to detect whether there is a target mobile terminal device that has been connected and allocated with the test task information but is not in a working state; If the target mobile terminal device is detected, a sub-process uniquely corresponding to the target mobile terminal device is started; According to the sub-process, the test task information and the model of the target mobile terminal device, a corresponding test task is matched and executed; The first test unit sends a first instruction to the target mobile terminal device; The second test unit obtains structured data of a current page of the target mobile terminal device and converts it into a processable data object, and checks whether a target element corresponding to the first instruction exists in the current page; If it is detected by the second test unit that the first instruction execution has deviation, a preset bottom logic is triggered to adjust the test task.
[0007] By adopting the above technical solution, a Node-based mobile terminal software automatic test core process is constructed, and the first test unit device interaction and the second test unit are integrated. Through two rounds of collaborative polling, the test task to be executed and the target mobile terminal device are accurately matched, the sub-process is used to realize isolated execution of multiple device test tasks, the element verification and deviation bottom logic are used to guarantee the continuity of the test process, the problems of inconvenient local debugging, easy blocking of multiple device concurrent testing, poor device compatibility and task interruption caused by instruction execution deviation are effectively solved, the test starting convenience, multiple device concurrent efficiency and test process stability are improved, and the operation and maintenance cost of the test personnel is reduced.
[0008] In one specific implementable scheme, the Node service includes: An execution engine parameter is configured to adapt to the running requirement of the test task; The calling interface of the first test unit is integrated; The second test unit is loaded and a data conversion rule is configured, the data conversion rule includes a mapping relationship between structured data and the processable data object and an element attribute extraction range; A temporary storage area is created for real-time storage of test task information to be executed, mobile terminal device connection state information and test process log data.
[0009] By adopting the technical scheme, the initialization running environment is configured and the engine parameters are configured to adapt to the test task requirements, the first test unit calling interface is integrated to ensure the stability of device interaction, the second test unit is loaded and the data conversion rules are configured to ensure the accuracy of page data analysis, the temporary storage area is created to manage test key data in real time, and a basic running environment with strong adaptability, stable interaction and standardized data is provided for subsequent test processes, thereby improving the stability of the test environment and the accuracy of data processing.
[0010] In a specific implementable solution, the mobile terminal software automatic test method comprises: setting a cycle of the first polling; performing the first polling to pull test task information to be executed through the Node service; setting a cycle of the second polling; performing the second polling to execute the second instruction through the first test unit to obtain a mobile terminal device that is currently connected and has the developer mode enabled; traversing the mobile terminal devices to query task allocation records and sub-process running states corresponding to each of the mobile terminal devices.
[0011] By adopting the technical scheme, the logic of polling cycle configuration, test task pulling, device list obtaining and device state traversal query is supplemented, the polling cycle is flexibly configured according to the task update frequency and device detection requirement, the real-time synchronization of test task data and the accurate grasp of device state are ensured, and the timeliness of test task obtaining and the accuracy of target mobile terminal device positioning are improved.
[0012] In a specific implementable solution, the matching and execution of the corresponding test task according to the sub-process, the test task information and the model of the target mobile terminal device comprises: the sub-process executes the second instruction through the first test unit to obtain the model information of the target mobile terminal device; in a preset test task library, a corresponding test task is matched based on a combination condition of the test task information and the device model; the test task is loaded, a test step sequence defined in the test task is parsed, the first and second test units in the Node service are called, and the test task is executed.
[0013] By adopting the technical scheme, the logic of obtaining the device model, matching the test task based on the combination of the task and the model, loading and parsing the task steps and calling the double test units for execution is adopted, the accurate adaptation of the test task and the model of the target mobile terminal device is realized, the problems of poor compatibility of the test task and the device model and lack of targetedness of task execution are solved, and the adaptability and execution accuracy of the test task are improved.
[0014] In one specific implementation, the mobile terminal software automated testing method comprises: The sub-process decomposes the test task information to generate an interactive task flow and a parsing task flow; Based on the interactive task flow, the first test unit generates a first instruction adapted to the target mobile terminal device; Based on the parsing task flow, the second test unit generates a verification rule associated with the test task.
[0015] By adopting the above technical solution, the test task information is decomposed into an interactive task flow and a parsing task flow, and the first and second test units are respectively driven to generate an adaptive instruction and a verification rule, thereby realizing the collaborative generation of test operation instructions and data verification rules, solving the problem of disconnection between test operation and data verification logic and chaotic execution flow, improving the coherence and logical consistency of the test steps, and reducing the test errors caused by the disconnection between operation and verification.
[0016] In one specific implementation, the sending of the first instruction to the target mobile terminal device by the first test unit comprises: Obtaining the operation permission of the target mobile terminal device by the first test unit; Generating a corresponding first instruction by the first test unit according to the type of the target element identifier in the test task; Sending the first instruction to the target mobile terminal device, and obtaining the page focus information by the first test unit after waiting for a preset response time to determine whether the click operation is successfully executed.
[0017] By adopting the above technical solution, the device operation permission is obtained, the corresponding instruction is generated according to the element identifier type, and the execution result is determined based on the page focus information, thereby ensuring the executability of the test instruction and the verifiability of the execution result, solving the problems of instruction execution failure caused by insufficient device permission, inaccurate instruction generation, and difficult determination of execution result, and improving the execution success rate of the test instruction and the accuracy of result verification.
[0018] In one specific implementation, if the first instruction execution has deviation detected by the second test unit, triggering a preset bottom logic to adjust the test task comprises: The second test unit sends a deviation signal; The first test unit receives the deviation signal, queries the list of connected mobile terminal devices managed by the Node service, and filters out a standby device that is adapted to the model of the target mobile terminal device and is in an idle state; The first test unit disconnects the communication link with the target mobile terminal device, establishes a communication link with the standby device, and synchronizes the execution progress data of the original test task; The sub-process restarts the test task based on the standby device and the synchronized execution progress data; If no standby device is found, the second test unit collects the structured data and deviation information of the current page of the target mobile terminal device, generates a deviation record and stores it in the Node service, and drives the sub-process to perform the step jump operation of the test task.
[0019] By using the above technical solutions, the bottom logic of deviation signal triggering, standby device screening and communication switching, execution progress synchronization, task restart or step jump is established, flexible processing after test deviation is realized, the problems of direct interruption of test task after instruction execution deviation and low utilization rate of multi-device resources are solved, and the utilization rate of multi-device resources and the anti-interference ability of the test process are improved.
[0020] In a second aspect, the present application also provides a Node-based mobile terminal software automatic test system, comprising: a Node service module for starting a Node service, integrating a first test unit and a second test unit, initializing a running environment and configuring execution engine parameters to adapt to the running requirements of a test task; a polling management module for performing cooperative polling in the Node service, obtaining test task information to be executed and detecting target mobile terminal devices that have been connected and assigned tasks but are not working, and configuring a polling period; a sub-process scheduling module for starting a sub-process uniquely corresponding to the target mobile terminal device when the target mobile terminal device is detected, restarting the test task based on the standby device and the execution progress data, and driving the test task step jump; a test task module for matching and adapting a test task according to the sub-process, test task information, and the model of the target mobile terminal device, and decomposing the test task information to generate an interactive task flow and an analysis task flow.
[0021] In a third aspect, the present application also provides an electronic device comprising a processor, a memory, a user interface, and a network interface, the memory being configured to store instructions, the user interface and the network interface being configured to communicate with other devices, and the processor being configured to execute the instructions stored in the memory to enable the electronic device to perform the Node-based mobile terminal software automatic test method.
[0022] In a fourth aspect, the present application also provides a computer-readable storage medium storing a plurality of instructions, the instructions being adapted to be loaded and executed by a processor to perform the Node-based mobile terminal software automatic test method.
[0023] In summary, the present application includes at least one of the following benefits: 1. The present application constructs a Node service infrastructure with strong adaptability, ensuring the adaptability of test tasks and hardware environment; integrates the first test unit and the second test unit to provide stable environment, standardized interaction and unified data for the whole test process, greatly reducing the time cost of test environment construction and data management.
[0024] 2. The present application realizes complete isolation of multi-device test tasks by starting a unique sub-process for each target mobile terminal device, avoiding task blocking when multiple devices are concurrently tested in traditional frameworks; meanwhile, the first test unit and the second test unit are integrated to form a closed-loop process of instruction sending, element checking and deviation processing; and through the bottom logic of standby device switching or step jumping, the industry problem of test interruption caused by instruction execution deviation is solved, significantly improving the efficiency and stability of multi-device concurrent testing.
[0025] 3. The present application realizes precise adaptation of test tasks and device models and operation and verification logic coordination, improving test accuracy and compatibility; the test task is decomposed into interactive task flow and analysis task flow to ensure high coordination between operation instructions and verification logic, improving the accuracy and adaptation range of different model device testing. BRIEF DESCRIPTION OF DRAWINGS
[0026] Figure 1 is a flowchart of a Node-based mobile terminal software automatic testing method provided by an embodiment of the present application. DETAILED DESCRIPTION
[0027] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to be limiting to the present application. As used in the specification of the present application, the singular forms "a," "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "and / or" used in the present application, means any or all possible combinations of one or more of the listed items.
[0028] Hereinafter, the terms "first" and "second" are only for the purpose of description, and cannot be understood as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with "first" and "second" can explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise specified.
[0029] First, Node is introduced. Node, in full Node.js, is a server-side JavaScript runtime environment built on Chrome V8 JavaScript engine, which adopts a non-blocking I / O model and an event-driven architecture, can efficiently process multiple concurrent task requests, and avoids resource blocking problems caused by traditional synchronous I / O operations.
[0030] In the Node-based mobile terminal software automatic testing scheme provided in the embodiments of the present application, Node can be used as a core running carrier to support the integration of device interaction modules and data analysis modules, and is compatible with test scripts written in JavaScript (JS) and TypeScript (TS). By configuring engine parameters, the Node-based mobile terminal software automatic testing scheme can adapt to concurrent testing of multiple mobile terminal devices and polling task scheduling, and provide a stable and efficient running environment for the start, execution, and exception handling of test tasks.
[0031] The technical solutions in the embodiments of the present application will be described clearly and completely in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all the embodiments.
[0032] Reference Figure 1 , Figure 1 FIG. 1 shows a flowchart of a Node-based mobile terminal software automatic testing method provided in an embodiment of the present application. The method can be implemented by relying on a computer program, can be implemented by relying on a single-chip microcomputer, and can run on a Node-based mobile terminal software automatic testing system. The computer program can be integrated in a computer device or run as a standalone tool application. Specifically, the method includes S100 to S700, and the steps are as follows: S100, start a Node service and connect a mobile terminal device. The Node service integrates a first test unit and a second test unit. The first and second test units are used to implement test interaction with the mobile terminal device. The first test unit in the embodiments of the present application refers to a functional module integrated in the Node service for implementing interaction control with the mobile terminal device. The first test unit is used to establish a device communication link, send simulated clicking or permission acquisition operation instructions, encapsulate device debugging logic through a standardized interface, and ensure the accuracy of instructions and the isolation of states when multiple devices are concurrently interacted.
[0033] In some embodiments, the first test unit can be an Android Debug Bridge (ADB). The ADB is a command line tool that can communicate with an Android device and provide support for device control in mobile terminal software automatic testing.
[0034] The second test unit refers to a functional module integrated in the Node service for processing mobile terminal page data in the embodiments of the present application, and is used for obtaining page structured data, converting the structured data into processable data objects, checking whether a target element corresponding to an operation instruction exists, detecting instruction execution deviation and generating a deviation record, and providing standardized data basis for test checking and deviation processing by configuring data analysis logic.
[0035] In some embodiments, the second test unit can be Xml2js, i.e., Extensible Markup Language (XML) to JavaScript Object (Xml2js). Xml2js is a Node.js library for making it more convenient to process XML structured data of a mobile terminal page in Node.js.
[0036] In some embodiments, the Node service is started, a communication link between the Node service and the mobile terminal device is established, and a basic control architecture for mobile terminal software automated testing is built.
[0037] Specifically, an appropriate Node.js version is installed to ensure compatibility with the first test unit and the second test unit. In the Node service startup script, the first test unit is integrated, and device debugging logic is encapsulated to support device interaction. The second test unit is integrated, and a data analysis library is introduced to support page data processing. The developer mode and the USB debugging function of the mobile terminal device are enabled, a physical connection is established between the USB data line and the terminal running the Node service, the first test unit sends a device identification instruction, the device connection state is checked, and a bidirectional communication link is established, and the interaction preparation of the Node service and the mobile terminal device is completed.
[0038] On the basis of the above embodiments, as another optional embodiment, the Node service includes: S101, initializing a running environment, and configuring execution engine parameters to adapt to the running requirements of a test task; The execution engine parameters refer to configurable performance optimization items of a built-in engine of the Node service in the embodiments of the present application, including memory limitation, compilation cache, asynchronous task priority, etc. The real-time performance and stability requirements of mobile terminal automated testing are adapted by parameter adjustment.
[0039] In some embodiments, the running environment of the Node service is initialized and configured, the core parameters of the built-in engine are adjusted, the test script running performance and multi-task concurrent processing capability are optimized, and the test task requirements are adapted.
[0040] Specifically, the test dependent library is installed, and a specified script entry is configured; performance parameters are configured based on the engine, the maximum memory is set to avoid memory overflow in multi-device concurrent testing; the compilation cache is enabled to speed up the repeated execution of scripts; the asynchronous task parameters are adjusted to ensure that the asynchronous operations such as multi-device interaction and polling are not blocked.
[0041] S102, an invocation interface of the first test unit is integrated; In some embodiments, the standardized invocation interface of the first test unit is encapsulated in the Node service, the interface input and output formats are specified, and the standardized interaction control of the mobile terminal device is implemented. The interaction control includes connection detection, instruction sending, and information query.
[0042] Specifically, the standardized invocation interface can include: a device connection detection interface, an instruction for querying the device connection state, a configuration parameter for filtering offline devices, a structured data list containing mobile terminal device core information after executing the instruction, and the core information at least including device unique identifier, device model, and device current connection state, so as to quickly obtain the basic state of the effective device; an operation instruction sending interface, an instruction for controlling the mobile terminal device to execute a specific operation, including instructions corresponding to operations such as simulating user clicks, obtaining device operation permissions, and triggering page back, receiving the device unique identifier of the target device and the parameters corresponding to the specific operation, and outputting the execution result of the operation and the error reason information when the operation fails after executing the instruction; a device information query interface, an instruction for obtaining the mobile terminal device model information, receiving the device unique identifier for positioning the target device as an input parameter, and directly outputting the specific model string of the target device after executing the instruction.
[0043] The standardized interface adopts asynchronous execution function calling logic to ensure that other tasks of the Node service are not blocked during the calling process; the one-to-one correspondence between the interface calling and the target device is established based on the device unique identifier to realize the state isolation when multiple mobile terminal devices concurrently call the interface, avoid the conflict of instructions of different devices in the calling process, and ensure the smooth process when multiple devices are tested at the same time.
[0044] S103, loading the second test unit and configuring data conversion rules, the data conversion rules including the mapping relationship between the structured data and the processable data object and the element attribute extraction range; In some embodiments, the second test unit core module is loaded, the conversion rules of the structured data and the processable data object and the element attribute extraction range are configured, and the standardization and accuracy of page data processing are ensured.
[0045] Specifically, in the initialization phase of the Node service, a special parsing library for processing mobile page structured data is deployed, the core function modules of the special parsing library are loaded, and a special instance for data parsing is created; standardized data conversion rules are configured according to the parsing requirements of mobile page structured data. The standardized data conversion rules can include: A mapping relationship rule for mapping the labels in the mobile page structure data to an array in the script language object, mapping the element attributes contained in the page structure data to the attributes of the elements in the array, and establishing the corresponding relationship between the page structure data and the script language object; An attribute extraction range rule for extracting the element identifier, position coordinates, and text information related to page element verification from the mapped array element attributes, excluding redundant attributes unrelated to verification, and reducing resource consumption in the data processing process; A parsing option rule for ensuring that the mapping result corresponding to a single page element is not forcibly converted into an array format, while retaining the corresponding relationship between the element attributes and attribute values, avoiding confusion in the parsed data format, and ensuring the consistency of data calling in the subsequent verification process.
[0046] The special data conversion module is encapsulated in the Node service, receives the data describing the mobile page structure obtained by the first test unit as input, performs parsing and conversion operations according to the data conversion rules, and finally outputs the script language object that can be directly used for page element verification, providing a standardized data basis for the second test unit to perform element verification.
[0047] S104, a temporary storage area is created for real-time storage of test task information to be executed, mobile terminal device connection state information, and test process log data.
[0048] The temporary storage area in the embodiments of the present application refers to a hierarchical data storage module created by the Node service, which is used for real-time storage of test task information to be executed, mobile terminal device connection state information, and test process log data.
[0049] In some embodiments, a hierarchical temporary storage area is created under the Node service startup directory, the data storage partition is divided, and real-time storage and management of test tasks, device states, and test logs are achieved.
[0050] Specifically, based on Node.js, a root temporary directory is created, and subdirectories are divided, including a task subdirectory for storing tasks to be executed, named with a task identification.json, including test targets, steps, and adaptive models; a device subdirectory for storing device states, named with a device identification.json, including models, connection states, and sub-processes; and a text subdirectory for storing log texts, named with a task identification, a device identification, and a timestamp, including execution time, results, and deviation information.
[0051] S200, performing a first polling in the Node service to obtain test task information to be executed, and performing a second polling to detect whether there is a target mobile terminal device that has been connected and assigned with test task information but is not in a working state; The first polling in the embodiments of the present application refers to a query mechanism that is periodically performed in the Node service and obtains test task information to be executed, is used for synchronizing test task data locally or remotely in real time, guarantees the timeliness and accuracy of test task acquisition, and provides a data basis for matching of subsequent tasks and devices.
[0052] The second polling in the embodiments of the present application refers to a query mechanism that is periodically performed in the Node service and detects target mobile terminal devices, is used for collecting connection states and task assignment situations of connected mobile terminal devices in real time, and screens out devices that have been connected and assigned with tasks but are not in a working state, to provide target objects for sub-process starting.
[0053] The test task information in the embodiments of the present application refers to structured data for guiding test execution, at least includes test target identification, to-be-tested function information, test step sequence, expected execution result, and adaptive mobile terminal device model list, and is a core basis for sub-process matching of test tasks.
[0054] In some embodiments, the Node service performs two rounds of cooperative polling, the first polling is used for obtaining test task information to be executed, and the second polling is used for detecting target mobile terminal devices that have been connected and assigned with tasks but are not in a working state, to build a matching basis for test tasks and execution devices.
[0055] Specifically, the polling management module of the Node service initiates and performs two rounds of periodic query operations. The first polling is performed by the task management submodule of the Node service, which is used to obtain real-time test task information to ensure that the task library and the task data of the Node service are synchronized. The second polling is performed by the device management submodule of the Node service, which is used to obtain real-time information about the state of the connected mobile terminal device, including the connection state, the task allocation state, and the child process state. The two polls are executed in parallel. After the first polling obtains the test task information, the information is automatically synchronized to the temporary storage area of the to-be-executed task queue. The second polling detects whether there is a target mobile terminal device that has been connected, has been allocated a task, and has not started a child process based on the task allocation record in the to-be-executed task queue.
[0056] On the basis of the above-mentioned embodiments, as another optional embodiment, the mobile terminal software automatic testing method further comprises: S201, setting a period of the first polling; In some embodiments, the polling period parameter for obtaining the to-be-executed test task information in the Node service is configured, which is adapted to the update frequency of the test task and balances the timeliness of task acquisition and system resource consumption.
[0057] Specifically, the Node service provides a configurable entry for the first polling period through the configuration module, and sets an initial period according to the actual update frequency of the test task. A dynamic adjustment mechanism is embedded in the period setting logic. If the polling management module detects that the number of tasks in the to-be-executed task queue in the temporary storage area exceeds a preset threshold, the polling period is shortened to speed up the task acquisition and avoid task accumulation. If it is detected that the queue has no to-be-executed task, the period is extended to reduce the resource occupation caused by invalid polling. The configured period parameter is stored in the polling configuration table in the temporary storage area for real-time reading and performing periodic query operations.
[0058] S202, performing the first polling to pull the to-be-executed test task information through the Node service; In some embodiments, when the first polling period is triggered, the task reading interface of the Node service performs the first polling to pull the structured test task data including the test target, the steps, and the like from a local or remote data source, and completes data verification and storage.
[0059] Specifically, after the first polling period is triggered, the Node executes a task reading interface built in the first polling service call to perform a task pulling operation. The task reading interface supports a local-remote dual-source data acquisition mode. If configured for local pulling, the task reading interface reads structured task data from a local task configuration file under a Node service start directory. If configured for remote pulling, the task reading interface sends a pulling request to a preset remote test task management platform through a standardized communication protocol. The request parameters include a unique identifier of the Node service and a model list of currently connected devices. After the pulling is completed, the task reading interface performs format verification on test task information. The verification content includes a test target identifier, a test step, and an adaptive device model. The task information that passes the verification is synchronously written into a to-be-executed task queue in a temporary storage area.
[0060] S203, set a second polling period; In some embodiments, a polling period parameter for detecting a target mobile terminal device in the Node service is configured in coordination with the first polling period to avoid resource competition and ensure the timeliness of device detection.
[0061] Specifically, the second polling period is set by a configuration module of the Node service using configuration logic associated with the first polling period. The second polling period is set to be the same as or an integer multiple of the first polling period. Since the start times of the first polling and the second polling are different, resource competition caused by triggering of the two polls at the same time can be avoided. If the polling management module detects that the number of currently connected mobile terminal devices exceeds a preset value (such as 5), the second polling period is forcibly adjusted to be the same as the first polling period to ensure the timeliness of device state detection and avoid a situation where devices are idle but not assigned tasks due to a too long period. The configured second polling period parameter is stored in a polling configuration table and is associated with the first polling period. When the first polling period is dynamically adjusted, the second polling period is synchronously adjusted by the same proportion to maintain the coordination of the two polls.
[0062] S204, execute the second polling to execute a second instruction through the first test unit to obtain a mobile terminal device that is currently connected and has the developer mode enabled; The second instruction refers to a standardized instruction executed by the first test unit to obtain a list of currently connected mobile terminal devices in the embodiments of the present application. The second instruction is used to collect information such as a unique identifier, a model, and a connection state of a device.
[0063] In some embodiments, when the second polling period is triggered, the first test unit executes the second instruction for obtaining a device list to collect information of a mobile terminal device that is connected and has the developer mode enabled to form a structured device list.
[0064] Specifically, after the second polling cycle is triggered, the Node service drives the first test unit to execute the second instruction. The second instruction is used to collect information of mobile terminal devices that have connected to the Node service and have enabled the developer mode, and to exclude invalid devices that are offline or have not enabled the developer mode. The second instruction returns a structured device list after execution, and each device entry in the list includes device identification, device model, and connection status. The first test unit performs data processing such as deduplication on the returned device list, for example, to exclude duplicate device records. After the processing is completed, the device list is synchronized to the device state library in the temporary storage area.
[0065] S205, traversing the mobile terminal devices, querying task allocation records and sub-process running states corresponding to each mobile terminal device.
[0066] The task allocation record refers to structured information stored in the temporary storage area and recording the association between a mobile terminal device and a test task to be executed, and is used to determine whether the device has been allocated a test task. The sub-process running state is information used to describe the current working state of a sub-process bound to the mobile terminal device, and is used to determine whether the device is in a working state.
[0067] In some embodiments, the structured device list is traversed to query the task allocation record and the sub-process running state of each device, and target mobile terminal devices that meet the conditions are selected.
[0068] Specifically, the Node service starts a device traversal process based on the obtained structured device list, and performs a query operation on each device in the list in sequence. The query operation includes querying the task allocation record table in the temporary storage area to determine whether the device has been allocated a test task to be executed, querying the Node service to obtain the sub-process running state corresponding to the device, and determining whether the device is a target mobile terminal device according to the query result. If a device has a valid task allocation record and the corresponding sub-process state is “not started” or “terminated”, the device is marked as a target mobile terminal device. After the traversal is completed, the device identification and the allocated task identification of all target mobile terminal devices are stored in the target device list in the temporary storage area.
[0069] S300, if a target mobile terminal device is detected, starting a sub-process uniquely corresponding to the target mobile terminal device; The sub-process refers to an independent task execution unit uniquely bound to the target mobile terminal device and started by the Node service. The sub-process independently calls the first test unit and the second test unit to execute a test task based on the target device model and the test task information, realizes isolated execution of multiple device test tasks, avoids interference between test processes of different devices, and ensures the stability of concurrent testing of multiple devices.
[0070] In some embodiments, after the Node service detects a target mobile terminal device that has been connected and assigned a task but is not working, a sub-process uniquely bound to the target mobile terminal device is started to provide an independent task carrier for test task execution.
[0071] Specifically, when the Node service detects a device that meets the conditions in the target device list, a sub-process uniquely corresponding to the target mobile terminal device is started based on the unique identifier of the target mobile terminal device. When the sub-process is started, the model information of the target device and the assigned test task identifier are loaded to establish a binding relationship between the sub-process, the target mobile terminal device, and the test task. The sub-process has the authority to independently call the first and second test units in the Node service, can independently execute the test task, and has no resource competition with other device corresponding sub-processes, ensuring process isolation during multi-device concurrent testing.
[0072] S400, according to the sub-process, test task information, and model of the target mobile terminal device, matching and executing the corresponding test task; In some embodiments, the sub-process matches the appropriate test task in the preset test task library based on the model of the target mobile terminal device and the test task information, and calls the first and second test units to execute the task.
[0073] The preset test task library in the embodiments of the present application refers to a database that stores standardized test tasks adapted to different mobile terminal device models. The test tasks in the library are associated with a combination index of test task information and device model, which is used to reduce test task duplication and improve task matching efficiency.
[0074] Specifically, the sub-process obtains the test task information and device model information bound to the target device in the temporary storage area, and initiates a matching request to the preset test task library. The preset test task library quickly locates the appropriate test task based on the combination condition of the test target identifier in the test task information and the device model through the pre-established index. After the sub-process loads the test task, it parses the test step sequence contained in the task and calls them in sequence. The first test unit executes device operations, and the second test unit executes corresponding data verification until all test steps are completed. During this period, the execution results of each step are synchronized to the test log in the temporary storage area.
[0075] The test step sequence in the embodiments of the present application refers to a set of standardized test operations arranged in execution order in the test task. Each step corresponds to a device operation action and data verification requirement, which is used to provide clear process guidance for test task execution and ensure logical consistency when the first and second test units are executed cooperatively.
[0076] On the basis of the above-mentioned embodiments, as another optional embodiment, a corresponding test task is matched and executed by a sub-process according to test task information and a model of a target mobile terminal device, which includes: S401, the sub-process executes a second instruction through the first test unit to obtain model information of the target mobile terminal device. In some embodiments, the sub-process drives the first test unit to execute a device information query instruction to obtain model information of the target mobile terminal device, thereby providing a device adaptation basis for test task matching.
[0077] Specifically, the sub-process sends an instruction call request containing a unique identifier of the target device to the first test unit to trigger the first test unit to execute the second instruction; the first test unit sends the second instruction to the target device through a communication link with the target device to obtain model information returned by the device; the first test unit arranges the model information in a structured format and returns it to the sub-process, and the sub-process stores the information in a temporary storage area.
[0078] S402, in a preset test task library, a corresponding test task is matched based on a combination condition of test task information and a device model. In some embodiments, the test task information and the target device model are used as a combination condition to search and match an adapted test task in a preset test task library, thereby providing a template for subsequent test execution.
[0079] Specifically, the sub-process extracts a test target identifier in the test task information and the target device model from the temporary storage area to generate a combined query condition; after the preset test task library receives the query condition, it quickly filters out a test task that simultaneously satisfies an adapted test target and an adapted device model through a bidirectional index of test targets and device models pre-built in the library; the sub-process performs validity verification on the matching result, for example, verifying whether the task contains a complete test step sequence; after the verification is passed, the task is determined as a test task to be executed, and the task identifier is associated and stored in the temporary storage area.
[0080] S403, the test task is loaded, the test step sequence defined in the test task is parsed, the first and second test units in the Node service are called, and the test task is executed.
[0081] In some embodiments, the sub-process loads the matched test task, parses the test step sequence therein, and sequentially calls the first and second test units to cooperatively execute the test task.
[0082] Specifically, the sub-process loads a corresponding test task file from a preset test task library based on a test task identifier, and parses a test step sequence arranged in an execution order in the file; for each test step, the sub-process determines the step type; if the step is determined to be a device operation step, a first test unit is called to generate and send a corresponding instruction; if the step is determined to be a data verification step, a second test unit is called to obtain page structured data and perform verification; during the execution process, the sub-process receives execution results of the first and second test units in real time, if a step fails to execute, the subsequent steps are paused and an exception handling logic is triggered, for example, a failure log is recorded; if all steps are executed, the test task execution is marked as successful and is synchronized to a temporary storage area.
[0083] S500, sending a first instruction to the target mobile terminal device through the first test unit; The first instruction in the embodiments of the present application refers to a standardized instruction generated by the first test unit and used to control the target mobile terminal device to perform specific operations. The first instruction can include types such as simulating user clicks, obtaining device operation permissions, triggering page back, etc., which is used to convert operation requirements in the test step sequence into control signals recognizable by the device, to realize automatic execution of test operations.
[0084] In some embodiments, the first test unit generates and sends a first instruction for performing specific operations to the target mobile terminal device based on test step requirements, to realize automatic control of test operations.
[0085] Specifically, the first test unit receives test step operation requirements and a unique identifier of the target device sent by the sub-process, and checks the connection state and operation permissions of the target device; if the permissions are missing, the permission acquisition operation is performed first; according to the type of the operation requirement, the corresponding first instruction is generated, for example, the simulated click instruction contains the position parameter of the target element, and the permission acquisition instruction contains the type parameter of the permission to be acquired; the first test unit sends the first instruction to the target device through the communication link with the target device, and waits for the execution response returned by the device; if the response is execution success, the result is fed back to the sub-process; if the response is execution failure, the failure reason is synchronized for the sub-process to determine whether to retry.
[0086] Based on the above embodiments, as another optional embodiment, if a test task is executed, the first instruction is sent to the target mobile terminal device through the first test unit, including: S501, obtaining the operation permission of the target mobile terminal device through the first test unit; The operation permission in the embodiments of the present application refers to an authorized permission that the target mobile terminal device allows the first test unit to perform control operations, including device debugging permissions, interface operation permissions, etc., which is used to ensure that the first instruction sent by the first test unit can be normally responded by the device, to avoid test operation failure due to insufficient permissions.
[0087] In some embodiments, the first test unit initiates an operation permission application to the target mobile terminal device, obtains authorization required for executing the first instruction, and ensures that the test operation can be normally executed.
[0088] Specifically, after the first test unit receives the permission obtaining requirement and the target device identifier sent by the sub-process, the first test unit generates a corresponding permission application instruction; the first test unit sends the permission application instruction to the target mobile terminal device through the established communication link; if the device returns a permission granting response, the first test unit records the permission obtaining state as authorized, and sends a permission obtaining success response to the sub-process; if the device returns a permission rejection response, the first test unit sends a permission obtaining failure signal to the sub-process, and attaches the failure reason, and the sub-process triggers the logic of permission application retry or termination of the current test step.
[0089] S502, according to the type of the target element identifier in the test task, the first test unit generates a corresponding first instruction; In some embodiments, the first test unit generates an adapted first instruction according to the identification type of the target interface element in the test task, so as to ensure that the instruction can accurately act on the target element.
[0090] Specifically, the first test unit obtains the target element identifier and the operation type in the test task from the sub-process, judges the type of the target element identifier; if it is judged as a resource identifier type, the first test unit queries the element position data corresponding to the identifier in the temporary storage area; if it is judged as a position coordinate type, the first test unit uses the coordinate data; the first test unit generates a corresponding first instruction according to the operation type; after the first instruction is generated, the first test unit verifies the instruction format, for example, verifies whether the coordinate parameter is within the device screen range; after the verification is passed, the first test unit forms the final first instruction that can be sent.
[0091] S503, the first test unit sends the first instruction to the target mobile terminal device, waits for a preset response time, and obtains page focus information through the first test unit to determine whether the click operation is successfully executed.
[0092] The page focus information in the embodiments of the present application refers to the interface element information in the active state in the current page of the target mobile terminal device, for example, element position, active state identifier; the page focus information is used as a basis for judging whether the first instruction is successfully executed, and the operation execution effect is verified by comparing the expected action element of the instruction with the actual focus element.
[0093] In some embodiments, the first test unit sends the first instruction to the target device, obtains the page focus information after waiting for the response, and determines the execution effect of the click type first instruction.
[0094] Specifically, the first test unit sends the generated first instruction to the target mobile terminal device through the communication link with the target device, and starts a response timer (e.g., 2 seconds) of a preset time length; after the timer ends, the first test unit sends a page focus query instruction to the target device to obtain the focus information of the current page; the elements in the focus information are compared with the target elements corresponding to the first instruction: if they are consistent, it is determined that the click operation is successfully executed, and a successful execution feedback is fed back to the child process; if they are inconsistent or the focus information is not obtained, it is determined that the execution fails, and the failure information is synchronized to the child process.
[0095] S600, the second test unit obtains the structured data of the current page of the target mobile terminal device and converts it into a processable data object, and checks whether the target element corresponding to the first instruction exists in the current page. The structured data in the embodiments of the present application refers to data describing the layout and element attributes of the current page of the target mobile terminal device, for example, the position, identification, and text information of the page elements; the structured data is stored in a regular format, which is used to provide the original data basis for element checking of the second test unit.
[0096] The processable data object in the embodiments of the present application refers to a data format formed by the second test unit converting the structured data according to a preset rule, which is convenient for element attribute query and matching, and is used to simplify the checking logic of the second test unit on the page elements and improve the efficiency of element existence judgment.
[0097] In some embodiments, after the second test unit obtains the structured data of the page of the target device and converts it into a processable data object, it checks whether the target element corresponding to the first instruction exists to ensure that the operation object is valid.
[0098] Specifically, after the second test unit receives the element checking requirement and the target device identification sent by the child process, it sends a page structured data acquisition instruction to the target mobile terminal device through the first test unit to obtain the structured data of the current page; the second test unit converts the structured data into a processable data object according to a preset data conversion rule; the second test unit queries the elements matching the target element identification in the processable data object, and if the matching elements are queried, it is determined that the target element exists, and a check pass feedback is fed back to the child process; if the matching elements are not queried, it is determined that the target element does not exist, and a check failure feedback is fed back and the deviation processing logic is triggered.
[0099] S700, if the first instruction execution deviation is detected by the second test unit, a preset bottom logic is triggered to adjust the test task.
[0100] In some embodiments, after the second test unit detects the first instruction execution deviation, the preset bottom logic is triggered to adjust the test task execution process, so as to avoid task interruption.
[0101] Specifically, the second test unit converts the detection result of the first instruction execution deviation into a deviation signal and sends it to the first test unit and the sub-process; after receiving the deviation signal, the sub-process starts the preset bottom-up logic, queries the temporary storage area whether there is a standby device that is adapted to the target device model and is in an idle state, if there is, triggers the device switching logic, establishes a communication link with the standby device by the first test unit and synchronizes the execution progress data; if there is no standby device, triggers the step jump logic, generates a deviation record by the second test unit collecting deviation data, and the sub-process skips the current failed step to execute the next step; during the whole process, the sub-process synchronizes the execution result of the bottom-up logic to the test log in the temporary storage area.
[0102] The deviation signal in the embodiment of the application refers to an abnormal notification signal sent by the second test unit to the first test unit when the second test unit detects that the first instruction execution result does not match the expectation, for example, the target element does not exist or the operation does not trigger the page change, which is used to trigger the preset bottom-up logic to realize the timely response to the test exception.
[0103] The standby device refers to a mobile terminal device that is adapted to the target mobile terminal device model, has been connected to the Node service and is currently not executing a test task, which is used as a substitute execution carrier when the target device test is abnormal, avoids interruption of the test task and guarantees the test progress.
[0104] On the basis of the above embodiment, as another optional embodiment, if the first instruction execution is detected by the second test unit to have deviation, the preset bottom-up logic is triggered to adjust the test task, which includes: S701, the second test unit sends a deviation signal; In some embodiments, after the second test unit detects the first instruction execution deviation, the second test unit generates and sends a deviation signal to the first test unit and the sub-process, triggering the deviation processing flow.
[0105] Specifically, when the second test unit performs element verification or operation result determination, if it finds that the target element corresponding to the first instruction does not exist, the page state after the operation does not match the expectation or other deviation scenarios, it generates a deviation signal; the deviation signal includes the deviation type, the target device identifier, the current test step identifier, and is packaged in a standardized format; the second test unit synchronously sends the deviation signal to the first test unit and the sub-process through the communication channel inside the Node service, so that the deviation information can be received by the related modules in time and deviation processing delay is avoided.
[0106] S702, the first test unit receives the deviation signal, queries the list of connected mobile terminal devices managed by the Node service, and screens out a standby device that is adapted to the target mobile terminal device model and is in an idle state; In some embodiments, after receiving the deviation signal, the first test unit queries the list of connected devices, filters out the standby devices of the same model and in idle state, and provides an alternative carrier for device switching.
[0107] Specifically, after receiving the deviation signal, the first test unit extracts the model information of the target mobile device, sends a standby device query request to the device management module of the Node service, and receives a list of all currently connected mobile devices, including device model, connection state, and whether the device is executing a task. The first test unit filters the list according to the conditions of the same model as the target device, connected state, and no assigned test task. After filtering, if there is a device that meets the conditions, it is marked as a standby device and the unique identifier of the standby device is obtained. If there is no device that meets the conditions, the first test unit feeds back a signal to the child process that there is no available standby device.
[0108] S703, the first test unit disconnects the communication link with the target mobile device, establishes a communication link with the standby device, and synchronizes the execution progress data of the original test task; The execution progress data in the embodiments of the present application refers to the test steps completed by the target mobile device before the test task is interrupted, and the temporarily generated test data, which is used to provide a breakpoint for the standby device to continue the test task, avoid starting the test task from zero, and improve the test efficiency.
[0109] In some embodiments, the first test unit disconnects the link with the abnormal target device, establishes a link with the standby device, and synchronizes the execution progress data of the original task to prepare for breakpoint continuation.
[0110] Specifically, the first test unit first sends a test task pause instruction to the target mobile device, and after receiving the pause confirmation from the device, disconnects the communication link with the device and marks the device as test abnormal in the temporary storage area. The first test unit sends a device connection request to the standby device based on the unique identifier of the standby device, and establishes a bidirectional communication link after the standby device confirms. The first test unit extracts the execution progress data of the original test task from the temporary storage area, such as the test step identifier and the temporary input data, and synchronizes it to the standby device through the newly established communication link to complete the breakpoint data migration and ensure that the standby device can continue to execute from the original task interruption point.
[0111] S704, the child process restarts the test task based on the standby device and the synchronized execution progress data; In some embodiments, the child process restarts the test task from the original task interruption step based on the standby device and the synchronized execution progress data, and realizes breakpoint continuation.
[0112] Specifically, after receiving the signal of the standby device connection completion and the execution progress data synchronization completion sent by the first test unit, the sub-process rebinds the test task of the original target device to the standby device; the sub-process extracts the test step identifier of the original task interruption from the execution progress data to determine the restart starting step; the sub-process re-invokes the first test unit and the second test unit from the starting step according to the step sequence of the original test task; during the restart process, the sub-process records the execution result of each step in real time, and if all subsequent steps are executed successfully, it is marked that the test task after restart is executed; if deviation occurs again, the bottom logic is triggered again.
[0113] S705, if no standby device is found, the second test unit collects the structured data and deviation information of the current page of the target mobile terminal device, generates a deviation record and stores it in the Node service, and drives the sub-process to perform the step jump operation of the test task.
[0114] The deviation record in the embodiments of the present application refers to the standardized data record collected by the second test unit, including the target device page structured data, the deviation type, and the deviation occurrence time. The deviation record is used to provide data support for subsequent test case optimization and device compatibility analysis, and to realize the traceability and prevention of test exceptions.
[0115] In some embodiments, when there is no available standby device, the second test unit collects deviation data to generate a deviation record and stores it, and the sub-process performs test step jump to avoid task interruption.
[0116] Specifically, after the first test unit feeds back that there is no available standby device to the sub-process, the sub-process sends a deviation data collection request to the second test unit; after receiving the request, the second test unit obtains the structured data and deviation information of the current page of the target mobile terminal device, and integrates them into a deviation record according to a preset format; the second test unit stores the deviation record in the temporary storage area of the Node service; the sub-process determines the next test step identifier of the current failed step, skips the failed step, and invokes the first and second test units to execute the next step, so that the test task is not interrupted as a whole due to the failure of a single step, until all executable steps are completed or deviation occurs again.
[0117] On the basis of the above-mentioned embodiments, as another optional embodiment, the sub-process disassembles the test task information to generate an interactive task flow and an analysis task flow; Based on the interactive task flow, the first test unit generates a first instruction adapted to the target mobile terminal device; Based on the analysis task flow, the second test unit generates a verification rule associated with the test task.
[0118] In some embodiments, the sub-process disassembles the test task information to generate an interactive task flow for the first test unit to generate instructions and an analysis task flow for the second test unit to generate verification rules, and provides a basis for the collaborative execution of the two.
[0119] Specifically, after the sub-process loads the test task information, the task is disassembled according to the dimensions of operation requirements and verification requirements: device operation requirements such as simulated clicks and permission acquisition are arranged in an interactive task flow according to the execution order, and each node in the flow includes operation type, target element information, and execution timing; data verification requirements such as element existence verification and page state verification are arranged in an analysis task flow, and each node in the flow includes verification object, verification timing, and expected result; the sub-process sends the interactive task flow to the first test unit, and the first test unit generates corresponding first instructions based on the node information in the flow; at the same time, the sub-process sends the analysis task flow to the second test unit, and the second test unit generates corresponding verification rules based on the node information in the flow, for example, verifying whether the target element exists before simulating a click, to ensure that the execution logic of the first and second test units is consistent with the test task requirements.
[0120] Embodiments of the present application also provide a Node-based mobile terminal software automatic testing system, which realizes the Node-based mobile terminal software automatic testing method through the system. The system comprises: a Node service module, configured to start a Node service, integrate a first test unit and a second test unit, initialize a running environment, and configure execution engine parameters to adapt to the running requirements of a test task; a polling management module, configured to perform collaborative polling in the Node service, obtain test task information to be executed, and detect target mobile terminal devices that have been connected and assigned tasks but are not working, and configure a polling period; a sub-process scheduling module, configured to start a sub-process uniquely corresponding to the target mobile terminal device when the target mobile terminal device is detected, restart a test task based on standby devices and execution progress data, and drive test task step jumping; a test task module, configured to match and adapt a test task according to a sub-process, test task information, and a target mobile terminal device model, disassemble the test task information to generate an interactive task flow and an analysis task flow.
[0121] In some embodiments, the system further comprises a communication link establishment module, configured to connect a mobile terminal device, establish a bidirectional communication link between the Node service and the mobile terminal device, and verify the device connection state and the developer mode enablement; In some embodiments, the system further comprises a data storage module, configured to create a hierarchical temporary storage area, and store test task information to be executed, mobile terminal device connection state information, test process log data, and deviation records in real time; In some embodiments, the system further comprises a first test unit interface packaging module for packaging a standardized calling interface of device connection detection, operation instruction sending, and device information query in the Node service, to ensure instruction accuracy and state isolation during concurrent interaction of multiple devices. In some embodiments, the system further comprises a second test unit data conversion module for loading a data parsing library, configuring conversion rules of structured data and processable data objects, and packaging data conversion functions to support verification of page elements. In some embodiments, the system further comprises a deviation record generation module for collecting page structured data and deviation information of the target mobile terminal device when no backup device is available, generating a standardized deviation record, and storing the record to the Node service. In some embodiments, the system further comprises a permission management module for initiating an operation permission application to the target mobile terminal device through the first test unit, obtaining device debugging and interface operation permissions, and ensuring normal execution of the first instruction. In some embodiments, the system further comprises a focus information query module for obtaining focus information of a current page of the target mobile terminal device through the first test unit, and determining whether execution of the click-type first instruction is successful.
[0122] On the basis of the above embodiments, as another optional embodiment, the present application example can further include a computer storage medium, which can store a plurality of instructions, the instructions being suitable for being loaded and executed by a processor to perform the above-mentioned embodiment of a Node-based mobile terminal software automatic testing method. The specific execution process can be referred to the specific description of the above-mentioned embodiments, which will not be described here.
[0123] On the basis of the above embodiments, as another optional embodiment, the present application example can further include an electronic device. The electronic device can include at least one processor, at least one communication bus, a user interface, at least one network interface, and a memory.
[0124] The communication bus is used to realize the connection and communication between the components.
[0125] The user interface can include a display screen (Display) and a camera (Camera). Optionally, the user interface can further include a standard wired interface and a wireless interface.
[0126] The network interface can include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0127] The processor can include one or more processing cores. The processor connects various parts within the server through various interfaces and lines, executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory, and calling data stored in the memory. Optionally, the processor can be implemented in at least one of a hardware form of a digital signal processing (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor can be integrated with a combination of one or more of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content required to be displayed on the display screen; and the modem is used for processing wireless communication. It can be understood that the above-mentioned modem can also not be integrated into the processor, but can be realized by a separate chip.
[0128] The memory can include a random access memory (RAM) and a read-only memory (ROM). Optionally, the memory includes a non-transitory computer-readable storage medium. The memory can be used to store instructions, programs, codes, code sets or instruction sets. The memory can include a program storage area and a data storage area, wherein the program storage area can store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area can store data involved in the above-mentioned various method embodiments, etc. The memory can also be at least one storage device located away from the above-mentioned processor. As a computer storage medium, the memory can include an operating system, a network communication module, a user interface module, and an application program of a Node-based mobile terminal software automatic testing method.
[0129] In the electronic device, the user interface is mainly used to provide an interface for the user to input, and obtain data input by the user; and the processor can be used to call an application program of a Node-based mobile terminal software automatic testing method stored in the memory, which, when executed by one or more processors, causes the electronic device to perform the method of one or more of the above embodiments. It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all described as a combination of a series of actions, but those skilled in the art should know that the present application is not limited to the order of the actions described, because according to the present application, certain steps can be performed in other order or at the same time. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0130] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0131] In the several embodiments provided by the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic. The division of the units is only a logical function division. There can be another division manner for actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different parts can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical or other forms.
[0132] The units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0133] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically independently, or two or more units can be integrated into one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0134] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable memory. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a memory and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the embodiments of the present application. The aforementioned memory includes: a U disk, a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.
[0135] The above are only exemplary embodiments of the present disclosure, and cannot limit the scope of the present disclosure. That is, any equivalent changes and modifications made in accordance with the teachings of the present disclosure are still within the scope of the present disclosure. Other embodiments of the present disclosure will be readily apparent to those skilled in the art upon considering the specification and practicing the true principles of the present disclosure.
[0136] The present application is intended to cover any variations, uses or adaptive changes of the present disclosure that follow the general principles of the present disclosure and include common knowledge or conventional technical means in the technical field not described in the present disclosure. The specification and examples are only considered as exemplary, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A Node-based mobile terminal software automatic testing method, characterized in that, The application relates to a test task execution method and device. The method comprises the following steps: starting a Node service, and connecting a mobile terminal device, wherein the Node service integrates a first test unit and a second test unit, and the first and second test units are used to realize test interaction with the mobile terminal device; performing first polling in the Node service to obtain test task information to be executed, and performing second polling to detect whether a target mobile terminal device exists, which has been connected, is assigned with the test task information and is not in a working state; if the target mobile terminal device is detected, starting a sub-process uniquely corresponding to the target mobile terminal device; matching and executing a corresponding test task according to the sub-process, the test task information and a model of the target mobile terminal device; sending a first instruction to the target mobile terminal device through the first test unit; obtaining structured data of a current page of the target mobile terminal device through the second test unit and converting the structured data into a processable data object, and checking whether a target element corresponding to the first instruction exists in the current page; 2.The Node-based mobile terminal software automatic testing method according to claim 1, wherein, if it is detected through the second test unit that the first instruction execution has deviation, triggering preset bottom logic to adjust the test task. The Node service comprises the following steps: initializing a running environment, configuring an execution engine parameter to adapt to running requirements of the test task; integrating a calling interface of the first test unit; loading the second test unit and configuring a data conversion rule, wherein the data conversion rule comprises a mapping relationship between structured data and the processable data object and an element attribute extraction range; 3.The Node-based mobile end software automatic testing method according to claim 1, wherein, creating a temporary storage area for storing test task information to be executed, mobile terminal device connection state information and test process log data in real time. The method further comprises the following steps: setting a period of the first polling; performing the first polling to pull the test task information to be executed through the Node service; setting a period of the second polling; performing the second polling to execute a second instruction through the first test unit and obtain a mobile terminal device which is currently connected and has a developer mode opened; 4. The Node-based mobile end software automatic test method according to claim 3, wherein, traversing the mobile terminal device to query task allocation records and sub-process running states corresponding to each mobile terminal device. The matching and executing of the corresponding test task according to the sub-process, the test task information and the model of the target mobile terminal device comprises the following steps: the sub-process executes the second instruction through the first test unit to obtain model information of the target mobile terminal device; in a preset test task library, a corresponding test task is matched based on a combination condition of the test task information and the device model; 5. The Node-based mobile end software automatic test method according to claim 1, wherein, the test task is loaded, a test step sequence defined in the test task is parsed, the first and second test units in the Node service are called, and the test task is executed. The method further comprises the following steps: the sub-process disassembles the test task information to generate an interactive task flow and a parsing task flow; based on the interactive task flow, the first test unit generates a first instruction adapted to the target mobile terminal device; based on the parsing task flow, the second test unit generates a verification rule associated with the test task.
6. The Node-based mobile end software automatic test method according to claim 1, wherein, The sending of the first instruction to the target mobile terminal device by the first test unit comprises: The first test unit acquires the operation permission of the target mobile terminal device; According to the type of the target element identifier in the test task, the first test unit generates a corresponding first instruction; The first instruction is sent to the target mobile terminal device, and after waiting for a preset response time, the first test unit acquires the page focus information and judges whether the click operation is successfully executed.
7. The Node-based mobile end software automatic test method according to claim 1, wherein, If the first instruction execution has deviation detected by the second test unit, a preset bottom logic is triggered to adjust the test task, comprising: The second test unit sends a deviation signal; The first test unit receives the deviation signal, queries the connected mobile terminal device list managed by the Node service, and filters out a standby device that is compatible with the target mobile terminal device model and in an idle state; The first test unit disconnects the communication link with the target mobile terminal device, establishes a communication link with the standby device, and synchronizes the execution progress data of the original test task; The sub-process restarts the test task based on the standby device and the synchronized execution progress data; If no available standby device is filtered out, the second test unit collects the structured data and deviation information of the current page of the target mobile terminal device, generates a deviation record and stores it to the Node service, and drives the sub-process to perform the step jump operation of the test task.
8. A Node-based mobile software automatic testing system based on the Node-based mobile software automatic testing method of claims 1-7, characterized in that, Comprise: Node service module, for starting Node service, integrating first test unit and second test unit, initializing running environment and configuring execution engine parameters to adapt to the running requirements of test task; Paging management module, for performing cooperative paging in Node service, obtaining test task information to be executed and detecting target mobile terminal devices that have been connected and assigned tasks but are not working, and configuring paging cycle; Sub-process scheduling module, for starting a sub-process uniquely corresponding to the target mobile terminal device when the target mobile terminal device is detected, restarting the test task based on the standby device and the execution progress data, and driving the test task step jump; Test task module, for matching and adapting the test task according to the sub-process, test task information and target mobile terminal device model, and for decomposing test task information to generate interaction task flow and analysis task flow.
9. An electronic device, comprising: The electronic device comprises a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are used for communication with other devices, and the processor is used to execute the instructions stored in the memory, so that the electronic device executes the method of any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded and executed by the processor to execute the method of any one of claims 1-7.