A function test method, device and equipment based on a strategy tree and a storage medium

By using a policy tree-based functional testing method, test strategies are dynamically determined and test data is decoupled, enabling multi-branch parallel execution and local serial control. This solves the problem of low testing efficiency in existing technologies and improves testing efficiency and data management capabilities.

CN121255658BActive Publication Date: 2026-03-03CHONGQING LANDIAN AUTOMOBILE TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511803278.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-03
Publication Date
2026-03-03
Estimated Expiration
2045-12-03

AI Technical Summary

Technical Problem

Existing functional testing methods are mechanical, inefficient, and unable to quickly complete corresponding functional testing tasks. The test structure lacks flexibility, and the tight coupling between test data and execution logic leads to data redundancy and low testing efficiency.

Method used

A policy tree-based functional testing method is adopted, which maps test requirements to non-leaf nodes in the policy tree. The target test strategy is dynamically determined by using the preset child node test methods of the target node and its subordinate non-leaf nodes. Test cases are stored only in the leaf nodes, thereby decoupling the test strategy from the test data and supporting multi-branch parallel execution and local serial control.

Benefits of technology

It significantly improves test execution efficiency, reduces redundant storage of test data, optimizes the data management capabilities of the test architecture, solves the problems of mechanical and time-consuming testing processes, and enhances test execution efficiency and flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121255658B_ABST
    Figure CN121255658B_ABST
Patent Text Reader

Abstract

This application relates to the field of testing technology and discloses a functional testing method, apparatus, device, and storage medium based on a strategy tree. The functional testing method includes: responding to testing requirements, determining the target node in the strategy tree corresponding to the target test function in the testing requirements; leaf nodes in the strategy tree correspond to corresponding test cases; the target node refers to the non-leaf node in the strategy tree corresponding to the functional module pointed to by the testing requirements; determining the target testing strategy corresponding to the target test function based on the preset child node testing methods of the target node and all its subordinate non-leaf nodes, and using the test cases corresponding to all leaf nodes under the target node as the target test cases corresponding to the target test function; performing functional testing according to the target testing strategy and target test cases to obtain the test results corresponding to the target test function. This application significantly improves test execution efficiency while reducing the redundant storage of test data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of testing technology, specifically to a functional testing method, apparatus, device, and storage medium based on a strategy tree. Background Technology

[0002] Functional testing typically involves executing each item on a pre-defined test requirement list. Related technologies generally employ linear or hierarchical test task organization, executing all test cases sequentially in a fixed order, resulting in a lack of flexibility in the test structure. Furthermore, test data and execution logic are tightly coupled in these technologies, often with corresponding test cases configured at each node, leading to data redundancy and low testing efficiency. Summary of the Invention

[0003] In view of the above problems, this application provides a functional testing method, apparatus, device and storage medium based on strategy tree to solve the technical problems of mechanical functional testing methods, low testing efficiency and inability to quickly complete corresponding functional testing tasks.

[0004] According to one aspect of this application, a functional testing method based on a strategy tree is provided. The functional testing method includes: in response to a test requirement, determining the target node in the strategy tree corresponding to the target test function in the test requirement; the leaf nodes in the strategy tree correspond to corresponding test cases; the target node refers to the non-leaf node in the strategy tree corresponding to the functional module pointed to by the test requirement; determining the target test strategy corresponding to the target test function according to the preset child node test methods of the target node and all its subordinate non-leaf nodes, and taking the test cases corresponding to all leaf nodes under the target node as the target test cases corresponding to the target test function; performing functional testing according to the target test strategy and the target test cases to obtain the test results corresponding to the target test function.

[0005] In one optional approach, the target testing strategy corresponding to the target testing function is determined based on the preset child node testing methods of the target node and all its non-leaf nodes. This includes: traversing the target node and all its subordinate nodes, and using the preset child node testing methods of the traversed nodes as the testing methods of adjacent subordinate child nodes, until the leaf node of the corresponding node chain is traversed, thereby determining the testing methods of all nodes in each node chain under the target node, and thus determining the target testing strategy corresponding to the target testing function.

[0006] In one optional approach, the target testing strategy includes the testing order of each node; determining the testing methods for all nodes in each node chain under the target node to determine the target testing strategy corresponding to the target testing function, including: determining a first testing order for all nodes in each node chain based on the parent-child relationship between corresponding nodes in each node chain under the target node; determining a second testing order for nodes at the same level belonging to different node chains based on the testing methods of nodes at the same level; and determining the target testing strategy corresponding to the target testing function based on the testing methods of all nodes in each node chain under the target node, the first testing order, and the second testing order.

[0007] In one optional approach, the second test order of the nodes at the same level belonging to different node chains is determined based on the test methods of the nodes at the same level belonging to different node chains. This includes: if the test method of the nodes at the same level belonging to different node chains is a parallel test method, then the second test order of the nodes at the same level is the same; if the test method of the nodes at the same level belonging to different node chains is a serial test method, then the second test order of the nodes at the same level is different.

[0008] In one optional approach, the target testing strategy includes testing methods corresponding to each node under the target node, and the target test cases include sub-test cases corresponding to each node under the target node; performing functional testing according to the target testing strategy and the target test cases to obtain test results corresponding to the target test function includes: performing tests according to the testing methods and sub-test cases corresponding to each node under the target node to obtain test results corresponding to each node under the target node; and determining the test results corresponding to the target test function based on the test results corresponding to all nodes under the target node.

