Intelligent software testing method based on automatic script generation

By deploying distributed data acquisition probes and deep learning models in software testing, establishing a behavioral pattern classification system, the entire process of software testing is realized, and the problems of low efficiency and insufficient coverage of existing test methods are solved, which significantly improves the Test efficiency and accuracy.

CN119493729APending Publication Date: 2025-02-21STATE GRID ANHUI ELECTRIC POWER CO LTD ELECTRIC POWER SCI RES INST +1
View PDF 0 Cites 13 Cited by

Patent Information

Application Number
CN202411591567.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

The existing software testing methods have high artificial dependence, low testing efficiency, insufficient coverage, and cannot intelligently perceive software behavior characteristics, resulting in insufficient reliability and integrity of test results.

Method used

By deploying distributed data acquisition probes, dynamically adjusting sampling frequency, collecting software running data, extracting data characteristics based on deep learning models, establishing behavioral pattern classification system, building test scenarios, generating test data, executing test tasks, and monitoring test execution in real time Status, calculate test efficiency indicators, evaluate test results and feedback, and dynamically adjust feature extraction strategies.

Benefits of technology

It realizes the full process automation from software behavior feature collection, test case generation to coverage analysis, greatly improves testing efficiency and accuracy, significantly reduces manual intervention costs, improves the automation level and intelligence of software testing, and improves the Software quality provides strong guarantees.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119493729A_ABST
    Figure CN119493729A_ABST
Patent Text Reader

Abstract

The invention discloses an intelligent software testing method and system based on automatic script generation, and relates to the technical field of software testing, and the method comprises the following steps: deploying a distributed data acquisition probe, dynamically adjusting sampling frequency, collecting software operation data, and extracting data features based on a deep learning model; based on the data features, establishing a behavior pattern classification system, and mapping behavior patterns to realize hierarchical behavior classification; the method comprises the steps of constructing a test scene, generating test data, executing a test task, monitoring a test execution state in real time, calculating a test efficiency index, evaluating and feeding back a test effect, and dynamically adjusting a feature extraction strategy. According to the method, deep learning and reinforcement learning technologies are utilized, accurate recognition and classification of software behavior modes are achieved, and comprehensiveness and effectiveness of testing are guaranteed through multi-dimensional coverage rate analysis and a closed-loop optimization mechanism; and meanwhile, the automation level and the intelligent degree of software testing are remarkably improved, and a powerful guarantee is provided for improving the software quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software testing, and in particular to an intelligent software testing method based on automatic script generation. Background Art

[0002] As the scale and complexity of software systems continue to increase, modern software development faces unprecedented quality assurance challenges. Existing software testing technologies mainly rely on manually written test cases and manual test execution. This traditional method is powerless when faced with complex systems. Especially in new software forms such as large-scale distributed systems, microservice architectures, and cloud-native applications, manual testing is difficult to cover all possible execution paths and abnormal scenarios, resulting in insufficient reliability and integrity of test results. Traditional testing methods also have problems such as low testing efficiency, insufficient coverage, and high maintenance costs, making it difficult to adapt to the rapid iteration development model and continuous delivery requirements.

[0003] At the same time, although the existing automated testing tools have improved the testing efficiency to a certain extent, they generally lack intelligent features, cannot dynamically adjust the testing strategy according to the software running status, and cannot effectively handle the dependencies between test cases, which makes the resource utilization efficiency in the testing process low and it is difficult to ensure the quality of test cases. In terms of software behavior feature recognition, the existing technology lacks the deep understanding and accurate analysis capabilities of the software running mode, and cannot effectively predict and discover potential system defects. In addition, the existing testing methods also have problems such as difficult test data preparation, complex test scenario construction, and time-consuming test result analysis. There is a lack of effective test effect evaluation and optimization mechanism, and it is impossible to achieve continuous improvement of the testing process, which seriously affects the overall effect of software quality assurance. In the context of the increasing popularity of DevOps and agile development, the limitations of traditional testing methods are becoming increasingly prominent. The industry urgently needs a software testing method that can intelligently generate test cases, automatically execute tests, and perform closed-loop optimization to improve the efficiency and quality of software testing and meet the high requirements of modern software development for quality assurance. Summary of the invention

[0004] In view of the problems existing in the existing intelligent software testing method based on automatic script generation, the present invention is proposed.

[0005] Therefore, the problem to be solved by the present invention is the technical problems of high manual dependence, low testing efficiency, insufficient coverage, and inability to intelligently perceive software behavior characteristics in the existing software testing process.

