Test case dynamic ordering method and system based on hot zone identification and defect prediction

By collecting multimodal data in real time and constructing a DefectBERT model, combined with an LSTM-GRU network and a PID weight controller, dynamic sorting of test cases was achieved. This solved the problem of dynamic and accurate test case sorting in continuous integration environments, and improved defect detection rate and testing efficiency.

CN120780609BActive Publication Date: 2025-11-04四川互慧软件有限公司
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511254442.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-04
Publication Date
2025-11-04
Estimated Expiration
2045-09-04

AI Technical Summary

Technical Problem

Existing technologies struggle to achieve dynamic and accurate test case sorting in continuous integration environments, cannot adapt to frequent code changes, fail to fully utilize multi-source data, and have weak defect prediction models that are unable to capture complex features, resulting in low defect detection rates and significant resource waste.

Method used

A dynamic ranking method for test cases based on hot zone identification and defect prediction is adopted. By collecting multimodal data in real time, a DefectBERT model is constructed, four-dimensional features are calculated, and an LSTM-GRU joint network is used to predict the defect probability. A PID weight controller is used to adjust the feature weights and generate a priority queue of test cases.

Benefits of technology

It improves testing efficiency, increases defect detection rate, reduces false alarm rate, enhances dynamic adaptability, and meets the real-time requirements of continuous integration environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120780609B_ABST
    Figure CN120780609B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of software testing, and relates to a test case dynamic sequencing method and system based on hot area identification and defect prediction. The method comprises: collecting multi-modal data in real time; calculating code change density using a time decay sliding window algorithm, and performing hot area adaptive classification; outputting a defect feature vector through a DefectBERT model, and calculating the correlation between test cases and defects; dynamically allocating the weight of each feature through an adaptive weight adjustment mechanism, and performing adaptive feature fusion; predicting defect probability using an LSTM-GRU joint network, and generating a test case priority queue; and adjusting the weight parameters of four-dimensional features in real time through a PID weight controller. The present application improves test efficiency, increases defect detection rate, reduces false positive rate, and enhances dynamic adaptability. Through dynamic division of hot areas and adaptive adjustment of weights, the present application can adapt to high-frequency code change scenarios and meet the real-time needs of continuous integration environments.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of software testing, and specifically relates to a test case dynamic sequencing method and system based on hot area identification and defect prediction. BACKGROUND

[0002] In the software development continuous integration environment, the efficiency optimization of large-scale regression testing has become a key bottleneck to improve the development iteration speed, especially in the fields of finance and autonomous driving that have strict requirements on software quality. The execution order of test cases directly affects the defect detection efficiency and resource investment cost.

[0003] The current mainstream test case sequencing method has significant technical limitations, which is difficult to meet the dynamic and accurate needs in the continuous integration scenario. Specifically, the following problems exist:

[0004] (1) Inadequate adaptability of static rules: Existing technologies mostly rely on fixed weight strategies or single-dimensional indicators for sequencing, which cannot adapt to the dynamic scenarios of high-frequency code changes in agile development. For example, the patent document "Data processing method, interface conversion structure and equipment" uses a fixed weight allocation method. When the frequency and range of code changes change dramatically, the sequencing logic cannot be automatically adjusted, resulting in an increased risk of missing critical defects. Patent US20180075109A1 only uses code coverage as the basis for sequencing, ignoring key factors such as defect history and change impact range, limiting the accuracy of sequencing;

[0005] (2) Inadequate use of multi-source data: Existing systems fail to establish a correlation analysis mechanism for code changes, defect history, and call topology, resulting in the value of information not being fully exploited. For example, IBM system US20200349072A1 only processes code submission data in isolation and does not conduct comprehensive analysis combining text features in defect reports and topology relationships of function call links, making it difficult to accurately locate high-risk code areas;

[0006] (3) Weak model capturing ability for complex features: Traditional methods mostly use single models (such as the LSTM model used in patent EP3564886), which cannot simultaneously consider the time sequence characteristics and structural features of code changes. Code changes involve both the dynamic rules of submission time series and the topology structure of function call relationships, and single models are difficult to fully capture these multi-modal features, resulting in low defect prediction accuracy.