[0009] In one optional approach, the test result corresponding to the target test function is determined based on the test results corresponding to all nodes under the target node, including: if the test result corresponding to any node under the target node indicates test failure, then the test result corresponding to the test requirement indicates test failure; if the test results corresponding to all nodes under the target node indicate test success, then the test result corresponding to the test requirement indicates test success.

[0010] In an optional approach, the functional testing method further includes: constructing a tree structure based on the correspondence between various test functions; wherein each node in the tree structure corresponds to a different test function, and the tree structure includes multiple node chains; setting preset child node test methods for adjacent subordinate child nodes at each node in the tree structure, and storing the test cases required for the test functions corresponding to each node in each node chain into the leaf nodes of each node chain, so as to construct the strategy tree.

[0011] According to another aspect of this application, a functional testing device based on a strategy tree is provided. The functional testing device includes: a response module, configured to, in response to a test requirement, determine the target node in the strategy tree corresponding to the target test function in the test requirement; the leaf nodes in the strategy tree correspond to corresponding test cases; the target node refers to the non-leaf node in the strategy tree corresponding to the functional module pointed to by the test requirement; a determination module, configured to, based on the target node and the preset child node test methods of all its subordinate non-leaf nodes, determine the target test strategy corresponding to the target test function, and use the test cases corresponding to all the leaf nodes under the target node as the target test cases corresponding to the target test function; and a testing module, configured to, perform functional testing according to the target test strategy and the target test cases, and obtain the test results corresponding to the target test function.

[0012] According to one aspect of this application, an electronic device is provided, comprising: a controller; and a memory for storing one or more programs, which, when executed by the controller, perform the aforementioned functional testing method.

[0013] According to one aspect of this application, a computer-readable storage medium is also provided, on which computer-readable instructions are stored, which, when executed by a computer's processor, cause the computer to perform the above-described functional testing method.

[0014] According to one aspect of this application, a computer program product or computer program is also provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned functional testing method.

[0015] This application maps test requirements to target nodes in a strategy tree (non-leaf nodes) and dynamically determines the target test strategy using preset child node testing methods within the target node and all its non-leaf nodes. Test cases are stored only in leaf nodes, thus decoupling the test strategy from the test data. Because the strategy tree structure supports a combination of multi-branch parallel execution and local serial control, it avoids the efficiency bottleneck caused by sequential execution, thereby solving the problems of mechanical and time-consuming testing processes, significantly improving test execution efficiency, reducing redundant storage of test data, and optimizing the overall test architecture's data management capabilities.

[0016] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0018] Figure 1 This is a flowchart illustrating a policy tree-based functional testing method according to an exemplary embodiment of this application.

[0019] Figure 2 This is a schematic diagram of the strategy tree structure shown in an exemplary embodiment of this application.

[0020] Figure 3 Based on Figure 1 The exemplary embodiment shown illustrates a flowchart of another policy tree-based functional testing method.

[0021] Figure 4 Based on Figure 3 The exemplary embodiment shown illustrates a flowchart of another policy tree-based functional testing method.

[0022] Figure 5 This is a schematic diagram illustrating an application scenario of the functional testing method based on the strategy tree proposed in this application.

[0023] Figure 6 This is a schematic diagram of the structure of a policy tree-based functional testing device illustrated in an exemplary embodiment of this application.

[0024] Figure 7This is a schematic diagram of the structure of a computer system for an electronic device illustrated in an exemplary embodiment of this application. Detailed Implementation

[0025] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0026] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0027] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0028] In this application, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0029] Functional testing typically relies on linear test requirement forms, executing test cases for each function one by one in a preset order. Related technologies generally adopt linear or hierarchical test task organization methods, executing all test cases sequentially in a fixed order. The test structure lacks flexibility, which severely restricts testing efficiency and delivery speed, especially in continuous integration and high-frequency iteration scenarios, and cannot meet the requirement of quickly verifying all functional test requirements.

[0030] To address this issue, one aspect of this application provides a strategy tree-based functional testing method to solve the technical problems of mechanical functional testing methods, low testing efficiency, and inability to quickly complete corresponding functional testing tasks. Please refer to [link / reference] for details. Figure 1 , Figure 1 This is a flowchart illustrating a policy tree-based functional testing method according to an exemplary embodiment of this application. The functional testing method includes at least steps S110 to S130, which are described in detail below:

[0031] S110: In response to test requirements, determine the target node in the strategy tree corresponding to the target test function in the test requirements; the leaf nodes in the strategy tree correspond to the corresponding test cases; the target node refers to the non-leaf node in the strategy tree corresponding to the functional module pointed to by the test requirements.

[0032] Test requirements are user-inputted test task instructions, which contain one or more identifiers for functions to be tested (such as ID numbers or function names). Based on these instructions, the set of target test functions to be executed is parsed out and mapped one by one to the corresponding node positions in a pre-built strategy tree structure. The strategy tree is a tree-like data structure used to organize and manage the functional testing process. Each node represents a functional module or set of sub-functions. The root node represents the highest-level test set (such as whole-vehicle system-level testing), the intermediate non-leaf nodes represent functional subsystems (such as media, navigation, etc.), and the bottom-level leaf nodes correspond to specific sets of executable test cases.