[0006] In order to solve the above technical problems, the present invention provides the following technical solutions: In the first aspect, an embodiment of the present invention provides an intelligent software testing method based on automated script generation, which includes deploying distributed data acquisition probes, dynamically adjusting the sampling frequency, collecting software operation data, and extracting data features based on a deep learning model; based on the data features, establishing a behavior pattern classification system, mapping the behavior patterns to achieve hierarchical behavior classification; constructing test scenarios, generating test data, executing test tasks, monitoring the test execution status in real time, calculating test efficiency indicators, evaluating test results and providing feedback, and dynamically adjusting feature extraction strategies.

[0007] As a preferred solution of the intelligent software testing method based on automatic script generation described in the present invention, the operation data includes function call chain data, data flow information, resource occupancy status, exception handling records and performance indicator data; the sampling frequency is dynamically adjusted as needed, which is expressed as: ; in, is the base sampling frequency, is the code complexity, is the historical error rate, , is the adjustment factor.

[0008] As a preferred solution of the intelligent software testing method based on automatic script generation described in the present invention, wherein: the data features include time series features and spatial features, and the time series features are processed by the LSTM network to convert the collected time series data into a vector sequence , , the calculation of the LSTM unit includes: Input Gate: ; Forget Gate: ; Unit Status: ; Output Gate: ; Hide status updates: ; in, represents the forget gate, represents the input gate, represents the candidate cell state, Indicates the cell state, represents the output gate, Indicates the hidden state, , , , represents the weight matrix, , , , represents the bias term, σ is the Sigmoid activation function, represents the hidden state at the previous time step, Represents the input of the current time step; the spatial feature is extracted based on the CNN network to construct a multi-channel input matrix M, where each channel corresponds to a type of monitoring indicator, and the convolution operation is expressed as: ; Perform maximum pooling dimensionality reduction, expressed as: ; in, Indicates The feature map of the layer, Indicates The convolution kernel weights of the layer, Indicates The output of the layer, Indicates The bias term of the layer, is the output of the pooling layer, Indicates the pooling window size; The LSTM output vector and the CNN output feature map are fused, and the feature weight is calculated through the attention mechanism. The attention score is expressed as: ; The fused feature vector is obtained, expressed as: ; in, represents the attention weight matrix, Indicates the hidden state, is the normalization function, is the feature vector extracted by CNN, represents the bias term, is the fused feature vector.

[0009] As a preferred solution of the intelligent software testing method based on automatic script generation described in the present invention, the software behavior sequence is converted into a feature representation with contextual semantics based on the attention mechanism using bidirectional Transformer encoding, different weights are given to different behavior features, and a more compact behavior representation is generated, which is expressed as: ; in, represents the position in the sequence, represents the dimension index, Represents the dimension of the model; calculates the association strength between behaviors at different positions in the sequence, captures long-distance behavioral dependencies, and uses a multi-head mechanism to understand behavioral patterns from different perspectives, expressed as: ; ; in, is the input feature matrix, is the transformation matrix, is the dimension of the key vector, is the query, key, and value matrix.

[0010] As a preferred solution of the intelligent software testing method based on automatic script generation described in the present invention, wherein: the behavior pattern classification system obtains the category with the highest probability as the classification result by calculating the classification probability, and realizes multi-level behavior classification; the calculation of the classification probability integrates time decay, historical influence, resource status and pattern similarity, realizes adaptive adjustment of each dimension through λ weight, introduces time decay factor, and calculates the classification probability in combination with the cumulative effect of historical behavior. The formula is expressed as follows: ; in, Indicates categories, represents the feature vector, No. The weight vector of each class, Indicates The bias term of each category, represents the total number of categories, represents the time decay factor, Indicates the current time point. represents the weight coefficient, and , represents the historical behavior impact function, Represents the resource status impact function, represents the behavior pattern similarity function; further, the time decay factor It is expressed as: ; in, is the time decay rate, is the time window size; historical behavior affects the function It is expressed as: ; in, Indicates The weight of historical samples, is the time attenuation coefficient, Indicates The timestamps of historical samples, represents the behavior similarity function, expressed as: ; in, Indicates bandwidth parameters; resource status affects function It is expressed as: ; in, Representation Resources The weight coefficient of Representation Resources exist The utilization rate of time, Representation Resources The upper capacity limit of Represents a collection of system resources; behavior pattern similarity function It is expressed as: ; in, Represents a library of historical behavior patterns, is the kernel function, which calculates the similarity between the current behavior and the historical pattern. An indicator of the importance of historical patterns.