[0007] In the continuous integration scenario, the above defects further exacerbate the core contradiction between the limited test resources and the overall defect detection, if the traditional method is used to execute all test cases, it takes too long and seriously slows down the development iteration pace, if the random sampling method is used to reduce the test range, the key defect omission rate rises significantly, which cannot meet the quality requirements of high reliability field. Therefore, an intelligent sorting system integrating dynamic code feature recognition, multi-dimensional data correlation and adaptive model is needed to break through the existing technical bottleneck and realize efficient detection of defects under limited resources. SUMMARY

[0008] In order to solve the problems of low test case sorting efficiency and insufficient defect detection rate in large-scale regression testing under continuous integration environment, the present application provides a test case dynamic sorting method and system based on hot area identification and defect prediction.

[0009] In the first aspect, the present application provides a test case dynamic sorting method based on hot area identification and defect prediction, comprising:

[0010] Real-time collection of multi-modal data, including change logs of code repository and defect reports of defect management system;

[0011] Adopting time decay sliding window algorithm to calculate code change density and perform hot area adaptive classification;

[0012] Building and training DefectBERT model, outputting defect feature vector from DefectBERT model to multi-modal data after hot area adaptive classification, and calculating the correlation degree between test cases and defects according to the defect feature vector;

[0013] Calculating four-dimensional features, dynamically allocating the weight of each feature through adaptive weight adjustment mechanism, and performing adaptive feature fusion; the four-dimensional features include hot area coverage, defect correlation degree, call path weight and time decay coefficient;

[0014] Adopting LSTM-GRU joint network to predict defect probability, and using simulated annealing algorithm to generate test case priority queue;

[0015] According to the test case execution feedback, the weight parameters of the four-dimensional features are adjusted in real time through the PID weight controller.

[0016] In the second aspect, the present application provides a test case dynamic sorting system based on hot area identification and defect prediction, comprising code repository, defect management system, real-time collection unit, dynamic hot area identification unit, defect feature extraction unit, feature fusion unit, hybrid prediction unit, test case priority queue generation unit and PID weight control unit.

[0017] The code repository is used to generate change logs;

[0018] A defect management system for generating a defect report of the defect management system;

[0019] A real-time acquisition unit for acquiring multi-modal data in real time, including a change log of a code repository and a defect report of the defect management system;

[0020] A dynamic hot area identification unit for calculating a code change density by using a time-decay sliding window algorithm according to the change log of the code repository, and performing adaptive classification of hot areas;

[0021] A defect feature extraction unit for constructing and training a DefectBERT model, outputting a defect feature vector from the DefectBERT model for the multi-modal data after adaptive classification of hot areas, and calculating a correlation degree between a test case and a defect according to the defect feature vector;

[0022] A feature fusion unit for calculating four-dimensional features, dynamically allocating weights of each feature by an adaptive weight adjustment mechanism, and performing adaptive feature fusion; the four-dimensional features include a hot area coverage, a defect correlation degree, a call path weight and a time-decay coefficient;

[0023] A hybrid prediction unit for predicting a defect probability by using an LSTM-GRU joint network;

[0024] A test case priority queue generation unit for generating a test case priority queue by using a simulated annealing algorithm;

[0025] A PID weight control unit for adjusting weight parameters of the four-dimensional features in real time by a PID weight controller according to test case execution feedback.

[0026] On the basis of the above technical solutions, the application can also be improved as follows.

[0027] Further, the change log of the code repository includes a modified file path, a changed code line number and a timestamp; and the defect report includes text content, a defect state and an associated code version.

[0028] Further, the real-time acquisition of the multi-modal data further includes: cleaning the change log of the code repository, extracting effective fields, and performing text standardization processing on the defect report; the effective fields include a commit hash, a timestamp and a changed line number; and the text standardization processing includes removing redundant symbols and unifying formats.

[0029] Further, the time-decay sliding window algorithm is used to calculate the code change density for adaptive classification of hotspots, including: setting the sliding window size to the size of the code submitted for the latest set number of times; applying an exponential decay function to calculate the number of changed lines for each submission; calculating the weighted change density within the window; based on the mean and standard deviation of the change density, dynamically dividing the three-level hotspots by threshold, and adaptively classifying the hotspots.

[0030] Further, the adaptive weight adjustment mechanism is used to dynamically allocate feature weights for adaptive feature fusion, including: assigning initial weights, dynamically adjusting feature weights through PID controller, gradient descent and simulated annealing algorithm for adaptive feature fusion.

[0031] Further, the DefectBERT model is used to output defect feature vectors from the multi-modal data adaptively classified by the hotspots, including: inputting defect report text, code change context and call stack topology graph; using the DefectBERT model with multi-head attention mechanism pre-trained in the field to output CLS vector as defect feature vector.