[0033] The target node specifically refers to the non-leaf node in the strategy tree corresponding to the functional module targeted by the test requirement. Please refer to [link / reference]. Figure 2 , Figure 2 This is a schematic diagram of the strategy tree structure shown in an exemplary embodiment of this application. If the test requirement is "execute media subsystem testing", its corresponding target node in the strategy tree is B. The B node itself does not directly store test cases, but instead acts as a parent node to manage its adjacent subordinate child nodes F and leaf nodes H. Of course, if there are multiple test requirements, the corresponding target nodes are multiple non-leaf nodes.

[0034] In this embodiment, the target node is a non-leaf node, which means that this application focuses on the overall scheduling and execution control of the composite functional module, rather than the direct triggering of a single test case. If the target node is a leaf node, then the single function test is performed directly based on the test cases required for its own test stored therein.

[0035] The strategy tree is constructed based on the hierarchical and dependency relationships between functional modules. Combined with... Figure 2 As an example, the "cockpit return set" serves as the top-level functional module (corresponding to...). Figure 2 Node A (root node) in the table, which includes "User Account Login" (corresponding to...). Figure 2 The D node (leaf node) and the "media subsystem" (corresponding to) Figure 2 Node B in the middle layer (non-leaf nodes), "Navigation and Voice" (corresponding to...) Figure 2 The test structure comprises multiple sub-modules, including the C node in the main structure and non-leaf nodes in the intermediate layer, forming a multi-level node chain. By transforming the functional logic into a tree topology, a hierarchical expression of the test structure is achieved, providing basic support for flexible scheduling.

[0036] This section provides an example of how the strategy tree is constructed: A tree structure is built based on the correspondence between various test functions; each node in the tree structure corresponds to a different test function, and the tree structure includes multiple node chains; preset child node test methods are set for adjacent child nodes at each node in the tree structure, such as... Figure 2 In the code A (parallel), "(parallel)" indicates that the preset child node testing method is set at node A, meaning that the testing method for the adjacent child nodes D, B, and C of node A is a parallel testing method. The test cases required for the test functions corresponding to each node in each node chain are stored in the leaf nodes of each node chain to construct the strategy tree.

[0037] Based on the functional module division and logical dependencies of the actual system under test, the test functions are organized hierarchically. For example, in an intelligent cockpit system, functional modules such as the "media subsystem," "navigation and voice," and "user account management" are both independent and may share basic services. Therefore, they can be abstracted as parallel child nodes under the same parent node, forming a hierarchical test system. This tree structure uses a directed acyclic graph to express the inclusion and scheduling relationships between parent and child nodes. Each non-leaf node represents a composite test function or test set, while the subordinate nodes of each non-leaf node represent the sub-functions further decomposed from that function. In this way, the entire test system can be structurally modeled, facilitating management and expansion.

[0038] In the tree structure, each node corresponds to a different test function; that is, each node is semantically bound to an executable test task unit. For example, ... Figure 2 As shown, node A corresponds to "cockpit regression testing", node B corresponds to "media subsystem testing", and node D corresponds to "user account login and vehicle system authorization". This mapping relationship allows testers to intuitively understand the functional positioning of each node and supports selecting specific functional paths for test execution as needed.

[0039] A tree structure consists of multiple node chains, which are complete paths that start from the root node or any non-leaf node and extend downwards through its child nodes until they reach a leaf node. For example, ... Figure 2 As shown, A→B→F→H and A→C→G are two independent node chains. Each node chain reflects the test flow of a branch test function. Multiple chains together form a test network covering the entire system, which facilitates the modular organization and parallel scheduling of test tasks.

[0040] The preset child node test mode refers to the test mode configured in each non-leaf node in the strategy tree. It defines the test mode for its direct child nodes (i.e., adjacent subordinate child nodes), specifically including serial and parallel test modes. This test mode is embedded as metadata in the node attributes and does not involve the storage of actual test data. For example, if a node is configured for parallel testing, all its child nodes will be started concurrently; if configured for serial testing, the child nodes will be executed sequentially in a predetermined order.

[0041] The terminal nodes (leaf nodes) of the tree structure store specific test cases, such as input parameters, expected outputs, and validation rules. Non-leaf nodes do not store any test cases; they only handle process control. For example, ... Figure 2 As shown, node H (Bluetooth pairing and phone call) is a leaf node, storing test cases 12101 (the test case required for the initial Bluetooth pairing, i.e., the test case required for the test function corresponding to node F) and 12102 (the test case required for incoming call connection to the vehicle system, i.e., the test case required for the test function corresponding to node H), etc. The parent node F (media subsystem) of node H does not store test cases, but the execution order of H is controlled by configuring a serial testing method; that is, the "(serial)" in node F represents the testing method of node H. This centralized data management mode effectively avoids the data redundancy and maintenance difficulties caused by multi-level repetitive configuration in traditional methods, while also decoupling the test flow control logic from the test data, improving the flexibility and reusability of the test strategy.

[0042] S120: Based on the preset child node testing methods of the target node and all its non-leaf nodes, determine the target testing strategy corresponding to the target test function, and take the test cases corresponding to all leaf nodes under the target node as the target test cases corresponding to the target test function.

[0043] All subordinate non-leaf nodes refer to all non-leaf nodes subordinate to the target node, such as... Figure 2 As shown, if the target node is A, then all its non-leaf nodes are nodes B, C, and F.