[0011] As a preferred solution of the intelligent software testing method based on automatic script generation described in the present invention, wherein: a Markov decision process is introduced to model the test scenario, a multi-dimensional reward function is designed, and the test effect is comprehensively evaluated; based on the constructed test scenario, grammatical rules are defined, including: defining the basic structure, including action sequence and control flow; defining combination rules, including supporting sequence, branching, loop and parallelism; defining constraints, including timing constraints, resource constraints and data constraints; deriving path constraints based on the defined constraints, and automatically traversing all possible program execution paths, for each path, extracting relevant conditional judgments and variable relationships, evaluating the executability of each path, excluding impossible paths, and simplifying the constraint algorithm; if constraints that have no substantial impact on the results are found and marked, constraints with similar properties or duplications are integrated, complex constraints are decomposed into multiple simple constraints or complex constraints are converted into equivalent forms with lower difficulty in solving; test data is automatically generated based on the constraints, test data information and historical execution data are collected, evaluation dimensions and indicator systems are established, initial weight parameters are set, resource consumption and time overhead are considered, and the priority of test cases is determined, which is expressed as: ; in, is the priority of the test case, is the fault detection capability, is the execution cost, It's time urgency. , , is the weight coefficient.

[0012] As a preferred solution of the intelligent software testing method based on automatic script generation described in the present invention, wherein: by collecting basic monitoring indicators, business indicators and safety indicators during the operation process, a health scoring model is established, and the overall health score is calculated, which is expressed as: ; in, is the overall health score of the system, B is the basic performance index value, P is the business index value, S is the security index value, E is the system error count, R is the current average response time, is the response time benchmark value, M is the current memory usage, is the memory usage benchmark value, F is the number of failed tasks, N is the total number of tasks, L is the current system load value, and C is the maximum load capacity of the system. is the security impact factor, V is the number of security vulnerabilities detected; set health thresholds, including the first threshold, the second threshold, the third threshold, and the fourth threshold, and the first threshold> the second threshold> the third threshold> the fourth threshold; if H is greater than or equal to the first threshold, continue with the subsequent test cases, record the current test environment configuration as the benchmark environment, save the test execution performance baseline data, generate a phased test report, and mark it as a stable version; if H is greater than or equal to the second threshold and less than the first threshold, analyze the characteristics of the currently executed test cases, check the test data preparation, evaluate the test environment load status, and generate test execution optimization suggestions; if H is greater than or equal to the third threshold and less than the second threshold, suspend the execution of non-critical test cases, analyze the test script running bottleneck, check the test data quality issues, evaluate the rationality of the test case design, and output the test execution exception report; if H is greater than or equal to the fourth threshold and less than the third threshold, interrupt the current test execution, save the test execution site data, analyze the cause of the test failure, clean up the test environment resources, and re-plan the test strategy; if H is less than the fourth threshold, immediately stop all test activities, collect complete fault information, export the test execution log, start the test emergency plan, and re-evaluate the test plan.

[0013] In the second aspect, an embodiment of the present invention provides an intelligent software testing system based on automated script generation, which includes: a collection module, which is used to deploy distributed data acquisition probes, dynamically adjust the sampling frequency, collect software operation data, and extract data features based on a deep learning model; a classification module, which is used to establish a behavior pattern classification system according to the data features, and map the behavior patterns to achieve hierarchical behavior classification; a testing module, which is used to construct test scenarios, generate test data, execute test tasks, monitor the test execution status in real time, calculate test efficiency indicators, evaluate test results and provide feedback, and dynamically adjust feature extraction strategies.

[0014] In a third aspect, an embodiment of the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the processor executes the computer program, it implements any step of the above-mentioned intelligent software testing method based on automated script generation.

[0015] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, any step of the above-mentioned intelligent software testing method based on automated script generation is implemented.

[0016] The beneficial effect of the present invention is that the present invention realizes the automation of the whole process from software behavior feature collection, test case generation to coverage analysis by constructing an intelligent software testing method, which not only greatly improves the test efficiency and accuracy, but also significantly reduces the cost of manual intervention. By using deep learning and reinforcement learning technology, the accurate identification and classification of software behavior patterns are realized, and the comprehensiveness and effectiveness of the test are guaranteed through multi-dimensional coverage analysis and closed-loop optimization mechanism; at the same time, the automation level and intelligence degree of software testing are significantly improved, providing a strong guarantee for improving software quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them: Figure 1 The flowchart of the intelligent software testing method based on automated script generation. DETAILED DESCRIPTION

[0018] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.

[0019] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0020] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.

[0021] Example 1: Reference Figure 1 , which is the first embodiment of the present invention, provides an intelligent software testing method based on automatic script generation, including: S1: Deploy distributed data collection probes, dynamically adjust the sampling frequency, collect software operation data, and extract data features based on deep learning models.

[0022] Lightweight probes are used to collect multi-dimensional data during the software operation process, and probes are implanted at key execution nodes of the software, including method entries, loop bodies, conditional branches, etc. A layered collection architecture is adopted, including application layer probes, middleware layer probes, and system layer probes.

