Multi-environment parallel testing methods, devices and platforms
By analyzing test data using a target gradient boosting decision tree model and a deep reinforcement learning model, and dynamically generating test scheduling strategies, the problem of low efficiency in parallel testing across multiple environments is solved, enabling faster defect discovery and resource utilization, and improving testing efficiency.
Patent Information
- Application Number
- CN202510630378.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2026-11-17
AI Technical Summary
Existing technologies are inefficient and time-consuming in parallel automated testing across multiple environments, making it difficult to effectively shorten defect discovery time and reduce resource waiting time.
We use a target gradient boosting decision tree model and a target deep reinforcement learning model to analyze historical test data and defect data, determine the priority execution queue of test cases, and dynamically generate test scheduling strategies through reinforcement algorithms to adjust test environment allocation and parallelism in real time.
It significantly shortens the defect discovery time, maximizes the use of testing equipment and computing power, and forms a collaborative mechanism of priority-driven execution and dynamic resource scheduling, effectively shortening the overall testing cycle and improving testing execution efficiency.
Smart Images

Figure CN123114941A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software automated testing technology, and in particular to a multi-environment parallel testing method, apparatus and platform. Background Technology
[0002] Modern software applications need to run on multiple devices, operating systems, and browsers. With the widespread adoption of cloud computing, virtualization, and container technologies, multi-environment parallel testing has become an effective means of addressing application compatibility challenges across different environments. To ensure software quality, development teams need to test software behavior simultaneously in multiple environments, a task that is extremely time-consuming in traditional manual testing. Therefore, improving the testing efficiency of multi-environment parallel automated testing platforms is a pressing issue that needs to be addressed. Summary of the Invention
[0003] The main objective of this application is to provide a multi-environment parallel testing method, apparatus, and platform, aiming to improve the testing efficiency of multi-environment parallel automated testing.
[0004] To achieve the above objectives, this application proposes a multi-environment parallel testing method, the method comprising:
[0005] Historical test data and defect data are input into the target test model, which includes a target gradient boosting decision tree model and a target deep reinforcement learning model.
[0006] The historical test data and defect data are analyzed using the target gradient boosting decision tree model to determine the priority execution queue of test cases;
[0007] The current resources and the priority execution queue are input into the target deep reinforcement learning model, and a target test scheduling strategy is dynamically generated according to the reinforcement algorithm.
[0008] The test environment allocation and parallelism are adjusted in real time according to the target test scheduling strategy.
[0009] In one embodiment, the step of analyzing the historical test data and defect data through the target gradient boosting decision tree model to determine the priority execution queue of test cases includes:
[0010] The historical test data and defect data are analyzed using the target gradient boosting decision tree model to calculate the success probability and priority score of test cases.
[0011] Based on the success probability and priority score of the test cases, a priority execution queue for the test cases is determined through a model fusion strategy.
[0012] In one embodiment, the target gradient boosting decision tree model includes an execution probability model and a priority score model. The step of analyzing the historical test data and defect data using the target gradient boosting decision tree model to calculate the success probability and priority score of test cases includes:
[0013] The historical test data is input into the execution probability model, and binary classification training is performed using the cross-entropy loss function to output the success probability of each test case.
[0014] The defect data is input into the priority score model, and regression training is performed using the mean squared error loss function to output the priority score for each test case.
[0015] In one embodiment, determining the priority execution queue of test cases based on the success probability and priority score of the test cases through a model fusion strategy includes:
[0016] Based on preset weighting coefficients, the success probability and the priority score are weighted and fused to generate a comprehensive priority value level;
[0017] The test cases are sorted according to the comprehensive priority level to determine the priority execution queue of the test cases.
[0018] In one embodiment, the step of inputting the current resources and the priority execution queue into the target deep reinforcement learning model, and dynamically generating a target test scheduling strategy according to the reinforcement algorithm, includes:
[0019] Based on the current resources and the priority execution queue, a Q-table is established, which includes a set of actions and a reward function;
[0020] The action set is iteratively updated according to the reward function to generate a target test scheduling strategy.
[0021] In one embodiment, the Q-table further includes a state set and a Q-value, and the step of iteratively updating the action set according to the reward function to generate a target test scheduling strategy includes:
[0022] Based on the ε-greedy strategy, the environment allocation actions and parallelism adjustment actions are determined, and the action execution results are obtained.
[0023] Calculate the reward function based on the set of states and the results of the action execution;
[0024] The network parameters of the target deep reinforcement learning model are updated according to the reward function to obtain the optimal Q value;
[0025] The action set is updated based on the optimal Q value to determine the target test scheduling strategy.
[0026] In one embodiment, updating the network parameters of the target deep reinforcement learning model according to the reward function to obtain the optimal Q value further includes:
[0027] The Q-value is decomposed into a state-value function and a dominance function;
[0028] The state value function and the advantage function are updated according to the reward function to obtain the optimal Q value.
[0029] In one embodiment, before inputting historical test data and defect data into the target test model, the method further includes:
[0030] Historical test data and defect data are input into the initial test model, which includes an initial gradient boosting decision tree model and an initial deep reinforcement learning model.
[0031] The initial test model is optimized and trained using a dual deep reinforcement learning mechanism and a priority experience replay mechanism to obtain the target test model.
[0032] Furthermore, to achieve the above objectives, this application also proposes a multi-environment parallel testing device, which includes:
[0033] The parameter input module is used to input historical test data and defect data into the target test model, which includes a target gradient boosting decision tree model and a target deep reinforcement learning model.
[0034] The queue determination module is used to analyze the historical test data and defect data through the target gradient boosting decision tree model to determine the priority execution queue of test cases;
[0035] The strategy generation module is used to input the current resources and the priority execution queue into the target deep reinforcement learning model, and dynamically generate the target test scheduling strategy according to the reinforcement algorithm.
[0036] The target test module is used to adjust the test environment allocation and parallelism in real time according to the target test scheduling strategy.
[0037] In addition, to achieve the above objectives, this application also proposes a multi-environment parallel testing platform, the platform comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the multi-environment parallel testing method as described above.
[0038] This application provides a multi-environment parallel testing method. Historical test data and defect data are input into a target test model, which includes a target gradient boosting decision tree model and a target deep reinforcement learning model. The target gradient boosting decision tree model analyzes historical test data and defect data to determine the priority execution queue of test cases. Current resources and the priority execution queue are input into the target deep reinforcement learning model, and a target test scheduling strategy is dynamically generated based on the reinforcement algorithm. The test environment allocation and parallelism are adjusted in real time according to the target test scheduling strategy. By inputting historical test data and defect data into the target test model, historical data can be analyzed to accurately identify key test cases and prioritize their execution, significantly shortening defect discovery time. Simultaneously, based on current resources and the priority execution queue, the utilization of test equipment and computing power is maximized, reducing idle waiting time. This forms a collaborative mechanism of priority-driven execution and dynamic resource scheduling, effectively shortening the overall test cycle and improving test execution efficiency. Attached Figure Description
[0039] 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.
[0040] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 A flowchart illustrating the first embodiment of the multi-environment parallel testing method of this application;
[0042] Figure 2 A flowchart illustrating the second embodiment of the multi-environment parallel testing method of this application;
[0043] Figure 3 A flowchart illustrating the third embodiment of the multi-environment parallel testing method of this application;
[0044] Figure 4 This is a schematic diagram of the module structure of the multi-environment parallel testing device according to an embodiment of this application;
[0045] Figure 5 This is a schematic diagram of the platform structure of the hardware operating environment involved in the multi-environment parallel testing method in the embodiments of this application.
[0046] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0047] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0048] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0049] The main solution of this application embodiment is as follows: inputting historical test data and defect data into the target test model, the target test model including a target gradient boosting decision tree model and a target deep reinforcement learning model; analyzing the historical test data and defect data through the target gradient boosting decision tree model to determine the priority execution queue of test cases; inputting the current resources and the priority execution queue into the target deep reinforcement learning model, and dynamically generating a target test scheduling strategy according to the reinforcement algorithm; and adjusting the test environment allocation and parallelism in real time according to the target test scheduling strategy.
[0050] Modern software applications need to run across multiple devices, operating systems, and browsers. With the widespread adoption of cloud computing, virtualization, and container technologies, multi-environment parallel testing has become an effective means of addressing application compatibility challenges across different environments. To ensure software quality, development teams need to test software behavior simultaneously in multiple environments, a task that is extremely time-consuming in traditional manual testing. Therefore, improving the testing efficiency of automated multi-environment parallel testing platforms is a pressing issue that needs to be addressed.
[0051] This application provides a solution that inputs historical test data and defect data into a target test model, which includes a target gradient boosting decision tree model and a target deep reinforcement learning model. The target gradient boosting decision tree model analyzes the historical test data and defect data to determine the priority execution queue of test cases. Current resources and the priority execution queue are input into the target deep reinforcement learning model, and a target test scheduling strategy is dynamically generated based on the reinforcement algorithm. The test environment allocation and parallelism are adjusted in real time according to the target test scheduling strategy. By inputting historical test data and defect data into the target test model, historical data can be analyzed to accurately identify and prioritize the execution of key test cases, significantly shortening defect discovery time. Simultaneously, based on current resources and the priority execution queue, the utilization of test equipment and computing power is maximized, reducing idle waiting time. This forms a collaborative mechanism of priority-driven execution and dynamic resource scheduling, effectively shortening the overall test cycle and improving test execution efficiency.
[0052] It should be noted that the execution subject of the method in this embodiment can be a computing service device with multi-environment parallel testing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone; or it can be a multi-environment parallel testing platform with the same or similar functions. This embodiment and the following embodiments will be described using a multi-environment parallel testing platform as an example.
[0053] Based on this, embodiments of this application provide a multi-environment parallel testing method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the multi-environment parallel testing method of this application.
[0054] In this embodiment, the multi-environment parallel testing method includes steps S10 to S40:
[0055] Step S10: Input historical test data and defect data into the target test model, which includes a target gradient boosting decision tree model and a target deep reinforcement learning model.
[0056] It should be noted that this section outlines the general process of existing multi-environment parallel testing methods. Requirements Analysis and Test Design: Define the test scope and scenarios, and define the requirements for multiple environments. Automation Framework Setup: Build an automation framework that supports parallel testing in multiple environments and integrate continuous integration (CI) tools. Test Case Writing: Write environment-independent automation scripts and design data-driven or behavior-driven development (BDD) testing strategies. Parallel Test Execution: Use automation testing tools such as Selenium Grid and Appium to execute tests in parallel across multiple environments. Selenium Grid allows users to execute tests in parallel on multiple machines. Test scripts can run on different browsers and operating systems. Appium is an open-source automation testing framework that supports mobile application testing. It allows tests to run in parallel on different devices and operating systems. Test Result Analysis: Collect and analyze test reports, handle failed test cases, and track down issues. Continuous Integration and Delivery: Integrate with pipelines to ensure that every code commit has automated testing and continuous feedback. This testing strategy effectively manages complex multi-environment testing and improves testing efficiency through parallel execution.
[0057] Understandably, in this embodiment, to improve testing efficiency across multiple environments, data collection and preprocessing are performed first. Success rate, failure rate, execution time, and other relevant information are extracted from historical test execution results. Change records from the code repository are collected, especially changes affecting test case execution (such as code commit logs, file modifications, etc.). Test-related defect records are extracted from the defect tracking system, and the analysis shows which test cases discovered which defects and their severity. The acquired historical test data, including test case execution results, execution time, and code coverage, is analyzed. Code change information, such as change frequency, change size, and affected modules, is extracted. Defect patterns are analyzed, including defect severity, discovery time, and fix time.
[0058] It should be understood that historical test data, code change information, and defect data are transformed into features. Common features include: test case execution time and pass rate, the scale and scope of code changes, and the number, type, and severity of defects. Missing data and outliers are handled, and the data is standardized or normalized to improve the accuracy of model training. The processed data is then input into the target test model for data analysis. The target test model includes a target gradient boosting decision tree model and a target deep reinforcement learning model.
[0059] Step S20: Analyze the historical test data and defect data using the target gradient boosting decision tree model to determine the priority execution queue of test cases.
[0060] Understandably, by analyzing historical test data and defect data using the Gradient Boosting Decision Tree (GBDT) model, the most valuable test cases are selected and their execution priorities are determined, thus obtaining a priority execution queue for the test cases.
[0061] Step S30: Input the current resources and the priority execution queue into the target deep reinforcement learning model, and dynamically generate the target test scheduling strategy according to the reinforcement algorithm.
[0062] It should be understood that the test environment can be determined using a target deep reinforcement learning model (Deep Q-Network, DQN) based on the priority execution queue of test cases, combined with the characteristics of test cases, historical execution data, and currently available resources. The parallelism of the test can be adjusted in real time according to the reinforcement algorithm, and the target test scheduling strategy can be dynamically generated.
[0063] Step S40: Adjust the test environment allocation and parallelism in real time according to the target test scheduling strategy.
[0064] Understandably, the test environment is allocated and the parallelism is adjusted in real time based on the target test scheduling strategy output by the target deep reinforcement learning model.
[0065] This embodiment provides a multi-environment parallel testing method. Historical test data and defect data are input into a target test model, which includes a target gradient boosting decision tree model and a target deep reinforcement learning model. The target gradient boosting decision tree model analyzes the historical test data and defect data to determine the priority execution queue of test cases. Current resources and the priority execution queue are input into the target deep reinforcement learning model, and a target test scheduling strategy is dynamically generated based on the reinforcement algorithm. The test environment allocation and parallelism are adjusted in real time according to the target test scheduling strategy. By inputting historical test data and defect data into the target test model, historical data can be analyzed to accurately identify key test cases and prioritize their execution, significantly shortening defect discovery time. Simultaneously, based on current resources and the priority execution queue, the utilization of test equipment and computing power is maximized, reducing idle waiting time. This forms a collaborative mechanism of priority-driven execution and dynamic resource scheduling, effectively shortening the overall test cycle and improving test execution efficiency.
[0066] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in Embodiment 1 above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2 Step S20, the multi-environment parallel testing method further includes steps S201 to S202:
[0067] Step S201: Analyze the historical test data and defect data using the target gradient boosting decision tree model to calculate the success probability and priority score of the test cases.
[0068] Understandably, the GBDT model is used to predict the success probability and priority score of test cases. Two GBDT models can be constructed, one to predict the probability of success or failure for each test case, and the other to predict the execution order of the test cases throughout the entire test process, thus obtaining a priority score.
[0069] In one feasible implementation, the target gradient boosting decision tree model includes an execution probability model and a priority score model, and step S201 may include steps S2011 to S2012:
[0070] Step S2011: Input the historical test data into the execution probability model, perform binary classification training using the cross-entropy loss function, and output the success probability of each test case.
[0071] It should be noted that two GBDT models, namely the execution probability model (P(X)) and the priority score model (S(X)), may be constructed. P(X) is used to predict the execution success or failure probability of each test case. Through historical data, the model can analyze the failure trend of certain specific test cases, helping the development team to give early warnings. S(X) is used to calculate the priority score of each test case based on the historical performance of the test case, the influence range of code changes, the defect discovery probability, etc. This score determines the execution order of the test case in the entire test process. The model is evaluated using cross-validation and multiple evaluation indicators (such as Area Under the Curve (AUC), accuracy rate) to ensure that the model can accurately predict the execution result and priority of the test case.
[0072] It can be understood that during the model training process, in order to evaluate the generalization ability of the model, the data set is divided into a training set and a validation set. The training set is used to train the model, while the validation set is used to evaluate the performance of the model on unseen data. For example, the data set is divided into a training set and a validation set at a ratio of 80:20 or 70:30. For the scenario of this embodiment, cross-validation (such as k-fold cross-validation) is used to ensure the stability of model evaluation. Let the data set be D=(X1,y1), (X2,y2) ,.. ..., (Xn, yn), the data set is divided into a training set Dtrain and a test set Dvalid, satisfying Dtrain is used for model training, and Dvalid is used to evaluate model performance.
[0073] It should be noted that the execution probability model is used to predict the execution success probability of each test case, which is a binary classification problem (pass / fail). In this case, the most commonly used loss function is the cross-entropy loss function, which is expressed by the formula as:
[0074]
[0075] where n is the number of samples, y i is the true label (0 or 1) of the i-th sample, p i is the probability that the i-th sample is predicted to be 1 (successfully executed). Cross-entropy measures the difference between the probability distribution predicted by the model and the true label. The smaller the cross-entropy loss, the closer the prediction of the model is to the true label.
[0076] Step S2012: Input the defect data into the priority score model, perform regression training through the mean square error loss function, and output the priority score of each test case.
[0077] It's worth noting that the priority score model aims to predict the priority score of test cases. Since priority is a continuous value, the mean squared error (MSE) is used as the loss function. The formula is as follows:
[0078]
[0079] Where n is the number of samples, y i Let i be the true priority score of the i-th sample. This represents the priority score predicted by the model for the i-th sample. Mean squared error measures the squared difference between the model's predicted value and the true value; the smaller the error, the better the model fits the data.
[0080] Step S202: Based on the success probability and priority score of the test cases, determine the priority execution queue of the test cases through a model fusion strategy.
[0081] Understandably, a model fusion strategy can be used to fuse or merge the success probability and priority score of test cases to obtain a priority execution queue for test cases.
[0082] In one possible implementation, step S202 may include steps S2021 to S2022:
[0083] Step S2021: Based on preset weight coefficients, the success probability and the priority score are weighted and fused to generate a comprehensive priority value.
[0084] Step S2022: Sort the test cases according to the comprehensive priority level to determine the priority execution queue of the test cases.
[0085] It is worth noting that, based on the above analysis, for each test case, its final priority V is calculated and expressed as:
[0086] V = α·P(X) + (1-α)·S(X),
[0087] Where V represents the final priority score of the test case, P(X) represents the pass probability of the test case output by the GBDT execution probability model, S(X) represents the priority output by the GBDT priority score model, and α is a weighting coefficient that controls the influence of the execution success probability and the priority score. Based on the calculated priority scores, all test cases are sorted. Higher-priority test cases are executed first, thereby effectively improving the efficiency of defect discovery during testing.
[0088] It's important to note that the coefficient α adjusts the relative weights of the execution probability P(X) and the priority score S(X), balancing their impact on the final priority score V. Its value range is 0 ≤ α ≤ 1: when α = 1, the final priority V depends only on the execution probability P(X), completely ignoring the priority score S(X); when α = 0, the final priority V depends only on the priority score S(X), completely ignoring the execution probability P(X); when α = 0.5, the execution probability and priority score have equal weight in the final priority. If the primary goal is to find more defects, α can be decreased, i.e., more emphasis is placed on the priority score S(X). If the priority is the pass rate of the test (e.g., saving resources, reducing invalid executions), α can be increased, placing more emphasis on the execution probability P(X). For most testing scenarios, choosing a moderate α value (0.5) can balance the execution probability and priority score. After calculating the priority V of all test cases, the test cases can be sorted according to the value of V, prioritizing the execution of higher-priority cases. After sorting, the test scheduling strategy can determine the order of parallel execution based on these priorities, improving testing efficiency and defect discovery rate.
[0089] In this embodiment, historical test data and defect data are analyzed using the target gradient boosting decision tree model to calculate the success probability and priority score of test cases. Based on the success probability and priority score of the test cases, a model fusion strategy is used to determine the priority execution queue of the test cases. By introducing the success probability and priority score of test cases, this embodiment can more accurately determine the priority execution queue of test cases through a model fusion strategy.
[0090] Based on the first embodiment of this application, in the third embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 3 Step S30, the multi-environment parallel testing method further includes steps S301 to S302:
[0091] Step S301: Based on the current resources and the priority execution queue, establish a Q-table, which includes a set of actions and a reward function.
[0092] Step S302: Iteratively update the action set according to the reward function to generate a target test scheduling strategy.
[0093] Understandably, an action set and reward function can be established based on current resources and a priority execution queue, forming a Q-table. Then, the action set is iteratively updated based on the reward function to generate the target test scheduling strategy.
[0094] In one feasible implementation, the Q table further includes a set of states and Q values, and step S302 may include steps S3021 to S3024:
[0095] Step S3021: Determine the environment allocation action and parallelism adjustment action based on the ε-greedy strategy, and obtain the action execution result.
[0096] Understandably, the specific process of the target deep reinforcement learning model dynamically generating the target test scheduling strategy according to the reinforcement algorithm can be as follows: initializing the experience replay buffer D, initializing the main network parameters θ and the target network parameters θ-. For each training round, observe the current state s, use the ε-greedy strategy to determine the environment-assigned action and the parallelism adjustment action, and obtain the action execution result action a (randomly explore with probability E, and select the action with the largest Q value with probability 1-ε).
[0097] Step S3022: Calculate the reward function based on the state set and the action execution result.
[0098] It should be understood that, after executing action a, observing the reward r and the new state s′, the reward function of DQN is calculated, denoted as R(s, a, s′), representing the reward for reaching the new state s′ from state s by executing action a. During test execution, the following metrics are continuously monitored: test case execution time, resource utilization (Central Processing Unit (CPU), memory, etc.), test coverage, defect detection rate, etc. These metrics are used to calculate the DQN reward function, denoted as R(s, a, s′), representing the reward for reaching the new state s′ by executing action a from state s, expressed as:
[0099] R(s, a, s′)=w1*Δt+w2*Δc+w3*Δe,
[0100] Where Δt represents the degree of improvement in test execution time, Δc represents the degree of improvement in resource utilization, Δe represents the degree of improvement in test coverage, and w1, w2, and w3 are weight parameters, respectively.
[0101] Step S3023: Update the network parameters of the target deep reinforcement learning model according to the reward function to obtain the optimal 0 value.
[0102] Understandably, the process involves storing the experience (s, a, r, s′) in D; randomly sampling a small batch of experience from D; and calculating the target Q value. Calculate the loss: L = (yQ) θ (s, a)) 2 Update θ using gradient descent to minimize L; every N steps, copy θ to θ''. - .
[0103] For example, a deep reinforcement learning model is used to optimize test case allocation and parallelism adjustment in dynamic multi-environment scenarios to maximize resource utilization and testing efficiency. In the DQN model, the system state S includes several pieces of information: s1: Current test environment resources (e.g., the number of available test nodes, virtual machines, or devices). s2: Test case execution progress (e.g., the number of executed test cases). s3: The number of test cases currently being executed in parallel. s4: Test cases awaiting execution in the test queue. s5: The number of high-priority test cases. The action space of the DQN model is defined by test environment allocation and parallelism adjustment; test environment allocation determines how many test environments are allocated, and parallelism adjustment determines how many parallel tests are run in each test environment.
[0104] It should be understood that the DQN model uses a deep Q-network, with the input layer representing the dimension of the environment state S, the hidden layers consisting of multiple fully connected layers using the Rectified Linear Unit (ReLU) activation function, and the output layer representing the dimension of the action space A, indicating the Q-value for each action. The Q-value update formula is expressed as:
[0105] Q(s, a)←-Q(s, a)+α*[R+γ*max(Q(s′, a′))-Q(s, a)],
[0106] Where α is the learning rate, γ is the discount factor, s is the current state, a is the current action, s′ is the next state, and a′ is the next possible action. To break the correlation between samples and improve the stability of learning, an experience replay mechanism is used. An experience replay buffer D is maintained to store transformed samples (s, a, r, s′). During each training session, a mini-batch of samples is randomly sampled from D, and these samples are used to update the neural network parameters.
[0107] It should be understood that, to improve training stability, DQN uses a separate target network to compute the target Q-value. The parameters θ of the target network are periodically copied from the main network, for example, updated every N steps. Therefore, the loss function of DQN is defined as follows:
[0108]
[0109] Where r is the instant reward and γ is the discount factor, typically set between 0.9 and 0.99. It is the maximum Q-value of the next state calculated using the target network, Q θ (s, a) is the current network prediction of 0.
[0110] In one feasible implementation, step S3023 may include steps S30231 to S30232:
[0111] Step S30231: Decompose the Q value into a state value function and a dominance function.
[0112] Step S30232: Update the state value function and the advantage function according to the reward function to obtain the optimal Q value.
[0113] Step S3024: Update the action set according to the optimal Q value and determine the target test scheduling strategy.
[0114] It's worth noting that to further improve DQN performance, the Q-value can be decomposed into a state-value function and an advantage function using the Dueling DQN technique, which helps to better evaluate the value of a state. Through this carefully designed DQN structure and training process, the system can learn an efficient policy to make optimal resource allocation and parallelism adjustment decisions based on the current test environment state, thereby significantly improving testing efficiency and resource utilization. The advantage of this approach lies in its adaptability to complex and dynamically changing test environments and its ability to continuously improve its decision-making quality with accumulated experience.
[0115] In one feasible implementation, steps S01 to S02 may be included before step S10:
[0116] Step S01: Input historical test data and defect data into the initial test model, which includes an initial gradient boosting decision tree model and an initial deep reinforcement learning model.
[0117] Step S02: The initial test model is optimized and trained through a dual deep reinforcement learning mechanism and a priority experience replay mechanism to obtain the target test model.
[0118] Understandably, models can be periodically updated using newly collected data, including GBDT models: retrained using new test results and defect data, potentially involving incremental learning techniques. DQN models: continuously optimized through a sustained reinforcement learning process.
[0119] For example, recording whether each test case passes or fails directly impacts the model's prediction of test success rate. Recording the reasons for failed test cases (e.g., functional defects, environmental issues, etc.) helps improve defect detection capabilities. Collecting resource usage data for each test environment, such as CPU, memory, input / output (I / O), and network, helps the DQN model better optimize resource allocation and avoid test bottlenecks. Recording the execution time of each test case helps predict future execution times, especially for time-sensitive test scenarios. Analyzing the reasons for failures, such as code defects, external dependency issues, or unstable test environments, will improve the GBDT model. This collected data will be used for subsequent model updates, particularly to improve the accuracy of model predictions and optimize resource scheduling, enabling the system to adapt to rapid iterative software development processes.
[0120] It's important to note that as test data accumulates, both the GBDT and DQN models need continuous updates to ensure the accuracy of test prioritization and optimal utilization of environmental resources. The specific steps for model updates are as follows: The GBDT model is retrained using the latest test execution data. This new data includes information such as the actual execution results of test cases, execution duration, and reasons for failure. The training objective of the GBDT model is to predict the pass rate P(X) and priority score S(X) of test cases. Regular model updates continuously improve the accuracy of these predictions. With new data, the GBDT model can identify new patterns and behaviors in the code, improving predictions of future test case execution. Updating the GBDT model allows priority calculation to be more flexible and adaptable to new development scenarios. For example, as code changes, some test cases may become more critical, and the model can more accurately reflect these changes through retraining. The DQN model uses a feedback mechanism and a reward function to optimize the Q-value, thereby influencing the test case scheduling strategy. Feedback data (such as execution time and environmental load) is used to update the Q-value, enhancing DQN's ability to learn resource allocation strategies under different environments. By updating, the DQN model can better adjust the parallelism of test cases and the resource allocation among different test environments. For example, when some environments are under excessive pressure, the DQN model can learn to reduce resource allocation and prioritize other environments to improve overall efficiency. Through reinforcement learning, the DQN model can continuously improve its decision-making process, avoid resource bottlenecks or test case conflicts, and improve the overall efficiency of parallel testing.
[0121] In this embodiment, a Q-table, including an action set and a reward function, is established based on current resources and a priority execution queue. The action set is iteratively updated according to the reward function to generate a target test scheduling strategy. By combining this with updating the network parameters of the target deep reinforcement learning model, the optimal Q-value is obtained. The action set is then updated based on the optimal Q-value, thereby generating a more accurate target test scheduling strategy.
[0122] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the multi-environment parallel testing method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0123] This application also provides a multi-environment parallel testing device, please refer to... Figure 4 The multi-environment parallel testing device includes:
[0124] The parameter input module 10 is used to input historical test data and defect data into the target test model, which includes a target gradient boosting decision tree model and a target deep reinforcement learning model.
[0125] The queue determination module 20 is used to analyze the historical test data and defect data through the target gradient boosting decision tree model to determine the priority execution queue of test cases;
[0126] The strategy generation module 30 is used to input the current resources and the priority execution queue into the target deep reinforcement learning model, and dynamically generate the target test scheduling strategy according to the reinforcement algorithm;
[0127] The target test module 40 is used to adjust the test environment allocation and parallelism in real time according to the target test scheduling strategy.
[0128] The multi-environment parallel testing apparatus provided in this application, employing the multi-environment parallel testing method described in the above embodiments, can solve the technical problem. Compared with the prior art, the beneficial effects of the multi-environment parallel testing apparatus provided in this application are the same as those of the multi-environment parallel testing method described in the above embodiments, and other technical features in the multi-environment parallel testing apparatus are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0129] This application provides a multi-environment parallel testing platform, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the multi-environment parallel testing method in Embodiment 1 above.
[0130] The following is for reference. Figure 5The diagram illustrates a structural schematic of a test platform suitable for implementing the multi-environment parallel testing of the embodiments of this application. The multi-environment parallel testing platform in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The multi-environment parallel testing platform shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0131] like Figure 5 As shown, a multi-environment parallel test platform may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in read-only memory 1002 or a program loaded from storage device 1003 into random access memory 1004. Random access memory 1004 also stores various programs and data required for the operation of the multi-environment parallel test platform. The processing device 1001, read-only memory 1002, and random access memory 1004 are interconnected via bus 1005. Input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to input / output interface 1006: input devices 1007 including, for example, touch screens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows a multi-environment parallel test platform to wirelessly or wiredly communicate with other platforms to exchange data. While a multi-environment parallel test platform with various systems is shown in the figure, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0132] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0133] The multi-environment parallel testing platform provided in this application, employing the multi-environment parallel testing method described in the above embodiments, can solve the technical problems of multi-environment parallel testing. Compared with the prior art, the beneficial effects of the multi-environment parallel testing platform provided in this application are the same as those of the multi-environment parallel testing method described in the above embodiments, and other technical features of this multi-environment parallel testing platform are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0134] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0135] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0136] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A multi-environment parallel testing method, characterized in that, The method includes: Historical test data and defect data are input into the target test model, which includes a target gradient boosting decision tree model and a target deep reinforcement learning model. The historical test data and defect data are analyzed using the target gradient boosting decision tree model to determine the priority execution queue of test cases; The current resources and the priority execution queue are input into the target deep reinforcement learning model, and a target test scheduling strategy is dynamically generated according to the reinforcement algorithm. The test environment allocation and parallelism are adjusted in real time according to the target test scheduling strategy.
2. The method as described in claim 1, characterized in that, The step of analyzing the historical test data and defect data using the target gradient boosting decision tree model to determine the priority execution queue of test cases includes: The historical test data and defect data are analyzed using the target gradient boosting decision tree model to calculate the success probability and priority score of test cases. Based on the success probability and priority score of the test cases, a priority execution queue for the test cases is determined through a model fusion strategy.
3. The method as described in claim 2, characterized in that, The target gradient boosting decision tree model includes an execution probability model and a priority score model. The step of analyzing historical test data and defect data using the target gradient boosting decision tree model to calculate the success probability and priority score of test cases includes: The historical test data is input into the execution probability model, and binary classification training is performed using the cross-entropy loss function to output the success probability of each test case. The defect data is input into the priority score model, and regression training is performed using the mean squared error loss function to output the priority score for each test case.
4. The method as described in claim 2, characterized in that, The process of determining the priority execution queue of test cases based on the success probability and priority score of the test cases through a model fusion strategy includes: Based on preset weighting coefficients, the success probability and the priority score are weighted and fused to generate a comprehensive priority value level; The test cases are sorted according to the comprehensive priority level to determine the priority execution queue of the test cases.
5. The method as described in claim 1, characterized in that, The step of inputting the current resources and the priority execution queue into the target deep reinforcement learning model, and dynamically generating the target test scheduling strategy according to the reinforcement algorithm, includes: Based on the current resources and the priority execution queue, a Q-table is established, which includes a set of actions and a reward function; The action set is iteratively updated according to the reward function to generate a target test scheduling strategy.
6. The method as described in claim 5, characterized in that, The Q-table also includes a state set and a Q-value. The step of iteratively updating the action set according to the reward function to generate a target test scheduling strategy includes: Based on the ε-greedy strategy, the environment allocation actions and parallelism adjustment actions are determined, and the action execution results are obtained. Calculate the reward function based on the set of states and the results of the action execution; The network parameters of the target deep reinforcement learning model are updated according to the reward function to obtain the optimal Q value; The action set is updated based on the optimal Q value to determine the target test scheduling strategy.
7. The method as described in claim 6, characterized in that, The step of updating the network parameters of the target deep reinforcement learning model according to the reward function to obtain the optimal Q value also includes: The Q-value is decomposed into a state-value function and a dominance function; The state value function and the advantage function are updated according to the reward function to obtain the optimal Q value.
8. The method according to any one of claims 1 to 7, characterized in that, Before inputting historical test data and defect data into the target test model, the process also includes: Historical test data and defect data are input into the initial test model, which includes an initial gradient boosting decision tree model and an initial deep reinforcement learning model. The initial test model is optimized and trained using a dual deep reinforcement learning mechanism and a priority experience replay mechanism to obtain the target test model.
9. A multi-environment parallel testing device, characterized in that, The multi-environment parallel testing device includes: The parameter input module is used to input historical test data and defect data into the target test model, which includes a target gradient boosting decision tree model and a target deep reinforcement learning model. The queue determination module is used to analyze the historical test data and defect data through the target gradient boosting decision tree model to determine the priority execution queue of test cases; The strategy generation module is used to input the current resources and the priority execution queue into the target deep reinforcement learning model, and dynamically generate the target test scheduling strategy according to the reinforcement algorithm. The target test module is used to adjust the test environment allocation and parallelism in real time according to the target test scheduling strategy.
10. A multi-environment parallel testing platform, characterized in that, The platform includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the multi-environment parallel testing method as described in any one of claims 1 to 8.