[0044] Preset child node test methods refer to the test methods configured in each non-leaf node of the strategy tree. These define the test methods for its direct child nodes (i.e., adjacent subordinate child nodes), specifically including both serial and parallel test methods. The preset child node test methods are embedded as metadata in the node attributes and do not affect the actual content of the test cases. For example, ... Figure 2 As shown, node B is set to "serial", indicating that its child node F is tested in a serial testing mode; while node C is set to "parallel", indicating that its child nodes G and E can be started simultaneously, that is, their testing mode is parallel testing mode.

[0045] The target testing strategy is a complete testing strategy formed by inheriting and combining the testing methods of each level of nodes during the recursive traversal starting from the target node. It covers the testing methods of all subordinate nodes of the target node. This strategy is dynamically generated, requires no pre-fixing, and is highly adaptable. For example, ... Figure 2 As shown, when the target node is A, its three branches D, B, and C are started concurrently due to the parallel testing mode set in A; while within the B subtree, since B itself uses a serial testing mode, F and H still maintain serial testing, thus achieving a hybrid scheduling of external parallel and internal serial testing.

[0046] The target test cases are derived by starting from the target node and searching downwards through the policy tree to all reachable leaf nodes, collecting the set of test cases associated with these leaf nodes. Since only leaf nodes store actual test data (such as input parameters, expected output, and execution scripts), the target test cases are the collection of test cases required for all underlying test items covered by the target node. For example, ... Figure 2 As shown, after selecting node B (which corresponds to the test function of the media subsystem), the test cases stored in H are automatically extracted. That is, the test cases required for the test function corresponding to node F and the test cases required for the test function corresponding to node H constitute a complete test set of the media subsystem.

[0047] This embodiment avoids the redundancy problem caused by repeatedly storing test cases in non-leaf nodes, achieving centralized management of test data. Furthermore, by separating strategy from data, the same set of test cases can be executed according to different strategies in different upper and lower nodes, improving the reusability and scheduling flexibility of test resources.

[0048] S130: Perform functional testing based on the target testing strategy and target test cases to obtain the test results corresponding to the target test functions.

[0049] The target testing strategy includes testing methods for different nodes, namely serial testing and parallel testing. During functional testing based on the target testing strategy and target test cases, for parallel branches in the strategy tree, multiple independent execution threads or task coroutines are used to handle different sub-paths respectively; for serial branches in the strategy tree, they are executed one by one in topological order. If the current node fails, the test can be interrupted or the remaining test cases can continue to be executed, depending on the configuration strategy in the specific scenario.

[0050] The test results are a summary of the status after the entire target test function has been executed, typically represented by one of three states: success, failure, or interruption. The result determination follows a bottom-up aggregation mechanism: each leaf node returns a local result after execution, which is then merged upwards level by level, and finally the overall conclusion is generated by the target node.

[0051] For example, the target testing strategy includes the testing methods corresponding to each node under the target node, and the target test cases include the sub-test cases corresponding to each node under the target node. S130 includes: performing tests according to the testing methods and sub-test cases corresponding to each node under the target node to obtain the test results corresponding to each node under the target node; and determining the test results corresponding to the target test function based on the test results corresponding to all nodes under the target node.

[0052] Each leaf node stores sub-test cases for all nodes in its chain except the target node (including sub-test cases required by the leaf node itself). A sub-test case is the collective term for all test cases required for a single node. Each node can require one or more sub-test cases, for example... Figure 2 The sub-test cases required for node D include test cases for performing account login tests and test cases for performing vehicle system authorization refresh tests. The sub-test cases required for node E only include test cases for performing voice assistant tests. Non-leaf nodes do not store test cases themselves; they only aggregate the test content from their subordinate leaf nodes through structural relationships to avoid data redundancy.

[0053] There is a hierarchical mapping relationship between the test methods corresponding to each node and their subordinate sub-test cases: the preset test method of any non-leaf node determines the test method (serial test method or parallel test method) of its adjacent subordinate sub-nodes, and the associated sub-test cases are derived from the test cases in the descendant leaf nodes of the recursive aggregation. This hierarchical organization allows test execution to both expand local functional verification as needed and support batch execution of the entire branch.

[0054] For example, if the test result corresponding to any node under the target node indicates test failure, then the test result corresponding to the test requirement also indicates test failure. For instance, such as... Figure 2 As shown, node A corresponds to the target test function. If any test case in F fails to execute, subtree B returns failure, which in turn affects the overall test result of node A. The test result of the target test function corresponding to node A represents test failure, that is, the test result corresponding to the test requirement represents test failure.

[0055] If the test results for all nodes under the target node indicate test success, then the test result corresponding to the test requirement indicates test success. For example, Figure 2 As shown, node A corresponds to the target test function. If the test results of nodes D, B, C, F, G, E, and H under node A all indicate that the test was successful, the test result of the target test function corresponding to node A indicates that the test was successful. That is, the test result corresponding to the test requirement indicates that the test was successful.

[0056] This embodiment maps test requirements to target nodes in the non-leaf nodes of the strategy tree, and dynamically determines the target test strategy using preset child node testing methods of the target node and all its non-leaf nodes. Test cases are stored only in the leaf nodes, thus decoupling the test strategy from the test data. Because the strategy tree structure supports a combination of multi-branch parallel execution and local serial control, it avoids the efficiency bottleneck caused by traditional sequential execution, thereby solving the problems of mechanical and time-consuming testing processes, significantly improving test execution efficiency, reducing redundant storage of test data, and optimizing the overall test architecture's data management capabilities.