[0023] Realize dynamic adjustment of sampling frequency on demand, sampling frequency Adaptive adjustment, expressed as: ; in, is the base sampling frequency, is the code complexity, is the historical error rate, , is the adjustment factor.

[0024] The collected data includes function call chain data, data flow information, resource occupancy status, exception handling records, and performance indicator data.

[0025] Function call chain data is used to record function call sequence and call depth, capture function input parameters and return values, and count function execution time.

[0026] Data flow information is used to track data delivery paths, record data status changes, and capture data access patterns.

[0027] Resource usage status is used to monitor CPU usage, record memory allocation, and count I / O operation frequency.

[0028] Exception handling records are used to capture exception types and stacks, record exception occurrence scenarios, and count exception handling results.

[0029] Performance indicator data includes response time, concurrent processing capability, and resource utilization efficiency.

[0030] The collected data is preprocessed and stored to build a behavior feature library.

[0031] Use LSTM network to process the time series features of the data and convert the collected time series data into vector sequences , , the calculation of the LSTM unit includes: Input Gate: ; Forget Gate: ; Unit Status: ; Output Gate: ; Hide status updates: ; in, represents the forget gate, represents the input gate, represents the candidate cell state, Indicates the cell state, represents the output gate, Indicates the hidden state, , , , represents the weight matrix, , , , represents the bias term, σ is the Sigmoid activation function, represents the hidden state at the previous time step, Represents the input at the current time step.

[0032] The CNN network is used to extract spatial features and construct a multi-channel input matrix M. Each channel corresponds to a type of monitoring indicator. The convolution operation is expressed as: ; Perform maximum pooling dimensionality reduction, expressed as: ; in, Indicates The feature map of the layer, Indicates The convolution kernel weights of the layer, Indicates The output of the layer, Indicates The bias term of the layer, is the output of the pooling layer, Indicates the pooling window size.

[0033] The LSTM output vector and the CNN output feature map are fused, and the feature weight is calculated through the attention mechanism. The attention score is expressed as: ; The fused feature vector is obtained, expressed as: ; in, represents the attention weight matrix, Indicates the hidden state, is the normalization function, is the feature vector extracted by CNN, represents the bias term, is the fused feature vector.

[0034] S2: Based on the data features, a behavior pattern classification system is established, and the behavior pattern mapping is performed to achieve hierarchical behavior classification.

[0035] Bidirectional Transformer encoding is used to convert the software behavior sequence into a feature representation with contextual semantics, and the fused feature sequence is input , Indicated in The software behavior feature vector at a certain time point on the sequence length adds position information to each position in the sequence so that the model can understand the order in which the behavior occurs. The encodings at different positions have a fixed relative relationship, which can be expressed as: ; in, represents the position in the sequence, represents the dimension index, Represents the dimensions of the model.

[0036] Calculate the correlation strength between behaviors at different positions in the sequence, capture long-distance behavioral dependencies, and use a multi-head mechanism to understand behavioral patterns from different perspectives, expressed as: ; ; in, is the input feature matrix, is the transformation matrix, is the dimension of the key vector, is the query, key, and value matrix.

[0037] By calculating the most important behavior segments in the attention recognition sequence, different weights are assigned to different behavior features to generate a more compact behavior representation.

[0038] A three-tier classification system is used to map behavioral patterns to achieve hierarchical behavioral classification, including: The first layer divides behaviors into two categories: normal / abnormal. The second layer further subdivides specific behavior patterns. The third layer maps to specific fault types.

[0039] By integrating time decay, historical impact, resource status and pattern similarity, adaptive adjustment of each dimension is achieved through the λ weight, and the time decay factor is introduced to consider the cumulative effect of historical behavior and calculate the classification probability. The formula is expressed as follows: ; in, Indicates categories, represents the feature vector, No. The weight vector of each class, Indicates The bias term of each category, represents the total number of categories, represents the time decay factor, Indicates the current time point. represents the weight coefficient, and , represents the historical behavior impact function, Represents the resource status impact function, represents the behavior pattern similarity function; further, the time decay factor It is expressed as: ; in, is the time decay rate, is the time window size; time decay factor Less weight is given to older behavioral samples.

[0040] Historical behavior impact function It is expressed as: ; in, Indicates The weight of historical samples, is the time attenuation coefficient, Indicates The timestamps of historical samples, represents the behavior similarity function, expressed as: ; in, Indicates bandwidth parameters; resource status affects function It is expressed as: ; in, Representation Resources The weight coefficient of Representation Resources exist The utilization rate of time, Representation Resources The upper capacity limit of Represents a collection of system resources; behavior pattern similarity function It is expressed as: ; in, Represents a library of historical behavior patterns, is the kernel function, which calculates the similarity between the current behavior and the historical pattern. An indicator of the importance of historical patterns.