[0032] Further, the cosine similarity algorithm is used to calculate the correlation between test cases and defects.

[0033] Further, the DefectBERT model is constructed and trained, including:

[0034] The hyperparameters are determined by iterative search using the Bayesian optimization method; the hyperparameters include learning rate, batch size, simulated annealing parameters and cooling rate;

[0035] Based on the historical code change data, the change density is calculated, the hotspots are divided, and the sample labels are labeled;

[0036] The DefectBERT model is used to pre-train the multi-modal defect data and output the defect feature vector;

[0037] The four-dimensional features are fused, and the defect prediction model is trained through the LSTM-GRU joint network, and the cross-entropy loss function is used to optimize the parameters.

[0038] Further, the LSTM-GRU joint network includes an input layer, a bidirectional LSTM layer, a GRU layer, a fully connected layer and an output layer; the LSTM-GRU joint network is used to predict the defect probability, and the simulated annealing algorithm is used to generate the test case priority queue, including: the bidirectional LSTM layer captures the code change time series features; the GRU layer learns the call topology structure features; the fully connected layer integrates the code change time series features and the topology structure features; the fully connected layer integrates the code change time series features and the topology structure features; the output layer generates the defect prediction probability through the sigmoid function.

[0039] The application has the advantages that the test efficiency is improved, the defect detection rate is increased, the false positive rate is reduced, and the dynamic adaptability is enhanced. BRIEF DESCRIPTION OF DRAWINGS

[0040] Figure 1 A principle diagram of the test case dynamic sequencing method based on hot area identification and defect prediction provided by the application is shown in the figure.

[0041] Figure 2 A flowchart of the test case dynamic sequencing method based on hot area identification and defect prediction is shown in the figure.

[0042] Figure 3 A principle diagram of the hot area adaptive classification is shown in the figure.

[0043] Figure 4 A structure block diagram of the LSTM-GRU combined network is shown in the figure.

[0044] Figure 5 A principle block diagram of the test case dynamic sequencing system based on hot area identification and defect prediction provided by the embodiment 2 of the application is shown in the figure. DETAILED DESCRIPTION

[0045] To make the objectives, technical solutions and advantages of the embodiments of the application clearer, the technical solutions in the embodiments of the application will be described below in connection with the drawings in the embodiments of the application. Obviously, the described embodiments are some but not all of the embodiments of the application. The components of the embodiments of the application described and shown in the drawings herein can be arranged and designed in various different configurations.

[0046] Embodiment 1

[0047] As an embodiment, as shown in the accompanying drawings, to solve the above technical problems, the embodiment provides a test case dynamic sequencing method based on hot area identification and defect prediction, which comprises the following steps. Figure 1

[0048] Real-time collection of multi-modal data, including change logs of code repositories and defect reports of defect management systems;

[0049] Adopting a time decay sliding window algorithm to calculate the code change density and perform hot area adaptive classification;

[0050] Constructing a DefectBERT model and training it, outputting a defect feature vector from the DefectBERT model for the multi-modal data after hot area adaptive classification, and calculating the correlation between the test case and the defect according to the defect feature vector;

[0051] ​Four-dimensional features are calculated, and the weights of each feature are dynamically allocated through an adaptive weight adjustment mechanism to perform adaptive feature fusion. The four-dimensional features include hotspot coverage, defect correlation, call path weight, and time decay coefficient.

[0052] An LSTM-GRU joint network is used to predict defect probabilities, and a test case priority queue is generated using a simulated annealing algorithm.

[0053] Based on the test case execution feedback, the weight parameters of the four-dimensional features are adjusted in real time through a PID (Proportional-Integral-Derivative) weight controller.

[0054] As attached Figure 2 The flowchart shown is for a dynamic test case sorting method based on hot zone identification and defect prediction.

[0055] This method uses an exponentially weighted moving average to classify hot zones into three levels. Specifically, it monitors code repository change records in real time and extracts change logs for each commit; it uses an exponential decay function to dynamically calculate change density; and it uses a dynamic window to classify hot zones into three levels.

[0056] Optionally, the code repository change log includes modified file paths, changed lines of code, and timestamps; the defect report includes text content, defect status, and associated code version.