[0057] In another exemplary embodiment of this application, it is described in detail how to determine the target test strategy corresponding to the target test function based on the preset child node test methods of the target node and all its non-leaf nodes. Please refer to [link to relevant documentation] for details. Figure 3 , Figure 3 Based on Figure 1 The exemplary embodiment shown illustrates a flowchart of another policy tree-based functional testing method. This functional testing method, in situations such as... Figure 1 S120 shown includes S310, which is described in detail below:

[0058] S310: Traverse the target node and all its subordinate nodes, and use the preset child node test method of the traversed node as the test method of the adjacent subordinate child node, until the leaf node of the corresponding node chain is traversed, to determine the test method of all nodes in each node chain under the target node, so as to determine the target test strategy corresponding to the target test function.

[0059] This embodiment systematically traverses the subtree structure starting from the target node in the strategy tree to deduce and construct complete test execution logic. By accessing the target node and its subordinate nodes layer by layer, it inherits and applies the preset child node test methods configured by each non-leaf node, thereby assigning clear test methods (such as serial test methods or parallel test methods) to the test tasks within the entire subtree range, and finally forming a coherent target test strategy.

[0060] For example, starting from the target node, a graph traversal algorithm such as depth-first search or breadth-first search is used to recursively visit its direct child nodes and grandchild nodes until all paths reach the leaf nodes (i.e., terminal nodes that only store test cases and have no child nodes), generating a complete test strategy that includes the execution order and concurrency relationships of the entire path. This strategy not only covers the test order within each branch (such as...) Figure 2 (F→H serial), and also supports parallel scheduling across branches (such as...) Figure 2 (D, B, and C can run concurrently), thereby achieving efficient organization in complex testing scenarios.

[0061] The traversal process ensures coverage of all test content associated with the target test function (i.e., the test functions corresponding to all subordinate nodes), avoiding omissions. For example, Figure 2 As shown, if the target node is B (corresponding to the test function of the media subsystem), the traversal range includes B itself, F (corresponding to the test function of Bluetooth pairing and telephone) and H (corresponding to the test function of local / USB media playback). H is a leaf node that stores the sub-test cases required for its own corresponding test function, as well as the sub-test cases required for the corresponding test functions of B and F. H no longer has child nodes.

[0062] The pre-defined child node testing method (i.e., the scheduling method for its direct children) in each non-leaf node will be applied to its subordinate child nodes. For example, ... Figure 2 As shown, the preset child node test mode set at node B is the serial test mode, indicating that the test mode of its child node F is the serial test mode; the preset child node test mode set at node C is the parallel test mode, indicating that nodes G and E can be started and executed simultaneously.

[0063] This embodiment comprehensively determines the testing methods corresponding to all child nodes under the target node through a traversal mechanism, solving the problem of execution chaos or inefficiency caused by the lack of structured scheduling in related testing methods. Therefore, it achieves the technical effect of improving the completeness and consistency of the testing strategy, and enhances the controllability and automation level of the testing process. Furthermore, this method is applicable to strategy trees with various topologies and can adapt to dynamically changing test requirement sets, exhibiting good scalability and engineering practicality.

[0064] In another exemplary embodiment of this application, it is described in detail how to determine the testing methods for all nodes in each node chain under the target node, so as to determine the target testing strategy corresponding to the target testing function. Please refer to [link to relevant documentation] for details. Figure 4 , Figure 4 Based on Figure 3 The exemplary embodiment shown illustrates a flowchart of another policy tree-based functional testing method. This functional testing method, in situations such as... Figure 3 S310 shown includes S410 to S430; the target testing strategy includes the testing order of each node, which is described in detail below:

[0065] S410: Determine the first test order for all nodes in each node chain based on the parent-child relationship between the corresponding nodes in each node chain under the target node.

[0066] During functional testing, it's crucial not only to determine whether each node will be tested sequentially or in parallel, but also to finely control the execution order of each test task. This test order, as the core of the testing strategy, determines the timing logic and resource scheduling relationships between multiple sub-test tasks, thus affecting overall testing efficiency and system load balance. For example, in regression testing of an in-vehicle infotainment system, if the navigation module and voice assistant module can run independently, they can be started in parallel through proper sequencing, avoiding the wasted time caused by traditional sequential waiting. In this embodiment, the target testing strategy is to limit the test order of each node.

[0067] The first test order represents the test order among nodes belonging to the same node chain. It is determined based on the hierarchical dependencies within the policy tree structure, specifically the vertical execution path from the parent node to the leaf node within the same node chain. For example, the test order of the parent node precedes the test order of its child nodes. Since non-leaf nodes represent corresponding test functions, their subordinate child nodes have logical inclusion relationships. Therefore, the first test order follows a depth-first or breadth-first traversal rule and is dynamically adjusted in conjunction with the preset child node testing method (serial / parallel). For example, if a non-leaf node is tested serially, its adjacent child nodes must be executed sequentially according to the encoded order or explicit arrangement order; if it is tested in parallel, its adjacent child nodes start testing concurrently, but still retain their logical position in the scheduling queue for result aggregation and exception propagation judgment.

[0068] S420: Determine the second testing order of nodes at the same level based on the testing method of nodes belonging to different node chains.

[0069] Nodes at the same level are nodes in the policy tree that have the same level depth but belong to different subtree branches.