[0041] The calculation of multi-level behavior pattern probabilities takes into account the timing characteristics of the test scenarios and incorporates system resource status information. The detection accuracy is improved through multi-dimensional feature fusion, so that resource status monitoring helps to detect anomalies early. The adaptive weight adjustment reduces manual intervention and provides more fine-grained behavior analysis.

[0042] Then, the probability prediction of each category is calculated, and the category with the highest probability is selected as the classification result, realizing multi-level behavior classification and providing guidance for subsequent test case generation.

[0043] S3: Build test scenarios based on reinforcement learning, generate test data, execute test tasks, monitor test execution status in real time, calculate test efficiency indicators, evaluate test results and provide feedback, and dynamically adjust feature extraction strategies.

[0044] The Markov decision process (MDP) is introduced to model the test scenario, discrete test operations are converted into continuous state space, a multi-dimensional reward function is designed, and the test effect is comprehensively evaluated, including state space S, action space A, state transition probability P and reward function R.

[0045] The state space S represents the set of all possible states in the test scenario, including system state, environment state, and test state. Each state is a multidimensional vector that describes the complete information of the current scenario.

[0046] The action space A contains all executable test operations. Each action has its preconditions and postconditions, and there are dependencies and mutual exclusions between actions.

[0047] State transition probability It represents the probability of transferring to state s' after executing action a in state s, reflecting the uncertainty of the test operation and the randomness of the environment.

[0048] Reward Function Defines the immediate reward obtained by executing action a in state s.

[0049] The state-action value function is updated through the Q-learning algorithm, expressed as: ; in, Indicates in status Execute an action The expected cumulative reward of is the learning rate, which controls the step size of the update, is the immediate reward obtained after performing the action. is the discount factor, balancing immediate rewards and long-term benefits, is the maximum Q value of the next state.

[0050] Based on the constructed test scenarios, define grammar rules, including: Define the basic structure including action sequence and control flow, define combination rules including support for sequence, branching, loop and parallelism, and define constraints including timing constraints, resource constraints and data constraints.

[0051] Based on the defined constraints, path constraints are derived and all possible program execution paths are automatically traversed. For each path, relevant conditional judgments and variable relationships are extracted, the executable nature of each path is evaluated, impossible paths are excluded, and the constraint algorithm is simplified.

[0052] If constraints that have no substantial impact on the results are found and marked, constraints with similar properties or duplication will be integrated, complex constraints will be decomposed into multiple simple constraints, or complex constraints will be converted into equivalent forms that are less difficult to solve.

[0053] Automatically generate test data based on constraints, collect test data information and historical execution data, establish evaluation dimensions and indicator systems, set initial weight parameters, consider resource consumption and time overhead, and determine the priority of test cases, expressed as: ; in, is the priority of the test case, is the fault detection capability, is the execution cost, It's time urgency. , , is the weight coefficient.

[0054] Furthermore, fault detection capability By evaluating the code paths covered by the test cases, considering the number of defects found in the case history, evaluating the relevance of the test cases to the code changes, and considering the complexity of the test paths, a preliminary understanding is obtained.

[0055] Execution costs The evaluation dimensions include estimating the time required for test execution, evaluating the required computing and storage resources, and the complexity of test environment preparation.

[0056] Time urgency The determining factors include the priority with business requirements, the degree of blocking to other testing tasks and the possible impact of test failure.

[0057] The weight coefficient determines the initial weight based on historical execution data, dynamically adjusts the weight according to the execution effect, and sets different weights for different test scenarios.

[0058] Generate the test case execution order according to the test priority, formulate the test execution plan, and allocate test resources. Consider the dependencies between test cases to ensure balanced use of resources corresponding to the test case priorities. Consider resource capacity constraints, merge similar test tasks, and adjust the optimal parallelism.

[0059] By collecting basic monitoring indicators, business indicators and security indicators during operation, a health scoring model is established. Specifically, basic monitoring indicators include system response time, resource utilization and system stability parameters; business indicators include functional integrity indicators, performance compliance rate and user experience metrics; security indicators include access control effectiveness and data security assurance. After weighted calculation of each indicator, the overall health score is obtained.

[0060] Specifically expressed as: ; in, is the overall health score of the system, B is the basic performance index value, P is the business index value, S is the security index value, E is the system error count, R is the current average response time, is the response time benchmark value, M is the current memory usage, is the memory usage benchmark value, F is the number of failed tasks, N is the total number of tasks, L is the current system load value, and C is the maximum load capacity of the system. is the security impact factor, and V is the number of security vulnerabilities detected.