[0057] Specifically, "modified file path" refers to the location of the file involved; "changed line of code" refers to the number of lines of code added, deleted, or modified in this commit; and "timestamp" refers to the specific time when the commit log occurred.

[0058] An exponential decay function is used to dynamically calculate the change density. Let the change density be decay, the current time be current_time, the commit log time be commit.time, and exp be the exponential function. The formula for the exponential decay function is decay=exp(-λ*(current_time-commit.time)), where λ=0.05 is a parameter determined after grid search optimization.

[0059] Optionally, real-time collection of multimodal data also includes: cleaning the change logs of the code repository, extracting valid fields, and performing text standardization processing on defect reports; valid fields include commit hash, timestamp, and number of lines changed; text standardization processing includes removing redundant symbols and standardizing the format.

[0060] Optional, as shown in the appendix Figure 3As shown, the time decay sliding window algorithm is used to calculate the code change density for adaptive classification of hot areas, including: setting the sliding window size to the size of the code submitted in the last set number of times; applying an exponential decay function to the number of changed lines for each submission; calculating the weighted change density in the window; based on the mean and standard deviation of the change density, dynamically dividing the three hot areas by threshold, and adaptively classifying the hot areas.

[0061] The adaptive window size is used, and the default window contains 50 submissions, which can be adjusted according to actual conditions to ensure the timeliness and accuracy of classification.

[0062] Based on the statistical characteristics of the data in the window, the classification is as follows:

[0063] Calculate the mean and standard deviation of the weighted change value in the window; let the mean be μ and the standard deviation be σ;

[0064] Determine the threshold values of high, medium and low three hot areas; let the mean of the weighted change value in the window be mean, the threshold value of the high heat area be threshold_high, and the threshold value of the low heat area be threshold_low, threshold_high = mean + 1.5 * σ, threshold_low = mean - 1.5 * σ;

[0065] When the weighted change value is greater than or equal to threshold_high, it is classified as a high heat area; when the weighted change value is less than threshold_high and greater than or equal to threshold_low, it is classified as a medium heat area; when the weighted change value is less than threshold_low, it is classified as a low heat area.

[0066] Optionally, the adaptive weight adjustment mechanism is used to dynamically allocate feature weights for adaptive feature fusion, including: allocating initial weights, dynamically adjusting feature weights through PID controllers, gradient descent and simulated annealing algorithms, and adaptively fusing features.

[0067] Optionally, the DefectBERT model is used to output defect feature vectors for multi-modal data adaptively classified by the hot area, including: inputting defect report text, code change context and call stack topology graph; using the DefectBERT model with multi-head attention mechanism pre-trained in the field to output the CLS vector as the defect feature vector.

[0068] In the forward propagation method, the input data is transmitted into the BERT module for processing to obtain an output result after field self-adaptation pre-training, so that the model can better adapt to the data characteristics of a specific defect field; the output result is transmitted into the attention module in the model as a query, a key and a value for attention calculation to obtain an output result after attention mechanism processing; through the attention mechanism, information that is more important for defect characteristics can be highlighted; a 0th vector 0 is extracted from the obtained output result, and this CLS vector will be used as the final defect mode representation result for subsequent correlation degree calculation.

[0069] In the multi-modal data fusion stage, three types of multi-modal data are collected and integrated, namely defect reports (text type), code change context (diff format), and call stack topology graph, to provide a comprehensive data basis for subsequent defect analysis.

[0070] Optionally, a cosine similarity algorithm is used to calculate the correlation degree between the test case and the defect.

[0071] The cosine similarity algorithm is used to calculate the matching degree between the test case and the historical defect to obtain the defect correlation degree, which can be used to measure the similarity between the two and provide a basis for defect analysis and positioning. Compared with the traditional TF-IDF (Term Frequency-Inverse Document Frequency) method, the accuracy of defect correlation degree calculation is significantly improved.

[0072] The adaptive weight adjustment mechanism is used to dynamically allocate the weights of each feature for adaptive feature fusion. The weights of hot zone coverage rate, defect correlation degree, call path weight and time decay coefficient are set as a, b, g and d in turn, and a+b+g+d=1. Optionally, the initial weights are set as a=0.4, b=0.3, g=0.2 and d=0.1, which are updated in real time according to test feedback.

[0073] Let the hot zone coverage rate be , Let the total number of changed lines be , Let the total number of hot zones to be calculated be , Let the file weight be ,

[0074] , .