[0070] The second test order characterizes the test order between nodes of the same level belonging to different node chains. It is a parallel test order set for horizontal coordination between cross-branch and same-level nodes. If there are non-leaf nodes at the same level in multiple node chains, these nodes, although belonging to different functional paths (i.e., different node chains), are comparable at the execution scheduling level.

[0071] The second test sequence is planned based on the testing methods corresponding to nodes at the same level to uniformly schedule their start times: if two nodes at the same level are both tested in parallel mode, they are considered as test tasks that can be activated simultaneously and assigned the same scheduling priority; if either of the two nodes at the same level is tested in serial mode, resource contention and isolation between upstream and downstream nodes need to be considered, and the test sequences of the two nodes at the same level will be different. For example, if the testing methods of nodes at the same level belonging to different node chains are parallel, the second test sequence of nodes at the same level is the same; if the testing methods of nodes at the same level belonging to different node chains are serial, the second test sequence of nodes at the same level is different.

[0072] If nodes at the same level are tested in parallel, there is no execution order dependency between them, therefore they are given the same second test order. This means that these nodes can be triggered simultaneously without waiting for other sibling nodes to complete. For example, ... Figure 2 As shown, node A is set to a parallel strategy, and its child nodes D, B, and C can all start and execute at the same time. Regardless of how they are subsequently scheduled internally, they appear to start synchronously from the outside, thereby maximizing the utilization of computing resources and improving the overall test throughput.

[0073] If nodes at the same level are tested sequentially, they are configured with different second test orders to ensure orderliness during execution. For example, if the child nodes adjacent to a parent node are tested sequentially, these child nodes are executed one by one in a specified order. Each node can be assigned a unique execution sequence number according to preset rules (such as ascending node ID, configured priority, or user-defined order) to avoid race conditions or resource conflicts.

[0074] S430: Determine the target test strategy corresponding to the target test function based on the test methods, first test order and second test order of all nodes in the chain of each node under the target node.

[0075] Testing methods include not only serial / parallel testing methods, but also specific testing steps, to guide the successful implementation of testing tasks.

[0076] Based on the vertical nodes under the target node (such as...) Figure 2 The first test order among nodes B, F, and H (which are vertical nodes under target node A), and the horizontal nodes (such as...) Figure 2The second test order (where nodes D, B, and C are vertical nodes subordinate to target node A) determines the overall test order. This, combined with the test methods for all nodes subordinate to the target node, generates the target test strategy, which is then used to test the target functionality using corresponding test cases. The first test order ensures logical coherence and dependency integrity within a single functional path, while the second test order enables collaborative scheduling and resource optimization across multiple paths. Both work together in the generation of the target test strategy, enabling the system to maximize computational resource utilization and reduce idle waiting time while maintaining test coverage.

[0077] This embodiment implements dual-dimensional management of the test order for test tasks. By introducing a first test order based on parent-child relationships and a second test order based on same-level node testing, it solves the problems of long test cycles and low resource utilization caused by relying solely on linear lists for item-by-item execution in related technologies, thus effectively improving the overall throughput of functional testing.

[0078] In another exemplary embodiment of this application, the application scenarios of the above-mentioned multiple functional testing methods are illustrated by way of example. Please refer to the following for details. Figure 5 , Figure 5 This is a schematic diagram illustrating an application scenario of the policy tree-based functional testing method of this application. It includes an interactive interface 100 and a server 200, which can be connected wirelessly. This application does not limit the connection method between them.

[0079] Users can input test requirements into the interactive interface 100, which then sends the test requirements to the server 200. The server 200 acts as the execution entity for any of the above-mentioned functional test methods, and executes any of the above-mentioned functional test methods. An example is described below:

[0080] In response to testing requirements, the target node in the strategy tree corresponding to the target test function in the testing requirements is determined; the leaf nodes in the strategy tree correspond to the corresponding test cases; the target node refers to the non-leaf node in the strategy tree corresponding to the functional module pointed to by the testing requirements; based on the preset child node test methods of the target node and all its subordinate non-leaf nodes, the target test strategy corresponding to the target test function is determined, and the test cases corresponding to all leaf nodes under the target node are used as the target test cases corresponding to the target test function; functional testing is performed according to the target test strategy and target test cases to obtain the test results corresponding to the target test function.

[0081] Server 200 can be a standalone physical server, or a server cluster or distributed system consisting of multiple physical servers. Multiple servers can form a blockchain, and the server is a node on the blockchain. Server 200 can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. This document does not impose any restrictions on this.

[0082] Another aspect of this application provides a functional testing device based on a strategy tree, such as... Figure 6 As shown, Figure 6 This is a schematic diagram illustrating the structure of a policy tree-based functional testing apparatus according to an exemplary embodiment of this application. The functional testing apparatus 600 includes:

[0083] The response module 610 is used to respond to test requirements and determine the target node in the strategy tree corresponding to the target test function in the test requirements; the leaf nodes in the strategy tree correspond to the corresponding test cases; the target node refers to the non-leaf node in the strategy tree corresponding to the functional module pointed to by the test requirements.

[0084] The determination module 630 is used to determine the target test strategy corresponding to the target test function based on the preset child node test methods of the target node and all its non-leaf nodes, and to take the test cases corresponding to all leaf nodes under the target node as the target test cases corresponding to the target test function.

[0085] Test module 650 is used to perform functional testing based on the target testing strategy and target test cases, and obtain the test results corresponding to the target test functions.