[0061] Set health thresholds, including a first threshold, a second threshold, a third threshold, and a fourth threshold, and the first threshold>the second threshold>the third threshold>the fourth threshold.

[0062] If H is greater than or equal to the first threshold, the test execution status is good, and subsequent test cases can be continued. The current test environment configuration is recorded as the benchmark environment, the test execution performance baseline data is saved, a phased test report is generated, and it is marked as a stable version.

[0063] If H is greater than or equal to the second threshold and less than the first threshold, there is a slight fluctuation in test execution and attention should be paid to analyzing the characteristics of the currently executed test cases, checking the test data preparation, evaluating the test environment load status, and generating test execution optimization suggestions.

[0064] If H is greater than or equal to the third threshold and less than the second threshold, the test execution efficiency decreases and intervention is required to suspend the execution of non-critical test cases, analyze the test script running bottleneck, check the test data quality issues, evaluate the rationality of the test case design, and output a test execution exception report.

[0065] If H is greater than or equal to the fourth threshold and less than the third threshold, a serious exception occurs in the test execution, the current test execution is interrupted, the test execution site data is saved, the cause of the test failure is analyzed, the test environment resources are cleaned up, and the test strategy is replanned.

[0066] If H is less than the fourth threshold, a crash-level failure occurs during the test execution. All test activities are stopped immediately, complete failure information is collected, the test execution log is exported, the test emergency plan is initiated, and the test plan is re-evaluated.

[0067] In summary, the present invention realizes the automation of the entire process from software behavior feature collection, test case generation to coverage analysis by constructing an intelligent software testing method, which not only greatly improves the test efficiency and accuracy, but also significantly reduces the cost of manual intervention. By using deep learning and reinforcement learning techniques, accurate identification and classification of software behavior patterns are achieved, and high-quality test cases can be intelligently generated; through multi-dimensional coverage analysis and closed-loop optimization mechanisms, the comprehensiveness and effectiveness of the test are guaranteed; at the same time, the test execution control strategy based on real-time health assessment ensures the reliability and stability of the test process. It significantly improves the automation level and intelligence of software testing, providing a strong guarantee for improving software quality.

[0068] This embodiment further provides an intelligent software testing system based on automated script generation, including: The collection module is used to deploy distributed data collection probes, dynamically adjust the sampling frequency, collect software operation data, and extract data features based on deep learning models; A classification module, used to establish a behavior pattern classification system according to the data characteristics, and map the behavior patterns to achieve hierarchical behavior classification; The test module is used to build test scenarios, generate test data, execute test tasks, monitor the test execution status in real time, calculate test efficiency indicators, evaluate test results and provide feedback, and dynamically adjust feature extraction strategies.

[0069] This embodiment also provides a computer device, which is suitable for the case of an intelligent software testing method based on automated script generation, including a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the intelligent software testing method based on automated script generation proposed in the above embodiment.

[0070] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.

[0071] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the intelligent software testing method based on automated script generation proposed in the above embodiment is implemented.

[0072] The storage medium proposed in this embodiment and the data storage method proposed in the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be found in the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0073] Embodiment 2: Based on the first embodiment, this embodiment provides an intelligent software testing method based on automatic script generation. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through simulation experiments.

[0074] In order to verify the effectiveness of the present invention, the core transaction system of a large e-commerce platform was selected as a test object for experiments.

[0075] The system is developed in Java and adopts a microservice architecture. It includes core functional modules such as order management, payment processing, inventory control, and user management, with a total code size of approximately 500,000 lines.

[0076] The experiment was conducted in a standard test environment. The test server was configured with an Intel Xeon E5-2680 v4 processor (4 cores and 8 threads), 16GB DDR4 memory, 1TB SSD storage, and the operating system was CentOS 7.9.

[0077] The test cycle lasted 30 days, during which the system load and network environment were kept stable, simulating a real business scenario with an average of 100,000 orders per day.

[0078] At the same time, a distributed monitoring system was deployed to collect system operation data in real time, including core performance indicators such as CPU usage, memory usage, response time, and TPS. To ensure the objectivity and comparability of the test results, the three test methods were compared in the same environment configuration and business scenario.

[0079] The experimental results are shown in Table 1: Table 1 Comparative test results It can be seen from the comparison results in Table 1 that the intelligent testing method of the present invention has shown significant advantages in all key indicators. The test case generation efficiency has increased from 5 per hour in the traditional method to 85 per hour, which is 325% higher than that of ordinary automated testing; in terms of test coverage, the code coverage rate and scenario coverage rate reached 92% and 88% respectively, which is more than 20 percentage points higher than that of traditional methods; especially in terms of test quality, while the defect detection rate increased to 89%, the false alarm rate was significantly reduced to 4%, which shows that the present invention not only improves the test efficiency, but also ensures the accuracy of the test results.