[0075] Let the defect correlation degree be , , For the defect feature vector, the cosine similarity is used to calculate the matching degree between the test case and the defect feature vector to obtain the defect correlation degree: .

[0076] Let the call path weight be , The node importance evaluation algorithm is The call path depth is

[0077] .

[0078] Let the time decay coefficient be , The code change time interval is .

[0079] Optionally, the DefectBERT model is constructed and trained, including:

[0080] The hyperparameters are determined by iterative search using the Bayesian optimization method; the hyperparameters include the learning rate, the batch size, the simulated annealing parameter, and the cooling rate;

[0081] The change density is calculated based on the historical code change data, the hot area is divided, and the sample label is labeled;

[0082] The DefectBERT model is used to pretrain the multi-modal defect data, and the defect feature vector is output;

[0083] The four-dimensional features are fused, the defect prediction model is trained through the LSTM-GRU joint network, and the cross-entropy loss function is used to optimize the parameters.

[0084] Optionally, as shown in the accompanying Figure 4 The LSTM-GRU joint network includes an input layer, a bidirectional LSTM (Long Short-Term Memory, long short-term memory network) layer, a GRU (Gated Recurrent Unit, gated recurrent unit) layer, a fully connected layer, and an output layer; the LSTM-GRU joint network is used to predict the defect probability, and the simulated annealing algorithm is used to generate the test case priority queue, including: the bidirectional LSTM layer captures the code change time sequence feature; the GRU layer learns the call topology structure feature; the fully connected layer integrates the code change time sequence feature and the topology structure feature; the output layer generates the defect prediction probability through the sigmoid function. The time sequence feature output by the LSTM and the structure feature output by the GRU layer need to be uniformly processed to generate the defect probability. The fully connected layer realizes nonlinear combination through the weight matrix, enhancing the model expression ability.

[0085] In the model initialization stage, a hybrid neural network is created, a bidirectional long short-term memory layer is initialized, input dimension and hidden layer dimension are set for capturing time sequence features later, a gated recurrent unit layer is initialized, input dimension and hidden layer dimension are set for extracting structural correlation features later; in the model forward propagation stage, in the forward propagation method, the input data is transmitted into the bidirectional long short-term memory layer for processing to obtain an output result, time sequence features in the data are captured; the gated recurrent unit processing: the output of the bidirectional long short-term memory is transmitted into the gated recurrent unit layer for processing to obtain an output result, structural correlation features in the data are extracted; the output prediction result: after the features of the last time step of the gated recurrent unit are processed by a full connection layer, the final prediction result is obtained by a sigmoid function activation, the prediction result represents a probability value of the prediction target. That is, the LSTM layer captures the time sequence mode of code change, and the GRU layer learns the call topology structure features.

[0086] The actual application by examples shows that the test efficiency of the application is improved, the test time is shortened from 6.8 hours of the traditional method to 2.1 hours, the improvement range is 69.1 %; the defect detection rate is improved: the defect detection rate is improved from 82 % to 97 %, and increased by 15 percentage points; the false positive rate is reduced: the false positive rate is reduced from 23 % to 8 %, and the reduction range is 65.2 %; dynamic adaptability is enhanced: through dynamic division of hot areas and adaptive adjustment of weights, the high-frequency code change scene can be adapted, and the real-time demand of the continuous integration environment can be met.

[0087] Embodiment 2

[0088] Based on the same principle as the method shown in Embodiment 1 of the application, as shown in the accompanying Figure 5 The embodiment of the application also provides a test case dynamic sequencing system based on hot area identification and defect prediction, which comprises a code repository, a defect management system, a real-time acquisition unit, a dynamic hot area identification unit, a defect feature extraction unit, a feature fusion unit, a hybrid prediction unit, a test case priority queue generation unit and a PID weight control unit.

[0089] The code repository is used for generating a change log.

[0090] The defect management system is used for generating a defect report of the defect management system.

[0091] The real-time acquisition unit is used for acquiring multi-modal data in real time, including the change log of the code repository and the defect report of the defect management system.

[0092] The dynamic hot area identification unit is used for calculating the code change density by using a time decay sliding window algorithm according to the change log of the code repository, and performing hot area adaptive classification.

[0093] The defect feature extraction unit is configured to construct and train a DefectBERT model, output a defect feature vector from the DefectBERT model for the multi-modal data after adaptive classification of the hot area, and calculate the correlation degree between the test case and the defect according to the defect feature vector.