[0086] In another exemplary embodiment, the determining module 630 includes:

[0087] The traversal unit is used to traverse the target node and all its subordinate nodes, and uses the preset child node test methods of the traversed nodes as the test methods of the adjacent subordinate child nodes, until the leaf node of the corresponding node chain is traversed, thereby determining the test methods of all nodes in each node chain under the target node, and thus determining the target test strategy corresponding to the target test function.

[0088] In another exemplary embodiment, the target testing strategy includes the testing order of each node; the traversal unit includes:

[0089] The first test order determination module is used to determine the first test order for all nodes in each node chain based on the parent-child relationship between corresponding nodes in each node chain under the target node.

[0090] The second test order determination module is used to determine the second test order of nodes at the same level based on the test methods of nodes belonging to different node chains.

[0091] The target test strategy determination section is used to determine the target test strategy corresponding to the target test function based on the test methods, first test order, and second test order of all nodes in the chain of each node under the target node.

[0092] In another exemplary embodiment, the second test order determination module includes:

[0093] The first sub-module is used to ensure that if the testing method for nodes of the same level belonging to different node chains is a parallel testing method, then the second testing order for nodes of the same level is the same.

[0094] The second determining sub-module is used to determine the second test order of nodes of the same level that belong to different node chains if the test method is a serial test method.

[0095] In another exemplary embodiment, the target testing strategy includes testing methods corresponding to each node under the target node, and the target test cases include sub-test cases corresponding to each node under the target node; the test module 650 includes:

[0096] The first test unit is used to perform tests according to the test methods and sub-test cases corresponding to each node under the target node, so as to obtain the test results corresponding to each node under the target node.

[0097] The second testing unit is used to determine the test results corresponding to the target test function based on the test results of all nodes under the target node.

[0098] In another exemplary embodiment, the second test unit includes:

[0099] The test failure section is used to indicate that if the test result corresponding to any node under the target node indicates a test failure, then the test result corresponding to the test requirement indicates a test failure.

[0100] The "Test Successful" section indicates that if the test results for all nodes under the target node represent test success, then the test result corresponding to the test requirement represents test success.

[0101] In another exemplary embodiment, the functional testing apparatus 600 further includes:

[0102] The tree structure building module is used to construct a tree structure based on the correspondence between various test functions; each node in the tree structure corresponds to a different test function, and the tree structure includes multiple node chains.

[0103] The strategy tree construction module is used to set the preset child node test methods for adjacent child nodes at each node in the tree structure, and to store the test cases required for the test functions corresponding to each node in each node chain to the leaf nodes in each node chain to construct the strategy tree.

[0104] This functional testing device maps test requirements to target nodes in a strategy tree (non-leaf nodes) and dynamically determines the target test strategy using preset child node testing methods within the target node and all its non-leaf nodes. Test cases are stored only in leaf nodes, thus decoupling the test strategy from the test data. Because the strategy tree structure supports a combination of multi-branch parallel execution and local serial control, it avoids the efficiency bottleneck of traditional sequential execution, thereby solving the problems of mechanical and time-consuming testing processes, significantly improving test execution efficiency, reducing redundant storage of test data, and optimizing the overall test architecture's data management capabilities.

[0105] It should be noted that the functional testing device provided in the above embodiments and the functional testing method provided in the foregoing embodiments belong to the same concept. The specific way in which each module and unit performs operations has been described in detail in the method embodiments, and will not be repeated here.

[0106] Another aspect of this application provides an electronic device, including: a controller; and a memory for storing one or more programs, which, when executed by the controller, perform the aforementioned functional testing method.

[0107] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of a computer system for an electronic device according to an exemplary embodiment of this application, illustrating a schematic diagram of the structure of a computer system suitable for implementing the embodiments of this application.

[0108] It should be noted that, Figure 7 The computer system 700 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0109] like Figure 7As shown, the computer system 700 includes a Central Processing Unit (CPU) 701, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on programs stored in Read-Only Memory (ROM) 702 or programs loaded from storage portion 708 into Random Access Memory (RAM) 703. The RAM 703 also stores various programs and data required for system operation. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An Input / Output (I / O) interface 705 is also connected to the bus 704.

[0110] The following components are connected to I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to I / O interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 710 as needed so that computer programs read from it can be installed into storage section 708 as needed.

[0111] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 709, and / or installed from removable medium 711. When the computer program is executed by central processing unit (CPU) 701, it performs various functions defined in the system of this application.

[0112] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0113] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0114] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.

[0115] Another aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned functional testing method. This computer-readable storage medium may be included in the electronic device described in the above embodiments, or it may exist independently and not assembled into the electronic device.

[0116] Another aspect of this application provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the functional testing methods provided in the various embodiments described above.

[0117] According to one aspect of the embodiments of this application, a computer system is also provided, including a Central Processing Unit (CPU), which can perform various appropriate actions and processes based on a program stored in read-only memory (ROM) or a program loaded from storage into random access memory (RAM), such as performing the methods described above. Various programs and data required for system operation are also stored in the RAM. The CPU, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.

[0118] The following components are connected to the I / O interface: input components including keyboards, mice, etc.; output components including cathode ray tubes (CRTs), liquid crystal displays (LCDs), and speakers; storage components including hard drives; and communication components including network interface cards such as LAN (Local Area Network) cards and modems. The communication components perform communication processing via networks such as the Internet. Drives are also connected to the I / O interface as needed. Removable media, such as disks, optical discs, magneto-optical discs, semiconductor memories, etc., are installed on the drive as needed so that computer programs read from them can be installed into the storage components as required.