[0080] In terms of resource utilization, the test execution time was reduced from 180 hours to 28 hours, the manual intervention time was reduced from 160 hours to 20 hours, and the test cost was reduced from 45 man-days to 8 man-days, reflecting significant economic benefits. It is particularly noteworthy that in repeated testing scenarios, the efficiency of the method of the present invention is improved by 380%, far exceeding the 150% of ordinary automated testing, which fully demonstrates the outstanding advantages of this method in continuous integration and continuous testing scenarios. These data fully demonstrate that the intelligent software testing method based on automated script generation proposed in the present invention can effectively solve the problems of low efficiency and insufficient coverage in the prior art, and provide strong support for improving the level of intelligence in software testing.

[0081] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. An intelligent software testing method based on automated script generation, characterized in that: include, Deploy distributed data collection probes, dynamically adjust sampling frequency, collect software operation data, and extract data features based on deep learning models; Based on the data features, a behavior pattern classification system is established to map the behavior patterns to achieve hierarchical behavior classification; Build test scenarios, generate test data, execute test tasks, monitor test execution status in real time, calculate test efficiency indicators, evaluate test results and provide feedback, and dynamically adjust feature extraction strategies.

2. The intelligent software testing method based on automated script generation according to claim 1, characterized in that: The operation data includes function call chain data, data flow information, resource occupancy status, exception handling records and performance indicator data; The sampling frequency is dynamically adjusted as needed, which is expressed as: ; in, is the base sampling frequency, is the code complexity, is the historical error rate, , is the adjustment factor.

3. The intelligent software testing method based on automated script generation according to claim 2, characterized in that: The data features include temporal features and spatial features. The time series feature is processed by the LSTM network to convert the collected time series data into a vector sequence. , , the calculation of the LSTM unit includes: Input Gate: ; Forget Gate: ; Unit Status: ; Output Gate: ; Hide status updates: ; in, represents the forget gate, represents the input gate, represents the candidate cell state, Indicates the cell state, represents the output gate, Indicates the hidden state, , , , represents the weight matrix, , , , represents the bias term, σ is the Sigmoid activation function, represents the hidden state at the previous time step, Represents the input of the current time step; The spatial feature is extracted based on the CNN network, and a multi-channel input matrix M is constructed. Each channel corresponds to a type of monitoring indicator, and the convolution operation is expressed as: ; Perform maximum pooling dimensionality reduction, expressed as: ; in, Indicates The feature map of the layer, Indicates The convolution kernel weights of the layer, Indicates The output of the layer, Indicates The bias term of the layer, is the output of the pooling layer, Indicates the pooling window size; The LSTM output vector and the CNN output feature map are fused, and the feature weight is calculated through the attention mechanism. The attention score is expressed as: ; The fused feature vector is obtained, expressed as: ; in, represents the attention weight matrix, Indicates the hidden state, is the normalization function, is the feature vector extracted by CNN, represents the bias term, is the fused feature vector.

4. The intelligent software testing method based on automated script generation according to claim 3, characterized in that: Based on the attention mechanism, bidirectional Transformer encoding is used to convert the software behavior sequence into a feature representation with contextual semantics, and different weights are assigned to different behavior features to generate a more compact behavior representation, which is expressed as: ; in, represents the position in the sequence, represents the dimension index, Represents the dimensions of the model; Calculate the correlation strength between behaviors at different positions in the sequence, capture long-distance behavioral dependencies, and use a multi-head mechanism to understand behavioral patterns from different perspectives, expressed as: ; ; in, is the input feature matrix, is the transformation matrix, is the dimension of the key vector, is the query, key, and value matrix.

5. The intelligent software testing method based on automated script generation according to claim 4, characterized in that: The behavior pattern classification system calculates the classification probability and obtains the category with the highest probability as the classification result, thereby realizing multi-level behavior classification; The calculation of the classification probability integrates time decay, historical impact, resource status and pattern similarity, realizes adaptive adjustment of each dimension through λ weight, introduces time decay factor, and calculates the classification probability in combination with the cumulative effect of historical behavior. The formula is expressed as follows: ; in, Indicates categories, represents the feature vector, No. The weight vector of each class, Indicates The bias term of each category, represents the total number of categories, represents the time decay factor, Indicates the current time point. represents the weight coefficient, and , represents the historical behavior impact function, Represents the resource status impact function, represents the behavior pattern similarity function; Furthermore, the time decay factor It is expressed as: ; in, is the time decay rate, is the time window size; Historical behavior impact function It is expressed as: ; in, Indicates The weight of historical samples, is the time attenuation coefficient, Indicates The timestamps of historical samples, represents the behavior similarity function, expressed as: ; in, represents bandwidth parameter; Resource status impact function It is expressed as: ; in, Representation Resources The weight coefficient of Representation Resources exist The utilization rate of time, Representation Resources The upper capacity limit of Represents a collection of system resources; Behavior pattern similarity function It is expressed as: ; in, Represents a library of historical behavior patterns, is the kernel function, which calculates the similarity between the current behavior and the historical pattern. An indicator of the importance of historical patterns.