[0094] The feature fusion unit is configured to calculate four-dimensional features, dynamically allocate the weight of each feature through an adaptive weight adjustment mechanism, and perform adaptive feature fusion. The four-dimensional features include hot area coverage, defect correlation degree, call path weight, and time decay coefficient.

[0095] The hybrid prediction unit is configured to predict the defect probability by using an LSTM-GRU joint network.

[0096] The test case priority queue generation unit is configured to generate a test case priority queue by using a simulated annealing algorithm.

[0097] The PID weight control unit is configured to adjust the weight parameters of the four-dimensional features in real time through a PID weight controller according to the test case execution feedback.

[0098] Optionally, a time decay sliding window algorithm is used to calculate the code change density and perform adaptive classification of the hot area, including: setting the sliding window size to the size of the code submitted in the last set number of times; applying an exponential decay function to the number of changed lines in each submission; calculating the weighted change density in the window; based on the mean and standard deviation of the change density, dynamically dividing the hot area into three levels through a threshold value, and adaptively classifying the hot area.

[0099] Optionally, adaptive feature fusion is performed by dynamically allocating feature weights through an adaptive weight adjustment mechanism, including: allocating initial weights, dynamically adjusting feature weights through a PID controller, gradient descent, and simulated annealing algorithm, and performing adaptive feature fusion.

[0100] Optionally, the DefectBERT model is used to output a defect feature vector from the multi-modal data after adaptive classification of the hot area, including: inputting defect report text, code change context, and call stack topology graph; using a DefectBERT model with a multi-head attention mechanism pre-trained in the field to output a CLS vector as a defect feature vector.

[0101] Optionally, a cosine similarity algorithm is used to calculate the correlation degree between the test case and the defect.

[0102] Optionally, the DefectBERT model is constructed and trained, including:

[0103] The hyperparameters are determined by iterative search through a Bayesian optimization method; the hyperparameters include learning rate, batch size, simulated annealing parameters, and cooling rate.

[0104] Calculate the change density based on the historical code change data, divide the hot area and label the sample label;

[0105] Pre-training the multi-modal defect data by using the DefectBERT model, and outputting a defect feature vector;

[0106] Fusing four-dimensional features, training a defect prediction model through an LSTM-GRU joint network, and optimizing parameters by using a cross-entropy loss function.

[0107] Optionally, the LSTM-GRU joint network comprises an input layer, a bidirectional LSTM layer, a GRU layer, a full connection layer and an output layer; the defect probability is predicted by using the LSTM-GRU joint network, and a test case priority queue is generated by using a simulated annealing algorithm, comprising that the bidirectional LSTM layer captures the code change time sequence feature; the GRU layer learns the call topology structure feature; the full connection layer integrates the code change time sequence feature and the topology structure feature; and the output layer generates the defect prediction probability through a sigmoid function.

[0108] The above only for the preferred embodiments of the present application, and not for limiting the present application, for those skilled in the art, the present application can have various changes and variations. Any modification, equivalent replacement, improvement, etc. within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A dynamic test case sorting method based on hot zone identification and defect prediction, characterized in that, include: Real-time collection of multimodal data, including change logs from the code repository and defect reports from the defect management system; A time-decay sliding window algorithm is used to calculate code change density and perform adaptive hotspot classification. Construct and train the DefectBERT model, output defect feature vectors from the multimodal data after adaptive classification of hot zones using the DefectBERT model, and calculate the correlation between test cases and defects based on the defect feature vectors; Calculate four-dimensional features, dynamically allocate the weights of each feature through an adaptive weight adjustment mechanism, and perform adaptive feature fusion. The four-dimensional features include hotspot coverage, defect correlation, call path weight, and time decay coefficient. An LSTM-GRU joint network is used to predict defect probabilities, and a test case priority queue is generated using a simulated annealing algorithm. Based on the feedback from the test case execution, the weight parameters of the four-dimensional features are adjusted in real time through the PID weight controller.

2. The test case dynamic sorting method based on hot zone identification and defect prediction according to claim 1, characterized in that, The code repository change log includes modified file paths, changed lines of code, and timestamps; the defect report includes text content, defect status, and associated code version.

3. The test case dynamic sorting method based on hot zone identification and defect prediction according to claim 1, characterized in that, Real-time collection of multimodal data also includes: cleaning the change logs of the code repository, extracting valid fields, and performing text standardization processing on defect reports; valid fields include commit hash, timestamp, and number of lines changed; text standardization processing includes removing redundant symbols and standardizing the format.