[0119] The above content is merely a preferred exemplary embodiment of this application and is not intended to limit the implementation of this application. Those skilled in the art can easily make corresponding modifications or alterations based on the main concept and spirit of this application. Therefore, the scope of protection of this application should be determined by the scope of protection claimed in the claims.

Claims

1. A functional testing method based on a strategy tree, characterized in that, The functional testing method includes: A tree structure is constructed based on the correspondence between various test functions; wherein each node in the tree structure corresponds to a different test function, and the tree structure includes multiple node chains; In the tree structure, preset child node test methods are set for adjacent subordinate child nodes at each node, and the test cases required for the test functions corresponding to each node in each node chain are stored in the leaf nodes of each node chain to construct a strategy tree; In response to testing requirements, the target node corresponding to the target test function in the test requirements is determined in the strategy tree; the leaf nodes in the strategy tree correspond to corresponding test cases; the target node refers to the non-leaf node corresponding to the functional module pointed to by the test requirements in the strategy tree. The process iterates through the target node and all its subordinate nodes, using the preset child node test methods of the traversed nodes as the test methods for adjacent subordinate child nodes, until the leaf node of the corresponding node chain is reached. This process determines the test methods for all nodes in each node chain under the target node, thereby determining the target test strategy corresponding to the target test function. The target test strategy includes test methods corresponding to different nodes, including serial test methods and parallel test methods. The test cases corresponding to all leaf nodes under the target node are used as the target test cases corresponding to the target test function. Functional testing is performed based on the target testing strategy and the target test cases to obtain the test results corresponding to the target test functions.

2. The functional testing method according to claim 1, characterized in that, The target testing strategy includes the testing order of each node; Determine the testing methods for all nodes in each node chain under the target node, and thus determine the target testing strategy corresponding to the target testing function, including: Based on the parent-child relationship between corresponding nodes in each node chain under the target node, determine the first test order corresponding to all nodes in each node chain; The second testing order of the nodes at the same level belonging to different node chains is determined based on the testing method. Based on the testing methods of all nodes in each node chain under the target node, the first testing order, and the second testing order, the target testing strategy corresponding to the target testing function is determined.

3. The functional testing method according to claim 2, characterized in that, The second testing order of the nodes at the same level, belonging to different node chains, is determined based on the testing methods, including: If the testing method for nodes of the same level belonging to different node chains is the parallel testing method, then the second testing order of the nodes of the same level is the same; If the testing method for nodes of the same level belonging to different node chains is the serial testing method, then the second testing order of the nodes of the same level is different.

4. The functional testing method according to claim 1, characterized in that, The target testing strategy includes the testing methods corresponding to each node under the target node, and the target test cases include the sub-test cases corresponding to each node under the target node. Functional testing is performed based on the target testing strategy and the target test cases to obtain test results corresponding to the target test functions, including: Tests are performed according to the test methods and sub-test cases corresponding to each node under the target node to obtain the test results corresponding to each node under the target node; The test results corresponding to the target test function are determined based on the test results of all nodes under the target node.

5. The functional testing method according to claim 4, characterized in that, The test results corresponding to the target test function are determined based on the test results of all nodes under the target node, including: If the test result corresponding to any node under the target node indicates test failure, then the test result corresponding to the test requirement indicates test failure. If the test results for all nodes under the target node indicate that the test was successful, then the test result corresponding to the test requirement indicates that the test was successful.

6. A functional testing device based on a strategy tree, characterized in that, The functional testing device includes: A tree structure construction module is used to construct a tree structure based on the correspondence between various test functions; wherein, each node in the tree structure corresponds to a different test function, and the tree structure includes multiple node chains; The strategy tree construction module is used to set the preset child node test methods of adjacent subordinate child nodes at each node in the tree structure, and to store the test cases required for the test functions corresponding to each node in each node chain to the leaf nodes in each node chain to construct the strategy tree. The response module is used to respond to test requirements and determine the target node in the strategy tree corresponding to the target test function in the test requirements; the leaf nodes in the strategy tree correspond to corresponding test cases; the target node refers to the non-leaf node in the strategy tree corresponding to the functional module pointed to by the test requirements. The determination module is used to traverse the target node and all its subordinate nodes, and use the preset child node test methods of the traversed nodes as the test methods of adjacent subordinate child nodes, until the leaf node of the corresponding node chain is traversed, thereby determining the test methods of all nodes in each node chain under the target node, and thus determining the target test strategy corresponding to the target test function; the target test strategy includes test methods corresponding to different nodes, and the test methods include serial test methods and parallel test methods; and the test cases corresponding to all leaf nodes under the target node are used as target test cases corresponding to the target test function. The testing module is used to perform functional testing according to the target testing strategy and the target test cases, and obtain the test results corresponding to the target test functions.

7. An electronic device, characterized in that, include: Controller; A memory for storing one or more programs, which, when executed by a controller, cause the controller to perform the functional test method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, It stores computer-readable instructions that, when executed by the computer's processor, cause the computer to perform the functional test method described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Test case management method and device based on tree structure and terminal

    CN110334024A

  • Automatic interface test case execution method and device

    CN112905461A