6. The intelligent software testing method based on automated script generation according to claim 5, characterized in that: Introduce Markov decision process modeling test scenarios, design multi-dimensional reward functions, and comprehensively evaluate test results; Based on the constructed test scenarios, define grammar rules, including: Define the basic structure, including action sequences and control flow; Define combination rules, including support for sequencing, branching, looping, and parallelism; Define constraints, including timing constraints, resource constraints, and data constraints; Derive path constraints based on defined constraints and automatically traverse all possible program execution paths. For each path, extract relevant conditional judgments and variable relationships, evaluate the executability of each path, exclude impossible paths, and simplify constraint algorithms. If constraints that have no substantial impact on the results are found and marked, constraints with similar properties or duplications are integrated, complex constraints are decomposed into multiple simple constraints, or complex constraints are converted into equivalent forms that are less difficult to solve; Automatically generate test data based on constraints, collect test data information and historical execution data, establish evaluation dimensions and indicator systems, set initial weight parameters, consider resource consumption and time overhead, and determine the priority of test cases, expressed as: ; in, is the priority of the test case, is the fault detection capability, is the execution cost, It's time urgency. , , is the weight coefficient.

7. The intelligent software testing method based on automated script generation according to claim 6, characterized in that: By collecting basic monitoring indicators, business indicators and security indicators during operation, a health scoring model is established to calculate the overall health score, which is expressed as: ; in, is the overall health score of the system, B is the basic performance index value, P is the business index value, S is the security index value, E is the system error count, R is the current average response time, is the response time benchmark value, M is the current memory usage, is the memory usage benchmark value, F is the number of failed tasks, N is the total number of tasks, L is the current system load value, and C is the maximum load capacity of the system. is the security impact factor, V is the number of security vulnerabilities detected; Setting health thresholds, including a first threshold, a second threshold, a third threshold, and a fourth threshold, wherein the first threshold>the second threshold>the third threshold>the fourth threshold; If H is greater than or equal to the first threshold, continue with the subsequent test cases, record the current test environment configuration as the benchmark environment, save the test execution performance baseline data, generate a phased test report, and mark it as a stable version; If H is greater than or equal to the second threshold and less than the first threshold, then analyze the characteristics of the currently executed test case, check the test data preparation, evaluate the test environment load status, and generate test execution optimization suggestions; If H is greater than or equal to the third threshold and less than the second threshold, the execution of non-critical test cases is suspended, the test script running bottleneck is analyzed, the test data quality problem is checked, the rationality of the test case design is evaluated, and a test execution exception report is output; If H is greater than or equal to the fourth threshold and less than the third threshold, the current test execution is interrupted, the test execution site data is saved, the cause of the test failure is analyzed, the test environment resources are cleaned up, and the test strategy is replanned; If H is less than the fourth threshold, all test activities are stopped immediately, complete fault information is collected, the test execution log is exported, the test emergency plan is initiated, and the test plan is re-evaluated.

8. An intelligent software testing system based on automated script generation, based on the intelligent software testing method based on automated script generation according to any one of claims 1 to 7, characterized in that: include, The collection module is used to deploy distributed data collection probes, dynamically adjust the sampling frequency, collect software operation data, and extract data features based on deep learning models; A classification module, used to establish a behavior pattern classification system according to the data characteristics, and map the behavior patterns to achieve hierarchical behavior classification; The test module is used to build test scenarios, generate test data, execute test tasks, monitor the test execution status in real time, calculate test efficiency indicators, evaluate test results and provide feedback, and dynamically adjust feature extraction strategies.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the intelligent software testing method based on automated script generation described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the intelligent software testing method based on automated script generation described in any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Embedded software timing anomaly detection method based on value function reinforcement learning

    CN119759797A

  • Script-based multi-system wireless communication system function test method

    CN119946694A

  • Automatic software testing supervision system and method based on artificial intelligence

    CN120196552A

  • Automatic testing method and system for credential equipment

    CN120218056A

  • A method and system for automatic testing of information technology equipment

    CN120218056B