4. The test case dynamic sorting method based on hot zone identification and defect prediction according to claim 1, characterized in that, The code change density is calculated using a time-decay sliding window algorithm, and hot zone adaptive classification is performed. This includes: setting the sliding window size to the code size of the most recent set number of commits; applying an exponential decay function to calculate the number of lines of change for each commit; calculating the weighted change density within the window; and dynamically dividing the hot zones into three levels based on the mean and standard deviation of the change density through a threshold, and adaptively classifying the hot zones.

5. The test case dynamic sorting method based on hot zone identification and defect prediction according to claim 1, characterized in that, Adaptive feature fusion is achieved by dynamically allocating feature weights through an adaptive weight adjustment mechanism, including: allocating initial weights, dynamically adjusting feature weights through a PID controller, gradient descent, and simulated annealing algorithms, and then performing adaptive feature fusion.

6. The test case dynamic sorting method based on hot zone identification and defect prediction according to claim 1, characterized in that, Building and training the DefectBERT model includes: The hyperparameters were determined through iterative search using Bayesian optimization methods; the hyperparameters included learning rate, batch size, simulated annealing parameters, and cooling rate. Calculate change density based on historical code change data, divide hot zones and label samples; The DefectBERT model is used to pre-train multimodal defect data and output defect feature vectors. By fusing four-dimensional features, a defect prediction model is trained using an LSTM-GRU joint network, and the parameters are optimized using the cross-entropy loss function.

7. The test case dynamic sorting method based on hot zone identification and defect prediction according to claim 1, characterized in that, The DefectBERT model outputs a defect feature vector from the multimodal data after adaptive classification of hot zones, including: input defect report text, code change context, and call stack topology graph; the DefectBERT model with domain adaptive pre-training and multi-head attention mechanism outputs a CLS vector as the defect feature vector.

8. The test case dynamic sorting method based on hot zone identification and defect prediction according to claim 1, characterized in that, The cosine similarity algorithm is used to calculate the correlation between test cases and defects.

9. The test case dynamic sorting method based on hot zone identification and defect prediction according to claim 1, characterized in that, The LSTM-GRU joint network consists of an input layer, a bidirectional LSTM layer, a GRU layer, a fully connected layer, and an output layer. It predicts defect probabilities using the LSTM-GRU joint network and generates a test case priority queue using simulated annealing. The network includes: a bidirectional LSTM layer capturing code change timing features; a GRU layer learning call topology features; a fully connected layer integrating code change timing features and topology features; and an output layer generating defect prediction probabilities using the sigmoid function.

10. A dynamic test case ranking system based on hot zone identification and defect prediction, characterized in that, It includes a code repository, a defect management system, a real-time acquisition unit, a dynamic hotspot identification unit, a defect feature extraction unit, a feature fusion unit, a hybrid prediction unit, a test case priority queue generation unit, and a PID weight control unit; Code repository, used to generate change logs; A defect management system, used to generate defect reports for the defect management system; The real-time acquisition unit is used to collect multimodal data in real time, including change logs from the code repository and defect reports from the defect management system. The dynamic hotspot identification unit is used to calculate the code change density based on the code repository change log using a time decay sliding window algorithm, and to perform adaptive hotspot classification. The defect feature extraction unit is used to build and train the DefectBERT model. It outputs defect feature vectors from the multimodal data after adaptive classification of hot zones using the DefectBERT model, and calculates the correlation between test cases and defects based on the defect feature vectors. The feature fusion unit is used to calculate four-dimensional features and dynamically allocates the weights of each feature through an adaptive weight adjustment mechanism to perform adaptive feature fusion. The four-dimensional features include hotspot coverage, defect correlation, call path weight, and time decay coefficient. Hybrid prediction unit, used to predict defect probability using LSTM-GRU joint network; The test case priority queue generation unit is used to generate a test case priority queue using the simulated annealing algorithm; The PID weight control unit is used to adjust the weight parameters of the four-dimensional features in real time based on the feedback from the test cases.

Citation Information

Patent Citations

  • Spatial change detector and check and set operation

    US20180075109A1

  • Handling metadata corruption to avoid data unavailability

    US20200349072A1

  • Regression test case determination method and device, computer equipment and storage medium

    CN110109820A

  • Test case determination method and device and cloud disk regression test method and device

    CN117493174A