Class integration test sequence generation method based on graph neural network and D3QN
By combining graph neural networks with the D3QN algorithm, an object relationship graph is constructed and multi-dimensional features are integrated to generate a deterministic class integration test order. This solves the problems of one-sided importance assessment and low test sequence generation efficiency in existing technologies, and improves the integration test efficiency of embodied intelligent systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-23
- Publication Date
- 2026-04-14
AI Technical Summary
In class integration testing of object-oriented software, existing technologies rely on a single importance evaluation metric and fail to dynamically adjust class importance, resulting in low efficiency in test sequence generation and poor timing for critical class testing. Deep reinforcement learning methods suffer from Q-value overestimation and target mismatch, making them difficult to adapt to the complex structures of embodied intelligent systems.
By combining graph neural networks with the D3QN algorithm, a composite node feature is generated by constructing an object relationship graph and fusing graph embedding features and centrality features. Then, a deterministic class integration test order is generated using a multi-layer graph neural network scoring model and a Markov decision process, and the class importance is dynamically adjusted and the test sequence is optimized.
It achieves automated, efficient, and deterministic generation of class integration test sequences, significantly improving the integration testing efficiency of embodied intelligent systems and solving the problems of one-sided importance assessment and unstable training in existing methods.
Smart Images

Figure CN121858435A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software testing technology, and in particular to a method for generating class integration test sequences based on graph neural networks and D3QN. Background Technology
[0002] In the integration testing of object-oriented software, class integration test sequence generation is a critical issue. The goal is to determine the testing order of classes during the testing process to minimize testing costs and improve testing efficiency. Currently, several methods have been proposed to solve the class integration test sequence generation problem, mainly including graph theory-based methods, search-based methods, and reinforcement learning-based methods. These are detailed below:
[0003] 1. Graph Theory-Based Approaches: Graph theory-based approaches are among the earliest and most widely used solutions for generating class integration test sequences. These methods abstract inter-class dependencies into object relationship graphs and generate test sequences by analyzing these dependencies. However, this approach has a simplistic structure, primarily focusing on optimizing test stub costs while neglecting the impact of class importance on testing efficiency. Placing important classes late in the test sequence increases the cost of fault detection and repair. Furthermore, when breaking loops, it relies solely on edge weights and test stub complexity, failing to dynamically adjust class importance, resulting in important classes not being tested first. Existing methods often use local metrics to measure class importance, lacking a comprehensive consideration of global importance and structural hole characteristics, leading to incomplete class importance assessments.
[0004] 2. Search-based methods: Search-based methods model the class integration test sequence generation problem as a multi-objective optimization problem, searching for the optimal test sequence using algorithms such as genetic algorithms, simulated annealing, and particle swarm optimization. These methods optimize only the cost of test stubs, neglecting the impact of class importance on testing efficiency. Furthermore, due to the randomness of the algorithms, different test sequences may be generated each time, lacking determinism. In practical applications for large-scale software, the search time is long, making widespread practical use difficult.
[0005] 3. Reinforcement learning-based methods: These methods learn optimal test sequence strategies through the interaction between the agent and the environment. However, this requires a significant amount of time to train the agent, making it unsuitable for scenarios requiring rapid test sequence generation. Furthermore, they only use test stub cost as a reward, failing to consider the contribution of class importance to testing efficiency. Additionally, they do not dynamically adjust class importance based on testing progress, leading to poor timing for testing important classes.
[0006] In recent years, deep reinforcement learning techniques have been further introduced into this field due to their powerful sequence decision-making capabilities. Representative algorithms include Deep Q-Networks (DQN), Dual Deep Q-Networks (DDQN), Proximal Policy Optimization (PPO), and Flexible Actor-Critic (SAC). However, these existing deep reinforcement learning methods all have inherent, unresolved limitations when solving the CITO problem, resulting in suboptimal test sequences. Specifically:
[0007] 1) Value function-based methods (such as DQN and DDQN): These methods suffer from a systematic overestimation of Q-values, caused by using the same network for action selection and value evaluation. Although DDQN attempts to decouple these factors, significant estimation biases still exist in complex state spaces, misleading policy learning. Furthermore, their deterministic policies lack the ability to explore stochastic policies and are prone to getting trapped in local optima when faced with dynamically shrinking action spaces.
[0008] 2) Policy gradient-based methods (such as PPO and SAC): PPO constrains policy updates to ensure stability, resulting in insufficient exploration efficiency in the specific environment of class integration test sequence generation; SAC encourages exploration by maximizing entropy, but generates a large number of invalid explorations (such as randomly selecting invalid classes), leading to slow convergence. More importantly, the maximum entropy framework of SAC aims to find multiple equivalent optimal solutions, which is mismatched with the goal of the class integration test sequence generation problem of finding a single, definite optimal sequence. In addition, the existing seven types of importance measurement methods (in-degree, out-degree, in-degree + out-degree, net test benefit, class complexity and propagation influence, close importance, and K-core importance) are all single-dimensional indicators, with large differences in evaluation results—some favoring low-cost classes, some focusing on structural centers, and some emphasizing bridging roles, failing to comprehensively reflect the true importance of classes.
[0009] It is particularly important to note that with the rapid development of emerging fields such as embodied intelligence, software systems are exhibiting new levels of complexity. Embodied intelligence systems typically contain a large number of tightly coupled classes that interact with the environment in real time. Their inter-class dependencies are highly dynamic and complex, and they contain multiple key classes that undertake core perception, decision-making, and control functions. The existing technologies mentioned above all originate from the traditional software domain and have not been optimized for the uniquely complex code structures of embodied intelligence systems. Therefore, when applied to testing embodied intelligence systems, existing methods struggle to accurately identify their core interaction classes and effectively handle their dynamically evolving dependencies, resulting in test sequences that are not optimal in terms of efficiency and fault detection capabilities.
[0010] In summary, the following shortcomings exist in the existing technology mentioned above:
[0011] 1. Graph theory-based methods do not dynamically adjust class importance when breaking loops, and the class importance evaluation index is singular and lacks global consideration;
[0012] 2. Search-based methods only optimize for test stub cost, do not consider the impact of class importance on testing efficiency, and the results lack determinism;
[0013] 3. Reinforcement learning-based methods have long training times, and the reward function does not incorporate class importance, resulting in poor testing timing for important classes;
[0014] 4. Existing deep reinforcement learning methods (such as DQN, DDQN, PPO, and SAC) suffer from problems such as overestimation of Q-value, low exploration efficiency, and mismatch between the objective and the CITO (Class Integration Test Order) problem.
[0015] 5. Existing methods for measuring class importance are all based on a single metric, which provides a one-sided evaluation perspective and cannot fully reflect the true importance of a class. Summary of the Invention
[0016] This application provides a method for generating class ensemble test order based on graph neural networks and D3QN, which can solve the problems of existing technical solutions such as single importance evaluation index, only optimizing test stub cost while ignoring importance, reward function not integrating importance leading to poor timing of key class tests, Q-value overestimation and target mismatch in deep reinforcement learning, and difficulty in adapting to complex software architectures such as embodied intelligent systems.
[0017] According to a first aspect of this application, this application provides a method for generating class integration test order based on graph neural networks and D3QN, comprising: analyzing the software under test and constructing a directed weighted object relation graph ORD=<V,E,W> Here, the category set V represents all categories in the software, the edge set E represents the dependencies e between categories, and the weight set W is determined based on the frequency of variable access and method calls between categories. Based on the object relation graph ORD, graph embedding features and centrality features are fused to generate composite node features for each category. The composite node features are input into a multi-layer graph neural network scoring model to output the key score for each category. A Markov decision process model is constructed based on the object relation graph ORD and the key score, and a deterministic class integration test order is generated based on the D3QN (Dueling Double Deep Q-Network) algorithm and the Markov decision process model.
[0018] Preferably, the step of generating composite node features for each class by fusing graph embedding features and multidimensional centrality features based on the Object Relationship Graph (ORD) includes: generating graph embedding features for the class using the Node2Vec algorithm, wherein the graph embedding features include vectors of a first predetermined number of dimensions; generating centrality features for the class using a predetermined algorithm, wherein the centrality features include vectors of a second predetermined number of dimensions such as local connectivity, global propagation, and community embedding; and generating composite node features for key scoring based on the graph embedding features and the centrality features.
[0019] Preferably, after the step of generating the centrality features of the categories by setting the algorithm, the method further includes the step of: standardizing all centrality features so that the processed feature values are distributed in the interval [-1, 1], and the standardization calculation formula is: Among them, c i (v) represents the i-th centrality feature of the node, μ i σ i Let represent the mean and standard deviation of the i-th feature of the category, respectively.
[0020] Preferably, the step of generating composite node features for criticality scoring includes: horizontally concatenating the graph embedding features of the categories with the centrality features to form an initial composite feature vector matrix; weighting each dimension of the initial composite feature vector matrix to generate a weighted feature matrix; and normalizing the weighted feature matrix to output the composite node features.
[0021] Preferably, the step of inputting composite node features into a multilayer graph neural network scoring model and outputting a key score for each category includes: performing an initial key score on the composite node features of each category to obtain an initial score; sampling the predecessor and successor neighbor sets of each category based on the Object Relationship Graph (ORD) to obtain the aggregated scores of predecessor and successor neighbors, wherein the predecessor neighbor set consists of all categories in the ORD that depend on the current category, and the successor neighbor set consists of all categories in the ORD that the current category depends on; concatenating the initial score, the aggregated score of predecessor neighbors, and the aggregated score of successor neighbors, and performing deep feature fusion through a multilayer graph neural network to obtain a temporary key score; and performing residual connections, in-degree-based centrality correction, and noise threshold filtering on the temporary key score to generate the final key score.
[0022] Preferably, the step of performing initial criticality scoring on the composite feature vector of each class includes the following steps: designing a two-layer fully connected network based on the composite feature vector; mapping the composite feature vector sequentially through the first fully connected layer of the two-layer fully connected network to a 64-dimensional feature space, and then performing batch normalization, ReLU activation function, and Dropout normalization; then reducing the dimension to 32 dimensions through the second fully connected layer of the two-layer fully connected network, and performing batch normalization, ReLU activation function, and Dropout normalization; finally, linearly transforming the output layer of the two-layer fully connected network through the weight matrix to output the initial score, which has a dimension of 1.
[0023] Preferably, the step of sampling the predecessor and successor neighbor sets for each category based on the Object Relationship Graph (ORD) to obtain the aggregate score of predecessor and successor neighbors includes the following steps: independently and randomly sampling a set number of predecessor and successor neighbors for each category, where predecessor neighbors are categories that depend on the current category, and successor neighbors are categories that the current category depends on; multiplying the initial scores of predecessor and successor neighbors by their corresponding edge weights and learnable attention weights, and then summing the weighted results of predecessor and successor neighbors to obtain the aggregate score of predecessor and successor neighbors. The specific calculation formula is as follows: Among them, a in (v) represents the aggregation score of the predecessor neighbor, a out (v) represents the aggregation score of the predecessor neighbor, ω(u,v), s (0) (u), Let ω(v,w) and s represent the edge weights between the current class and its predecessor neighbors, the initial scores of the predecessor neighbors, and the attention weights between the current class and its predecessor neighbors, respectively. (1) (w), α ext (v, w) represent the edge weights between the current class and its successor neighbors, the initial scores of the successor neighbors, and the attention weights between the current class and its successor neighbors, respectively. The attention weights are generated through training a multi-layer graph neural network.
[0024] Preferably, the step of concatenating the initial score, the aggregated score of the predecessor neighbor, and the aggregated score of the successor neighbor, and performing deep feature fusion through a multi-layer graph neural network to obtain a temporary key score includes the following steps: concatenating the aggregated scores of the current category, the predecessor neighbor, and the successor neighbor into a three-dimensional vector; mapping it to 24 dimensions through a third fully connected layer, a batch normalization layer, a LeakyReLU activation function, and a Dropout layer; then gradually compressing it to 12 dimensions through a fourth fully connected layer, and sequentially performing batch normalization, LeakyReLU activation, and Dropout processing; finally, outputting the temporary key score through a fifth fully connected layer and a Sigmoid activation function.
[0025] Preferably, the temporary critical scores are sequentially subjected to residual connection, in-degree-based centrality correction, and noise threshold filtering, including: weighting and fusing the temporary critical scores with the initial scores using residual coefficients to obtain the base class scores; calculating learnable centrality correction coefficients based on the in-degree of each class in the ORD, and weighting the base class scores to obtain intermediate scores; fusing the intermediate scores with the initial scores using balance coefficients and standardizing them using the Sigmoid function; and applying a noise threshold to truncate the standardized scores to generate the final critical scores.
[0026] Preferably, the step of constructing a Markov Decision Process model based on the Object Relationship Graph (ORD) and key scores includes: modeling the class integration test sequence generation problem as a Markov Decision Process (MDP).<S,A,P,R,γ> Wherein, the state space S represents the set of currently tested classes, the action space A represents the set of classes to be selected for the next test, the state transition P is a deterministic transition, and the reward function R is calculated by combining the critical score of the selected class and the cost of the test stub. The state space S uses a binary vector to represent the current testing progress. in This indicates that the i-th class has completed testing. This indicates that the category has not yet been tested; Action space A: defined as A = {0, 1, ..., N-1}, represents selecting a category from the untested categories. The action space only allows selection from categories that satisfy... Choose an action from the categories; the deterministic state transition satisfies P(s'|s,a)=1, that is, after executing action a, the a-th bit of s' is set to 1; the reward function is expressed as R=λs * (c i )-cost, where s * (c i ) is the class c to be tested i The key score, cost is the cost of test stubs, which represents the test cost of creating a mock test framework for any dependency class that is not in the current test order, λ is the balancing coefficient; discount factor γ is used to balance the relative weights of immediate rewards and future rewards, and its value ranges from [0,1]; when all classes have been tested, an additional maximum reward Max is obtained.
[0027] Preferably, the step of generating a deterministic class ensemble test order based on the D3QN algorithm and a Markov decision process model includes: constructing a reinforcement learning framework using the D3QN algorithm, the framework including an evaluation network and a target network, both of which use a Dueling architecture to decompose the Q-value into a state value function V(s) and an action advantage function A(s,a); during the training phase, the evaluation network selects actions and outputs predicted Q-values, the optimal action is selected through the evaluation network, the target network calculates the Q-value of the optimal action, and the target Q-value is collaboratively constructed to form the training objective, and the reinforcement learning framework is collaboratively trained through an experience replay mechanism and a soft update mechanism; during the inference phase, the evaluation network is used to repeatedly execute the following process starting from the initial state: calculate the Q-values of all available actions in the current state, select the action with the largest Q-value as the next class to be tested, update the test state; and output the class ensemble test order consisting of the selected action sequence.
[0028] Preferably, in the step of decomposing the Q value into a state value function V(s) and an action advantage function A(s,a) using a Dueling architecture, the Q value is calculated using the following formula: Where V(s) represents the intrinsic value of the current state s, A(s,a) represents the advantage of choosing action a relative to the average action in state s, |A| is the total number of legal actions, and ∑ a′∈A A(s,a′) is the sum of the advantage values over all legal actions.
[0029] Preferably, the steps of selecting the optimal action through the evaluation network, calculating the Q-value of the optimal action through the target network, and collaboratively constructing the target include: using the evaluation network to calculate the next state s. t+1 Q value of all legal actions Q eval (s t+1 a) Select the action with the highest Q value. Use the target network to compute in state s t+1 Q-value of the next action: Combined with instant rewards t The target Q is calculated using the following formula, along with the discount factor γ:
[0030] Preferably, the step of co-training the reinforcement learning framework through the experience replay mechanism and the soft update mechanism includes: synchronously updating the parameters of the target network and the evaluation network using the soft update mechanism, the soft update mechanism update rule for the target network and the update rule for the evaluation network parameters; the target network update rule is: θ target ←τ·θ eval +(1-τ)·θ target , where θ eval To evaluate network parameters, θ targetLet τ be the target network parameters, and τ be the soft update coefficient, with a value range of (0,1). The evaluation rule for network parameter update is as follows: the gradient descent algorithm is used to perform parameter updates. Where α is the learning rate, used to control the step size for parameter updates. The loss function with respect to parameter θ eval The gradient is calculated using the backpropagation algorithm and is used to guide the direction of parameter adjustment.
[0031] Preferably, the step of training the reinforcement learning framework in conjunction with the experience replay mechanism and the soft update mechanism further includes constructing a loss function based on the mean squared error between the predicted Q-value and the target Q-value, and the specific calculation method is as follows: in, Indicates the playback buffer batch, (s t a t r t s t+1 ) represents a single state transition sample in this batch, corresponding to the current state, the action performed, the immediate reward, and the next state, respectively; y t It is the target Q value; Q eval (s t ,a t ;θ eval ) indicates the evaluation network for (s) t ,a t The Q-value prediction of the input, where θ eval This represents the trainable parameters of the network being evaluated; This indicates the calculation of the expected value for the entire sample batch.
[0032] The beneficial effects of this application are as follows: This invention systematically solves the inherent defects of the existing CITO method in terms of one-sided importance assessment, cost-importance imbalance, training instability, and result non-determinism by using multi-dimensional feature fusion, multi-layer graph neural network scoring model, and D3QN algorithm. It realizes automated, efficient, and deterministic generation of class integration test sequences, which significantly improves the overall efficiency of integration testing of object-oriented software (especially embodied intelligent systems).
[0033] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0034] Figure 1 This is a flowchart illustrating a method for generating class integration test order based on graph neural networks and D3QN according to an exemplary embodiment;
[0035] Figure 2 yes Figure 1 The flowchart of step S2 in the text;
[0036] Figure 3 yes Figure 1 The flowchart for step S3 in the process;
[0037] Figure 4 yes Figure 1 The flowchart for step S4 in the process;
[0038] Figure 5 This is a block diagram illustrating a computer device according to an exemplary embodiment. Detailed Implementation
[0039] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0040] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0041] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0042] Please see Figures 1 to 5 In one exemplary embodiment, please refer to Figure 1 In one exemplary embodiment, a method for generating class integration test order based on graph neural networks and D3QN includes the following steps:
[0043] Step S1: Analyze the software under test and construct a directed weighted object relation graph ORD=<V,E,W> Here, the category set V represents all categories in the software, the edge set E represents the dependency relationship e between categories, and the weight set W is determined based on the frequency of variable access and method call between categories.
[0044] Step S2: Based on the Object Relationship Diagram (ORD), fuse graph embedding features and centrality features to generate composite node features for each category.
[0045] Step S3: Input the composite node features into the multilayer graph neural network scoring model and output the critical score for each category.
[0046] Step S4: Construct a Markov decision process model based on the object relationship graph (ORD) and criticality scores, and generate a deterministic class integration test order based on the D3QN algorithm and the Markov decision process model.
[0047] Step S1 includes the following steps:
[0048] Step S11: The node set V contains all class entities in the system, with each node uniquely corresponding to one class. Taking a service robot system in the field of embodied intelligence as an example, in a typical service robot software system, the core functional modules are implemented in the form of object-oriented classes, including the following 5 classes: Vision class: responsible for camera image acquisition and preprocessing; Brain class: responsible for environmental understanding, task decision-making, and instruction distribution; Arm class: responsible for robotic arm motion control; Battery class: responsible for battery power monitoring and low battery warning; Logger class: responsible for system operation log recording.
[0049] After performing a static scan on the source code of the above system, the node set V is constructed as: V = {Vision, Brain, Arm, Battery, Logger}, where each class is abstracted as a unique node in the ORD, and the total number of nodes N = 5.
[0050] Step S12: Edge set E represents the dependencies between different types of categories (i.e., inheritance, composition, aggregation, and association). If class u depends on class v, then there exists a directed edge e in E = ...<u,v> The direction is from the dependent (u) to the dependent (v). For example, in an embodied intelligence system, by analyzing the service robot's source code, the following dependencies are identified: Brain depends on Vision: The Brain class calls the Vision.getImage() method to obtain image data. This dependency belongs to the Association relationship, generating a directed edge.<Brain,Vision> .
[0051] Step S13: The weight set W represents the dependency strength, calculated by statistically analyzing the frequency of inter-class dependencies in the source code of the program under test. Specifically, the calculation of dependency strength includes two aspects: the variable access scenarios of class u to class v, including cases where class u calls member variables of class v, and cases where the parameter type of a method defined or called by class u is v, or the method return type is v. When class u calls a method of class v, it means that class u directly calls the method defined in class v. Each variable access or method call increases the frequency count of the corresponding dependency by 1, and the final frequency value is used as the edge value.<u,v> The weighting. For example, in a service robot system, lexical and syntactic analysis is performed on the service robot's source code to count the call frequency of each dependency:
[0052] Dependency edge Calling scenarios statistics weight w <Brain,Vision> Brain called Vision.getImage() a total of 42 times. 42 42 <Brain,Arm> Brain called Arm.moveTo() a total of 35 times. 35 35 <Brain,Battery> Brain accessed the Battery.power member variable 8 times. 8 8 <Arm,Logger> Arm called Logger.log() a total of 12 times. 12 12
[0053] Finally, the weight set W is constructed as: W = {42, 35, 8, 12}.
[0054] This modeling approach not only preserves the directionality of inter-class dependencies but also reflects the tightness of dependencies through weights, providing a structured foundation for subsequent key class identification.
[0055] Please see Figure 2 Step S2 includes the following steps:
[0056] S21: Generate graph embedding features for each category using the Node2Vec algorithm. These graph embedding features include vectors of a first predetermined number of dimensions. In this embodiment, the graph embedding features include 32-dimensional vectors; that is, each category corresponds to a 32-dimensional vector.
[0057] Step S21 also includes the following sub-steps:
[0058] Step 211: Map the classes in the ORD to a low-dimensional vector representation H∈R^{N×32} using the Node2Vec algorithm, where N represents the number of classes in the system and each class corresponds to a 32-dimensional vector.
[0059] Step 212: The Node2Vec algorithm introduces two hyperparameters, p and q, to control the random walk strategy for obtaining vertex neighbor sequences: a larger p value tends to revisit recently visited nodes, while a larger q value tends to explore new neighbors. By adjusting these parameters, a balance between depth-first search (DFS) and breadth-first search (BFS) can be achieved, flexibly capturing the diverse neighborhood structures of nodes within the network.
[0060] Step 213: Treat the obtained walk sequence as a sentence and each node as a word, construct a node vocabulary and form a corresponding bag-of-words model. Finally, use the skip-gram model to train the above nodes to learn the low-dimensional vector representation of the nodes, and then output a 32-dimensional vector for each category.
[0061] Continuing with the example of service robots, in the service robot ORD: performing a random walk on the Brain node yields a sequence such as: [Brain,Vision,Brain,Arm,Brain,Battery];
[0062] The sequence was input into the Skip-gram model, which learned the contextual co-occurrence relationships between Brain, Vision, Arm, and Battery.
[0063] The final output is a 32-dimensional graph embedding feature, such as
[0064] This feature captures Brain's global structural location within the service robot topology.
[0065] S22: Generate category centrality features by setting an algorithm. The centrality features include vectors with a second set number of dimensions, such as local connectivity, global propagation, and community embedding.
[0066] In this embodiment, the second defined dimension refers to 17 dimensions, or 17 centrality metrics. These 17 centrality metrics include: local connectivity (e.g., in-degree, out-degree), global propagation (e.g., betweenness centrality, tight centrality), and community embedding (e.g., K-kernel, structural holes), etc. For example, this 17-dimensional vector = [0, 3, 1.0, 0.85, 3, 0.92, ...].
[0067] Because all centrality features need to be standardized to eliminate dimensional differences and make the features comparable, after step S22, the following step is also included:
[0068] The centrality features are all standardized so that the processed feature values are distributed in the interval [-1, 1]. The standardization formula is as follows: Among them, c i (v) represents the i-th centrality feature of the node, μ i σ i Let represent the mean and standard deviation of the i-th feature of the category, respectively.
[0069] Taking a service robot system as an example, for the betweenness centrality dimension (the 3rd dimension): the value of all classes = [0, 1.0, 0, 0, 0] (Brain is 1.0), μ3 = 0.2, σ i If ≈0.45, then after Brain standardization, it = (1.0-0.2) / 0.45≈1.78 → truncated to 1.0 (because it is required that ∈ [-1,1]).
[0070] S23: Generate composite node features for key scoring based on graph embedding features and centrality features.
[0071] Step S23 includes:
[0072] Step S231: Horizontally concatenate the graph embedding features and centrality features of all categories to form an initial composite feature vector matrix. Since the graph embedding features consist of a 32-dimensional vector and the centrality features consist of a 17-dimensional vector, the initial composite feature vector matrix has a total of 49 dimensions.
[0073] Step S232: Weight the dimensions of the initial composite feature matrix to generate a weighted feature matrix. In this embodiment, the graph embedding feature dimension can be set to 1.0, the centrality feature dimension to 1.2, and the weighted feature matrix can be obtained by weighting the dimensions of the initial composite feature matrix.
[0074] Step S233: Normalize the weighted feature matrix to output composite node features. In this embodiment, after dynamic weight adjustment, the weighted feature matrix undergoes batch normalization. The final standardized feature matrix Xfinal∈RN×49 will be used as the input to the subsequent GNN model, providing a comprehensive and robust node feature representation for key category scoring.
[0075] Please see Figure 3 In step S3, the following is included:
[0076] Step S31: Perform initial criticality scoring on the composite node features of each category to obtain an initial score.
[0077] Step S31 includes the following sub-steps:
[0078] Step S311: Design a two-layer fully connected network based on the composite feature vector. The two-layer fully connected network maps this feature vector to an initial key score, which is calculated as follows:
[0079] s (0) (v)=W3·σ(W2·σ(W1x v +b1)+b2)+b3
[0080] Here, W1, b1, W2, b2, W3, and b3 are trainable parameters. The function of this layer is to compress the original embedding into a single scalar, which not only preserves the node information in the network but also provides a unified input scale for subsequent aggregation layers.
[0081] Step S312: After mapping the composite feature vector to the 64-dimensional feature space through the first fully connected layer of the two-layer fully connected network, batch normalization, ReLU activation function and Dropout normalization are applied.
[0082] Step S313: The dimension is reduced to 32 dimensions by the second fully connected layer of the two-layer fully connected network, and batch normalization layer, ReLU activation function and Dropout normalization are used.
[0083] Step S314: Finally, the output layer of the two-layer fully connected network is linearly transformed using the weight matrix to output the initial score, which has a dimension of 1. Specifically, a linear transformation is performed on the fully connected layer defined by the weight matrix W3∈R1×32 and the bias term b3∈R to output the initial node score s. (0) (v), whose dimension is 1.
[0084] Using service robots as an example: Initial criticality scoring of Brain's 49-dimensional composite features.
[0085] First layer: 64-dimensional features → "Brain is strongly correlated with sensing, control, and power modules";
[0086] Second layer: 32-dimensional abstract features → "core decision-making hub";
[0087] Output: Initial score s (0) (brain) = 0.85.
[0088] Step S32: Based on the Object Relationship Graph (ORD), sample the predecessor neighbor set and successor neighbor set for each category to obtain the aggregation score of the predecessor neighbor and successor neighbor. The predecessor neighbor set is all categories in the ORD that depend on the current category, and the successor neighbor set is all categories in the ORD that the current category depends on.
[0089] Step S32 includes the following sub-steps:
[0090] Step S321: For each category, independently and randomly sample a set number of predecessor and successor neighbors. Predecessor neighbors are categories that depend on the current category, and successor neighbors are categories that the current category depends on. In this embodiment, 10 predecessor neighbors (classes that depend on the current node) and 10 successor neighbors (classes that the current node depends on) are sampled.
[0091] Step S322: Multiply the initial scores of the predecessor and successor neighbors by their corresponding edge weights and learnable attention weights, respectively. Then, sum the weighted results of the predecessor and successor neighbors to obtain the aggregate score of the predecessor and successor neighbors. The specific calculation formula is as follows:
[0092]
[0093] Among them, a in (v) represents the aggregation score of the predecessor neighbor, a out(v) represents the aggregation score of the predecessor neighbor, ω(u,v), s (0) (u), Let ω(v,w) and s represent the edge weights between the current class and its predecessor neighbors, the initial scores of the predecessor neighbors, and the attention weights between the current class and its predecessor neighbors, respectively. (1) (w), α ext (v, w) represent the edge weights between the current class and its successor neighbors, the initial scores of the successor neighbors, and the attention weights between the current class and its successor neighbors, respectively. The attention weights are generated through training a multi-layer graph neural network.
[0094] Taking service robots as an example, for the Brain node:
[0095] Former neighbor (class that depends on Brain): None, a in (brain) = 0;
[0096] Successor neighbors (classes that Brain depends on): {Vision, Arm, Battery};
[0097] ω(Brain,Vision) = 42, s (0) =0.70, α att =0.95;
[0098] ω(Brain,Arm)=35,s (0) =0.60,α att =0.90;
[0099] ω(Brain,Battery)=8,s (0) =0.40,α att =0.70;
[0100] Therefore, a out =49.07
[0101] Step S33: Concatenate the initial score, the aggregated score of the predecessor neighbor, and the aggregated score of the successor neighbor, and perform deep feature fusion through a multi-layer graph neural network to obtain a temporary key score.
[0102] Step S33 includes the following sub-steps:
[0103] Step S331: Concatenate the aggregate scores of the current category, its predecessor neighbors, and its successor neighbors into a three-dimensional vector. Taking a service robot as an example, for the Brain node:
[0104] 3D vector [s (0) ,a in ,a out = 0.85, 0, 49.07.
[0105] Step S332: Map to 24 dimensions through a third fully connected layer, a batch normalization layer, a LeakyReLU activation function, and a Dropout layer.
[0106] Step S333: The dimensions are then gradually compressed to 12 dimensions via the fourth fully connected layer, and batch normalization, LeakyReLU activation, and Dropout processing are performed sequentially.
[0107] Step S334: Finally, through the fifth fully connected layer and the Sigmoid activation function, output the temporary critical score s′. (l) (v).
[0108] The specific calculation process for steps S332 to S334 is as follows:
[0109] s′ (1) (v)=σ sigmoid (W6·σ(W5·σ(W4·[s 0 (v);a in (v);a out (v)]+b4)+b5)+b6);
[0110] Therefore, the temporary fraction: s' (1) (Brain) = 0.92
[0111] Step S34: Perform residual join, in-degree-based centrality correction, and noise threshold filtering on the temporary critical scores to generate the final critical scores.
[0112] Step S34 includes:
[0113] Step S341: The temporary critical score and the initial score are weighted and fused using the residual coefficient to obtain the basic category score.
[0114] In this step, to alleviate the problems of excessive decay of feature information and reduced gradient propagation efficiency during multi-level iterations, a residual coefficient α is introduced. res Initial node score s (0) (v) and the current layer's temporary update score s′ (l) (v) Fusion via residual connections, the calculation method of which is as follows:
[0115] s (1) (v)=α res ·s′ (l) (v)+(1-α res )·s (0) (v)
[0116] Step S342: Based on the in-degree of each class in the ORD, calculate the learnable centrality correction coefficient and weight the base class scores to obtain the intermediate score.
[0117] In this step, since multilayer graph neural networks often ignore the global topological position of nodes, the model introduces centrality prior knowledge based on node degree. First, the in-degree d of each node is calculated. in (v), perform a logarithmic transformation on the in-degree to obtain the centrality correction coefficient c. * (v). Its calculation formula is as follows: c * (v)=γ·log(d in (v)+∈)+β.
[0118] Here, ∈ is a very small positive value used to avoid numerical underflow; γ and β are learnable scaling and offset parameters that are automatically optimized during model training to adapt to the data distribution.
[0119] In this step, node scores are weighted and adjusted based on the centrality correction coefficient to enhance the ability to distinguish global key categories. The adjustment formula is as follows:
[0120] In this formula, s represents the median score after centrality weighting. (1) (v) is the score of the basic node after multi-level aggregation, and the centrality coefficient c. * (v) Assign differentiated weights to nodes with different topological importance.
[0121] Step S343: Combine the intermediate scores with the initial scores using a balance coefficient and then normalize them using the Sigmoid function.
[0122] In this step, to balance the contributions of centrality adjustment and the original features, we fuse the centrality-weighted score with the initial node score s(0)(v) using the following formula:
[0123] Where σ(·) is the Sigmoid activation function used to standardize the scores; η is the balancing coefficient used to control the fusion ratio of the centrality-adjusted scores and the initial scores.
[0124] Step S344: Apply a noise threshold to the standardized scores to generate the final critical scores.
[0125] Finally, a noise threshold τ is introduced, and scores below the threshold are further suppressed by methods such as truncation or scaling (max(σ(s*(v)),τ)), thereby effectively filtering noise interference, ensuring the significance of key node scores, and improving the accuracy of the model in modeling the global topology.
[0126] Following step S34, the following steps are also included:
[0127] Step S35: Key category identification operation. Top-K selection based on the final score s*(v): Specifically, all nodes are sorted in descending order of the final score s*(v), and then the top K nodes (K can be set to values such as 5, 10, or 15) are selected from the sorted list as the key categories.
[0128] In step S3, to improve the model's training stability, generalization ability, and adaptability to new systems, the present invention employs the following training mechanism:
[0129] (1) Loss Function and Optimizer
[0130] The supervised binary cross-entropy loss function (if the key class labels are known) or the self-supervised ranking loss (if there are no labels) can be used.
[0131] Using the Adam optimizer, the initial learning rate is set to 1×10⁻⁶. -4 Train for 1000 cycles to ensure full convergence and prevent overfitting.
[0132] (2) Adaptive learning rate strategy
[0133] Pre-trained layers (e.g., initial scoring FC layers): use a relatively small learning rate (1×10). -4 To avoid disrupting the learned general feature mappings; new task layers (such as centrality correction coefficients γ, β, and fusion coefficients η): employ a larger learning rate (1×10). -3 This accelerates the adaptation to the topological characteristics of the new system.
[0134] (3) Dynamic adjustment of feature weights
[0135] Learnable weights are assigned to 17 centrality features; during training, effective feature weights are automatically enhanced and noisy feature weights are weakened through backpropagation; in service robot systems, the model may automatically increase the weights of indicators such as "between centrality" and "structural holes" because they better reflect the bridging effect of Brain.
[0136] (4) Gradual thawing mechanism
[0137] During initialization, the pre-trained layers are frozen, and only the new task layers are trained. As the training rounds increase, the pre-trained layers are gradually unfrozen from top to bottom. Finally, in the full fine-tuning stage, all layers participate in the update, but the pre-trained layers maintain a low learning rate to ensure the synergistic optimization of generality and specificity.
[0138] Please see Figure 4 Step S4 includes:
[0139] Step S41: Construct a Markov decision process model based on the object relationship graph (ORD) and key scores.
[0140] Step S41 includes:
[0141] The problem of generating class integration test order is modeled as a Markov Decision Process (MDP).<S,A,P,R,γ> Wherein, the state space S represents the set of currently tested classes, the action space A represents the set of classes to be selected for the next test, the state transition P is a deterministic transition, and the reward function R is calculated by combining the criticality score of the selected class with the cost of the test stub.
[0142] The state space S uses a binary vector to represent the current test progress. in This indicates that the i-th class has completed testing. This indicates that it has not been tested yet;
[0143] Action space A: Defined as A = {0, 1, ..., N-1}, representing the selection of a category from untested categories. The action space only allows selection from categories that satisfy... Select an action from the category;
[0144] The deterministic state transition satisfies P(s'|s,a)=1, that is, after the action a is performed, the a-th bit of s′ is set to 1;
[0145] The reward function is expressed as R = λs * (c i )-cost, where s * (c i ) is the class c to be tested i The critical score, cost is the test stub cost, which represents the test cost of creating a mock test framework for any dependency category that is not in the current test order, and λ is the balance coefficient;
[0146] The discount factor γ is used to balance the relative weights of immediate rewards and future rewards, and its value ranges from [0,1].
[0147] When all classes have been tested, an additional maximum reward (Max) is awarded.
[0148] Continuing with the example of service robots:
[0149] Initial state: s = [0, 0, 0, 0, 0];
[0150] Valid actions: {0(Vision), 1(Brain), 2(Arm), 3(Battery), 4(Logger)}. The current state is: s = [1, 0, 0, 0, 0], indicating that the measurable categories are Brain, Arm, Battery, and Logger. Vision cannot be measured repeatedly. When the category to be measured, Brain, is selected, the state is s = [1, 1, 0, 0, 0].
[0151] After all classes have been tested, s = [1, 1, 1, 1], and the maximum bonus of 1 is obtained.
[0152] Based on step S3, the criticality scores are calculated as follows: Brain = 0.88, Vision = 0.70, and Logger = 0.20, as shown in the table below:
[0153]
[0154]
[0155] Step S42: Generate a deterministic class integration test sequence based on the D3QN algorithm and the Markov decision process model.
[0156] Step S42 includes:
[0157] Step S421: Construct the D3QN algorithm to build a reinforcement learning framework. The framework includes an evaluation network and a target network. Both the evaluation network and the target network adopt the Dueling architecture to decompose the Q value into a state value function V(s) and an action advantage function A(s,a).
[0158] In this embodiment, the Dueling architecture is used to decompose the Q value into a state value function V(s) and an action advantage function A(s,a). The specific formula for calculating the Q value is as follows:
[0159] Where V(s) represents the intrinsic value of the current state s, A(s,a) represents the advantage of choosing action a relative to the average action in state s, |A| is the total number of legal actions, and ∑ a′∈A A(s,a′) is the sum of the advantage values over all legal actions.
[0160] Step S422: During the training phase, the evaluation network selects actions and outputs predicted Q-values. The optimal action is selected by the evaluation network, and the target network calculates the Q-value of the optimal action. The target Q-value is jointly constructed to form the training objective, and the reinforcement learning framework is trained in a coordinated manner through the experience replay mechanism and the soft update mechanism.
[0161] In this embodiment, the steps of selecting the optimal action through the evaluation network, calculating the Q-value of the optimal action through the target network, and collaboratively constructing the target include:
[0162] The next state s is calculated using an evaluation network. t+1 Q value of all legal actions Q eval (s t+1 ,a);
[0163] Choose the action with the highest Q value.
[0164] Use the target network to compute in state s t+1 Q-value of the next action:
[0165]
[0166] Combined with instant rewards t The target Q is calculated using the following formula, along with the discount factor γ:
[0167]
[0168] In this embodiment, the step of training the reinforcement learning framework in collaboration with the experience replay mechanism and the soft update mechanism includes: using the soft update mechanism to synchronously update the parameters of the target network and the evaluation network, the soft update mechanism target network update rule and the evaluation network parameter update rule;
[0169] The target network update rule is: θ target ←τ·θ eval +(1-τ)·θ target , where θ eval To evaluate network parameters, θ target Here, τ represents the target network parameters, and τ is the soft update coefficient, with a value range of (0,1).
[0170] The evaluation rule for network parameter updates is as follows: Gradient descent algorithm is used to perform parameter updates. Where α is the learning rate, used to control the step size for parameter updates. The loss function with respect to parameter θ eval The gradient is calculated using the backpropagation algorithm and is used to guide the direction of parameter adjustment.
[0171] The step of training the reinforcement learning framework through the combined experience replay mechanism and soft update mechanism also includes constructing a loss function based on the mean squared error between the predicted Q-value and the target Q-value. The specific calculation method is as follows:
[0172] in, Indicates the playback buffer batch, (s t at r t s t+1 ) represents a single state transition sample in this batch, corresponding to the current state, the action performed, the immediate reward, and the next state, respectively; y t It is the target Q value; Q eval (s t ,a t ;θ eval ) indicates the evaluation network for (s) t ,a t The Q-value prediction of the input, where θ eval This represents the trainable parameters of the network being evaluated; This indicates the calculation of the expected value for the entire sample batch.
[0173] Step S423: During the inference phase, using the evaluation network, starting from the initial state, repeat the following process: calculate the Q-value of all available actions in the current state, select the action with the largest Q-value as the next class to be tested, update the test state, and output the class integration test order consisting of the selected action sequence.
[0174] The following explanation uses service robot systems in the field of embodied intelligence as an example.
[0175] I. System Settings (from Step 1 & Step 3)
[0176] 1. Classes and Indexes
[0177] index Class Name Function 0 Vision Visual perception 1 Brain Decision-making center 2 Arm robotic arm control 3 Battery Battery Management
[0178] 2. Dependency relationship Deps(ci) (from step one ORD)
[0179]
[0180] Deps(Brain) = {0, 2, 3} (depending on Vision, Arm, Battery)
[0181] Deps(Arm) = {1} (depends on Brain)
[0182] Deps(Battery) = {1} (depends on Brain)
[0183] Deps(Logger) = {2} (depends on Arm)
[0184] 3. Key score s*(ci) (from step three GNN scoring)
[0185] s*(Vision) = 0.70, s*(Brain) = 0.95, s*(Arm) = 0.85, s*(Battery) = 0.60, s*(Logger) = 0.20; Explanation: Brain is the most important (0.95), Arm is next (0.85), and Logger is the least important (0.20).
[0186] 4. Parameter settings
[0187] λ = 0.8, γ = 0.9, Max = 1.0 (reward for completing the full test).
[0188] II. Complete Reasoning Process (s=[0,0,0,0,0]→[1,1,1,1,1])
[0189] Step 0: Initial state S0 = [0,0,0,0,0]
[0190] Valid actions: A = {0, 1, 2, 3, 4}
[0191] Calculate the immediate reward R for each action:
[0192]
[0193] Calculate Q≈R+γ·maxR′ (estimate the maximum reward for the next step):
[0194] If we measure Vision (a = 0):
[0195] s′=[1,0,0,0,0], under s′, measure each action R′:
[0196] a = 1 (Brain): cost = 2 → R′; = 0.76 - 2 = -1.24; a = 2 (Arm): cost = 1 → R′ = 0.68 - 1 = -0.32; a = 3 (Battery): cost = 1 → R′ = 0.48 - 1 = -0.52; a = 4 (Logger): cost = 1 → R′ = 0.16 - 1 = -0.84; R = -0.32 is the maximum (measured Arm), then Q = 0.56 + 0.9 × (-0.32) = 0.56 - 0.288 = 0.272
[0197] If measuring Arm (a = 2): s′ = [0,0,1,0,0], R′ maximum = measuring Vision → R′ = 0.56;
[0198] Then Q = -0.32 + 0.9 × 0.56 = -0.32 + 0.504 = 0.184.
[0199] After execution: R0 = 0.56, S1 = [1,0,0,0,0].
[0200] Step 1: State S1 = [1,0,0,0,0] (Vision has been tested)
[0201] Valid actions: A = {1, 2, 3, 4}
[0202] Calculate R:
[0203] a Class Name Deps Untested Dependency Count R = 0.8 × s - cost 1 Brain {0,2,3} 2(Arm, Battery) 0.8×0.95-2=-1.24 2 Arm {1} 1(Brain) 0.8×0.85-1=-0.32 3 Battery {1} 1(Brain) 0.8×0.60-1=-0.52 4 Logger {2} 1 (Arm) 0.8×0.20-0=0.16
[0204] Estimate Q: Measure Arm → s′=[1,0,1,0,0] → maxR′=Measure Battery: -0.52 → Q=-0.32+0.9×(-0.52)=-0.788;
[0205] Measure Battery → s′=[1,0,0,1,0] → maxR′=Measure Arm: -0.32 → Q=-0.52+0.9×(-0.32)=-0.808.
[0206] Therefore, a = 2(measure Arm) (Q = -0.788 > -0.808), after execution: R1 = -0.32, S2 = [1,0,1,0,0].
[0207] Step 2: State S2 = [1,0,1,0,0].
[0208] Valid actions: A = {1, 3, 4}
[0209] Calculate R:
[0210] a Class Name Deps Untested Dependency Count R = 0.8 × s - cost 1 Brain {0,2,3} 2(Arm, Battery) 0.8×0.95-2=-1.24 3 Battery {1} 1(Brain) 0.8×0.60-1=-0.52 4 Logger {2} 1 (Arm) 0.8×0.20-0=0.16
[0211] Estimate Q: Measure Logger → s′=[1,0,1,0,1] → maxR′=Measure Battery: -0.52 → Q=0.16+0.9×(-0.52)=-0.308;
[0212] Measure Brain → s′=[1,1,1,0,0] → maxR′=Measure Battery:0.48 → Q=-0.24+0.9×0.48=+0.192.
[0213] Therefore, we choose a = 1 (measure Brain) (Q = 0.192). After execution, R2 = -0.24 and state s3 = [1,1,1,0,0].
[0214] Step 3: State s3 = [1,1,1,0,0].
[0215] Valid actions: A = {3, 4}
[0216] Calculate R:
[0217] a Class Name Deps Untested Dependency Count R = 0.8 × s - cost 3 Battery {1} 1(Brain) 0.8×0.60-1=-0.52 4 Logger {2} 1 (Arm) 0.8×0.20-0=0.16
[0218] Estimate Q: Measure Battery → s′=[1,1,1,1,0] → maxR′=Measure Logger: R′=0.16 → Q=0.48+0.9×0.16=0.624;
[0219] Measure Logger → s′=[1,1,1,0,1] → maxR′=Measure Battery: R′=0.48 → Q=0.16+0.9×0.48=0.592.
[0220] Select a=3 (test Battery), execute: R3=0.48, state s4=[1,1,1,1,0].
[0221] Step 4: State s4 = [1,1,1,1,0].
[0222] Legal action: A = {4}
[0223] Calculate R: Deps(Logger) = {2} → Arm has been measured → cost = 0, R = 0.8 × 0.20 - 0 = 0.16, + Max = 1.0 → R4 = 0.16 + 1.0 = 1.16.
[0224] Execution: R4 = 1.16, s5 = [1,1,1,1,1]
[0225] Therefore, the final test sequence is: Vision→Arm→Brain→Battery→Logger.
[0226] Please see Figure 5 In one exemplary embodiment, a computer device 1000 includes at least one processor 1001, at least one memory 1002, and at least one communication bus 1003.
[0227] The memory 1002 stores computer-readable instructions, and the processor 1001 reads the computer-readable instructions stored in the memory 1002 through the communication bus 1003.
[0228] When the computer-readable instruction is executed by the processor 1001, it implements the ambient light control method in the above embodiments.
[0229] The beneficial effects of this application are as follows:
[0230] 1. By fusing graph embedding and multidimensional centrality features, and combining them with dynamic scoring from multi-layer graph neural networks, the limitations of single indicators are overcome, enabling accurate, global, and adaptive identification of key interaction classes.
[0231] 2. In the reinforcement learning reward function, both class importance and test stub cost are considered to ensure that key classes are tested at the lowest cost and best time, avoiding "early testing with high cost" or "late testing with incorrect fixes".
[0232] 3. The D3QN framework (Dueling+Double+Soft Update+Experience Replay) designed specifically for CITO is adopted to solve problems such as Q-value overestimation, ineffective exploration, and target mismatch, so as to achieve fast, stable and deterministic sequence generation.
[0233] 4. The entire methodology is not dependent on a specific architecture and can automatically adapt to software systems of different sizes and with complex dependencies (especially embodied intelligence systems), comprehensively improving integration testing efficiency.
[0234] The above description is merely a preferred exemplary embodiment of the present invention and is not intended to limit the implementation of the present invention. Those skilled in the art can easily make corresponding modifications or alterations based on the main concept and spirit of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of protection claimed in the claims.
Claims
1. A method for generating class integration test order based on graph neural networks and D3QN, characterized in that, It includes: Analyze the software under test and construct a directed weighted object relation graph (ORD).<V,E,W> Wherein, the category set V represents all categories in the software, the edge set E represents the dependencies between the categories, and the weight set W is determined based on the frequency of variable access and method calls between the categories; Based on the object relationship graph (ORD), graph embedding features and centrality features are fused to generate composite node features for each category. The composite node features are input into a multi-layer graph neural network scoring model, which outputs a key score for each category. A Markov decision process model is constructed based on the object relationship graph (ORD) and key scores, and a deterministic class integration test order is generated based on the D3QN algorithm and the Markov decision process model.
2. The method as described in claim 1, characterized in that, The step of generating composite node features for each category by fusing graph embedding features and multidimensional centrality features based on the Object Relationship Graph (ORD) includes: Graph embedding features for each category are generated using the Node2Vec algorithm, wherein the graph embedding features include a vector of a first predetermined number of dimensions; The centrality features of the category are generated by setting an algorithm. The centrality features include vectors with a second set number of dimensions, such as local connectivity, global propagation, and community embedding. The composite node features used for key scoring are generated based on the graph embedding features and centrality features.
3. The method as described in claim 1, characterized in that, The step of inputting the composite node features of each category into the multilayer graph neural network scoring model and outputting the key score for each category includes: An initial key score is obtained by performing an initial key score on the composite node features of each category; Based on the object relation graph (ORD), the predecessor neighbor set and successor neighbor set of each category are sampled to obtain the aggregation score of the predecessor neighbor and successor neighbor. The predecessor neighbor set is all the categories in the object relation graph (ORD) that depend on the current category, and the successor neighbor set is all the categories in the object relation graph (ORD) that the current category depends on. The initial score, the aggregated score of the predecessor neighbor, and the aggregated score of the successor neighbor are concatenated, and deep feature fusion is performed through the multi-layer graph neural network to obtain a temporary key score. The temporary critical scores are subjected to residual join, in-degree-based centrality correction, and noise threshold filtering to generate the final critical scores.
4. The method as described in claim 3, characterized in that, The step of performing an initial key score on the composite feature vector for each category includes the following steps: Design a two-layer fully connected network based on the composite feature vector; After the composite feature vector is sequentially mapped to the 64-dimensional feature space through the first fully connected layer of the two-layer fully connected network, batch normalization, ReLU activation function and Dropout regularization are applied. The dimensionality is then reduced to 32 dimensions through the second fully connected layer of the dual-layer fully connected network, and batch normalization layer, ReLU activation function and Dropout normalization are used for processing. Finally, the output layer of the two-layer fully connected network is linearly transformed using a weight matrix to output the initial score, which has a dimension of 1.
5. The method as described in claim 3, characterized in that, In the step of sampling the set of predecessor neighbors and the set of successor neighbors of each category respectively based on the object relationship graph ORD and obtaining the aggregation scores of the predecessor neighbors and the successor neighbors, the steps include: Independently and randomly sample a set number of predecessor neighbors and successor neighbors for each category. The predecessor neighbors are the categories that depend on the current category, and the successor neighbors are the categories on which the current category depends; Multiply the initial scores of the predecessor neighbors and the successor neighbors by the corresponding edge weights and learnable attention weights respectively, and then sum the weighted results of the predecessor neighbors and the successor neighbors respectively to obtain the aggregation scores of the predecessor neighbors and the successor neighbors. The specific calculation formula is as follows: Among them, a in (v) is the aggregation score of the predecessor neighbor, a out (v) represents the aggregation score of the predecessor neighbor, ω(u,v), s (0) (u), Let ω(v,w) and s represent the edge weights between the current category and the predecessor neighbor, the initial score of the predecessor neighbor, and the attention weights between the current category and the predecessor neighbor, respectively. (1) (w), α ext (v, w) represent the edge weights between the current category and the successor neighbor, the initial score of the successor neighbor, and the attention weights between the current category and the successor neighbor, respectively. The attention weights are generated through training the multilayer graph neural network.
6. The method for generating class integration test order as described in claim 3, characterized in that, The steps of sequentially introducing residual connection, in-degree-based centrality correction, and noise threshold filtering to the temporary criticality scores include: Fuse the temporary criticality scores and the initial scores by weighted combination with a residual coefficient to obtain the basic category scores; Calculate the learnable centrality correction coefficient based on the in-degree of each category in the ORD, and weight the basic category scores to obtain the intermediate scores; Fuse the intermediate scores and the initial scores according to a balance coefficient and normalize them through the Sigmoid function; Apply noise threshold truncation to the normalized scores to generate the final criticality scores.
7. The method as described in claim 1, characterized in that, In the step of constructing a Markov decision process model based on the object relationship graph ORD and the criticality scores, it includes: Model the class integration test order generation problem as a Markov decision process MDP = <S, A, P, R, γ>. Among them, the state space S represents the set of currently tested classes, the action space A represents the set of selecting the next class to be tested, the state transition P is a deterministic transition, and the reward function R is calculated by combining the criticality scores of the selected class and the test stub cost, where: The state space S is represented by a binary vector, s = [s1, s2, ... s2]. i ], where s i =1 indicates that the i-th class has completed testing, s i =0 indicates that it has not been tested; The action space A is defined as A = {0, 1, N-1}, representing the selection of a category from the untested categories. The action space only allows selection from categories that satisfy s. i Select an action from the categories where =0; The deterministic state transition satisfies P(s’|s,a) = 1, that is, after executing the action a, the a-th bit of s′ is set to 1; The reward function is expressed as R = λs * (c i )-cost, where s * (c i ) is the class c to be tested i The critical score, cost is the test stub cost, which represents the test cost of creating a mock test framework for any dependency category that is not in the current test order, and λ is the balance coefficient; The discount factor γ, which is used to balance the relative weights of immediate rewards and future rewards, and its value range is [0,1]; When all classes have been tested, an additional maximum reward Max is obtained.
8. The method as described in claim 7, characterized in that, In the step of generating a deterministic class integration test order based on the D3QN algorithm and the Markov decision process model, it includes: Construct a reinforcement learning framework using the D3QN algorithm. The framework includes an evaluation network and a target network. Both the evaluation network and the target network adopt a Dueling architecture to decompose the Q value into a state value function V(s) and an action advantage function A(s,a); In the training phase, use the evaluation network to select actions and output predicted Q values, select the optimal actions through the evaluation network, calculate the Q values of the optimal actions by the target network, jointly construct the target Q values to form a training objective, and jointly train the reinforcement learning framework through an experience replay mechanism and a soft update mechanism; During the inference phase, the evaluation network is used to repeatedly perform the following process starting from the initial state: calculate the Q-value of all available actions in the current state, select the action with the largest Q-value as the next class to be tested, update the test state, and output the class integration test order consisting of the selected action sequence.
9. The method as described in claim 7, characterized in that, The step of decomposing the Q-value into a state value function V(s) and an action advantage function A(s,a) using the Dueling architecture includes calculating the Q-value using the following formula: Where V(s) represents the intrinsic value of the current state s, A(s,a) represents the advantage of choosing action a relative to the average action in state s, |A| is the total number of legal actions, and ∑ a′∈ A A(s,a′) is the sum of the advantage values over all legal actions; The steps of selecting the optimal action through the evaluation network, calculating the Q-value of the optimal action through the target network, and collaboratively constructing the target include: The next state s is calculated using the evaluation network. t+1 Q value of all legal actions Q eval (s t+1 ,a); Choose the action with the highest Q value. The target network is used to compute in state s t+1 Q-value of the next action: Combined with instant rewards t The target Q is calculated using the following formula, along with the discount factor γ:
10. The method as described in claim 8, characterized in that, The step of co-training the reinforcement learning framework through the experience replay mechanism and the soft update mechanism also includes constructing a loss function based on the mean squared error between the predicted Q-value and the target Q-value, and the specific calculation method is as follows: in, Indicates the playback buffer batch, (s t a t r t s t+1 ) represents a single state transition sample in this batch, corresponding to the current state, the action performed, the immediate reward, and the next state, respectively; y t It is the target Q value; Q eval (s t ,a t ;θ eval ) indicates the evaluation network for (s) t ,a t The Q-value prediction of the input, where θ eval This represents the trainable parameters of the evaluation network; This indicates the calculation of the expected value for the entire sample batch.