Intelligent software test data generation method and system based on Internet public information
By using multi-objective regional Bayesian optimization technology, time enhancement and variational Bayesian method, natural language processing technology and reinforcement learning algorithm in software test data generation, the low efficiency and authenticity of test data generation in the existing technology are solved. The problems of insufficient and poor adaptability have achieved high-quality, diversity and adaptability testing data generation.
Patent Information
- Application Number
- CN202411549359.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-11-01
AI Technical Summary
In the prior art, software test data generation efficiency is low, insufficient authenticity and poor adaptability, making it difficult to fully cover complex testing scenarios and rapidly changing software needs.
Using intelligent software test data generation method based on public information on the Internet, the Bayesian optimization technology, time enhancement and variational Bayesian method, natural language processing technology and reinforcement learning algorithm are used to generate high-quality and authenticity. Diversity of test data and dynamically adjust the generation strategy to adapt to changes in software requirements.
It improves the authenticity and diversity of test data, can better simulate practical application scenarios, improves the quality and efficiency of test data generation, and adapts to changes in software requirements and complex business logic.
Smart Images

Figure CN119473888A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software testing, and in particular to a method and system for generating intelligent software testing data based on Internet public information. Background Art
[0002] Software testing is a key link in ensuring software quality, and high-quality test data is essential for effective software testing. Traditional software test data generation methods mainly rely on manual design and random generation, which often have problems such as low efficiency and insufficient coverage.
[0003] At present, some automated test data generation technologies have been developed, such as model-based test data generation and constraint-based test data generation. These methods have improved the efficiency and quality of test data generation to a certain extent. For example, the model-based method generates test data by building a formal model of the software system, while the constraint-based method generates test data that meets the requirements by parsing the constraints in the software specification.
[0004] However, existing automated test data generation technologies still have some limitations. First, these methods usually require a lot of manual intervention, such as building precise models or defining detailed constraints, which increases the workload of testers. Second, the generated test data often lacks authenticity and diversity, making it difficult to fully cover various complex test scenarios. Finally, existing methods are difficult to adapt to the rapid changes in software requirements and complex business logic, resulting in the possibility that the generated test data deviates from actual requirements.
[0005] Therefore, how to automatically generate high-quality, authentic, and wide-coverage software testing data while being able to adapt to changes in software requirements and complex business logic is an urgent problem to be solved in the current software testing field. Summary of the invention
[0006] In view of this, the present application provides a method and system for generating intelligent software test data based on public information on the Internet, which solves the problems of low efficiency, insufficient authenticity and poor adaptability of test data generation in the prior art.
[0007] The embodiment of the present application provides a method for generating intelligent software test data based on Internet public information, including: based on software requirements and test scenarios, collecting relevant data from Internet public information and preprocessing it; using multi-objective regional Bayesian optimization technology to enhance the preprocessed data; using time enhancement and variational Bayesian methods to process the time series data in the preprocessed data to generate enhanced time series data; reading software development documents, using natural language processing technology to extract key information, and semantically understanding and expanding the extracted key information based on a hierarchical classification Gaussian extension semantic model; according to the results of semantic understanding and expansion, improving and adjusting the enhanced data and the enhanced time series data to generate preliminary test data that conforms to business logic; applying the generated preliminary test data to the software testing process, collecting test results and performance indicators; based on the test results, using a reinforcement learning algorithm to dynamically adjust the test data generation strategy; repeating the above steps, continuously optimizing the test data generation process, and forming a closed-loop intelligent testing process.
[0008] The multi-objective regional Bayesian optimization technology is used to enhance the preprocessed data, including: defining a set of optimization objective functions, modeling each objective function using a Gaussian process, selecting the next evaluation point by maximizing the expected improvement, and iterating the optimization in the predefined search space until a Pareto optimal solution that meets the conditions is found.
[0009] Time enhancement and variational Bayesian methods are used to process time series data, including: time warping and time interpolation processing of the original time series data, building a variational autoencoder model, learning the latent variables of VAE by minimizing the reconstruction error and KL divergence, and using the learned VAE model to generate new time series data.
[0010] Read software development documents and use natural language processing technology to extract key information, including: using lexical analysis and syntactic analysis techniques to pre-process documents, using named entity recognition technology to identify key entities and attributes, using dependency syntactic analysis technology to extract relationships and constraints between entities, applying topic modeling technology to identify major topics and business rules, and using word vector technology to calculate the semantic similarity between words.
[0011] The extracted information is semantically understood and expanded based on the hierarchical classification Gaussian extension semantic model, including: constructing a hierarchy of semantic concepts, calculating the Mahalanobis distance between the input semantics and each concept node, determining the concept category to which the input semantics belongs, generating new semantics related to the input semantics, and expanding the original semantic space.
[0012] According to the results of semantic understanding and expansion, the enhanced data and enhanced time series data are improved and adjusted, including: performing consistency checks, adjusting outliers and boundary values, supplementing missing key attributes and relationships, generating diverse test data combinations, and verifying the generated test data.
[0013] Based on the test results, the reinforcement learning algorithm is used to dynamically adjust the test data generation strategy, including: modeling the test data generation process as a Markov decision process, defining state, action and reward functions, using a deep Q network to learn the optimal data generation strategy, and using experience replay and target network technology to optimize the learning process.
[0014] The embodiment of the present application also provides an intelligent software test data generation system based on Internet public information, including a data acquisition and preprocessing module, a data enhancement module, a semantic understanding module, a data improvement module, a test execution module and a dynamic adjustment module. The system may also include a data storage module, a model training module and a user interface module.
[0015] An embodiment of the present application also provides a computer device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned intelligent software test data generation method based on Internet public information.
[0016] An embodiment of the present application also provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute the above-mentioned intelligent software test data generation method based on Internet public information.
[0017] An embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the above-mentioned method for generating intelligent software test data based on Internet public information.
[0018] This application has the following technical effects: by collecting data from public information on the Internet and performing intelligent processing, the authenticity and diversity of test data are improved, and the actual application scenarios can be better simulated. A variety of advanced machine learning and natural language processing technologies are adopted, such as multi-objective regional Bayesian optimization, variational Bayesian method, and hierarchical classification Gaussian extended semantic model, which greatly improves the quality and efficiency of test data generation. By introducing reinforcement learning algorithms to dynamically adjust the test data generation strategy, the continuous optimization and adaptation of the test process are achieved, which can better cope with changes in software requirements and complex business logic. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 is a flow chart of a method for generating intelligent software test data based on Internet public information provided by an embodiment of the present invention;
[0021] Figure 2 It is a structural block diagram of an intelligent software test data generation system based on Internet public information provided by an embodiment of the present invention;
[0022] Figure 3 is a schematic diagram of a multi-objective regional Bayesian optimization technique in an embodiment of the present invention;
[0023] Figure 4 is a flow chart of processing time series data using the time enhancement and variational Bayes method in an embodiment of the present invention;
[0024] Figure 5 is a schematic diagram of the structure of a hierarchical classification Gaussian extended semantic model in an embodiment of the present invention;
[0025] Figure 6 It is a flow chart of the reinforcement learning algorithm dynamically adjusting the test data generation strategy in an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The embodiments of the present application are described below in conjunction with the drawings in the present application. It should be understood that the implementation methods described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0027] It will be understood by those skilled in the art that, unless specifically stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application refer to that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude the implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the technical field. It should be understood that when an embodiment of the present invention refers to an element being "connected" or "coupled" to another element, the one element may be directly connected or coupled to the other element, or may refer to the one element and the other element establishing a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term, for example, "A and / or B" may be implemented as "A", or as "B", or as "A and B".
[0028] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0029] The core of the present invention is to provide a method and system for generating intelligent software test data based on Internet public information. The present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0030] It should be understood that the terms "including" and "having" and any variations thereof used herein are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.
[0031] Example 1
[0032] like Figure 1 As shown, the method for generating intelligent software test data based on Internet public information provided by an embodiment of the present invention includes the following steps:
[0033] S1: Data collection and preprocessing
[0034] S1.1: Based on software requirements and test scenarios, collect relevant data from public information on the Internet
[0035] The purpose of this step is to obtain real data related to the software to be tested in order to improve the authenticity and diversity of the generated test data. The specific implementation can include the following aspects:
[0036] Requirements analysis: Analyze the software requirements document and extract keywords and themes.
[0037] Web crawler: Based on the extracted keywords and topics, develop a targeted web crawler to collect data from relevant websites, forums, social media and other channels.
[0038] API call: Use public data API interfaces, such as government open data platforms, meteorological data interfaces, etc., to obtain structured data in related fields.
[0039] Data filtering: Based on the requirements of the test scenario, the collected data is initially screened and filtered to remove obviously irrelevant or low-quality data.
[0040] S1.2: Preprocess the collected data
[0041] Data preprocessing is to prepare for subsequent processing steps, mainly including the following operations:
[0042] Data cleaning: remove duplicate data, process missing values, correct outliers, etc.
[0043] Data conversion: unify data formats, such as date formatting, value normalization, etc.
[0044] Data integration: Integrate data from different sources to create a unified data structure.
[0045] Feature extraction: Extract useful features from raw data according to the requirements of software testing.
[0046] Data classification: Classify data according to different test scenarios or functional modules to facilitate subsequent targeted processing.
[0047] S2: Data Augmentation
[0048] S2.1: Enhance the preprocessed data using multi-objective regional Bayesian optimization techniques
[0049] like Figure 3 As shown in the figure, Multi-Objective Regional Bayesian Optimization (MORBO) is an efficient multi-objective optimization method, which is particularly suitable for scenarios such as test data generation that require balancing multiple objectives. The specific implementation steps are as follows:
[0050] 1. Define the optimization objective function set {f1(x), f2(x), ..., f k (x)}, where x represents the set of parameters for data augmentation and k is the number of optimization objectives. These objective functions can include:
[0051] Data diversity: measures the degree of variation in the generated data
[0052] Boundary value coverage: evaluates the coverage of boundary conditions by generated data
[0053] Business rule compliance: measures the degree to which the generated data conforms to the business rules
[0054] Test coverage: evaluates the extent to which the generated data covers the software functionality
[0055] 2. Use Gaussian process to model each objective function. Gaussian process can capture the uncertainty of the function and help balance exploration and exploitation during the optimization process.
[0056] 3. Select the next evaluation point by maximizing the expected improvement. The expected improvement takes into account the uncertainty of the current optimal solution and the prediction, and can effectively guide the search process.
[0057] 4. Iterate optimization within the predefined search space until a Pareto optimal solution that satisfies the conditions is found. A Pareto optimal solution is a solution that cannot improve other objectives without compromising any one objective.
[0058] Through the MORBO technology, the embodiment of the present invention can generate high-quality test data that meets multiple optimization goals, which not only ensures the diversity of data, but also ensures good coverage of software functions and business rules.
[0059] S2.2: Using time augmentation and variational Bayesian methods to process time series data
[0060] For test data containing time information, the embodiment of the present invention adopts time enhancement and variational Bayes method (such as Figure 4 ) to generate more realistic and diverse time series data.
[0061] The specific steps are as follows:
[0062] 1. Perform time stretching and time interpolation on the original time series data:
[0063] Time warping: Adjust the local speed of the time series through nonlinear transformation to simulate the time warping in real scenes.
[0064] Time interpolation: insert new data points between original time points to increase the density and continuity of time series data.
[0065] 2. Construct a variational autoencoder (VAE) model, in which both the encoder and decoder use a recurrent neural network (RNN) structure:
[0066] Encoder: Maps the input time series data into a latent space, capturing high-level features of the data.
[0067] Decoder: reconstructs time series data from the latent space and generates new data samples.
[0068] The RNN structure can effectively capture the long-term dependencies of time series data.
[0069] 3. Learn the hidden variable z of VAE by minimizing the reconstruction error and KL divergence:
[0070] Reconstruction error: Ensure that the generated data has a similar distribution as the original data.
[0071] KL divergence: It makes the distribution of the latent space close to the standard normal distribution, which is convenient for subsequent sampling and generation.
[0072] 4. Use the learned VAE model to generate new time series data while maintaining the temporal characteristics of the data:
[0073] Sample latent variables from a standard normal distribution. Input the sampled latent variables into the decoder to generate new time series data. Post-process the generated data to ensure that the temporal characteristics (such as periodicity and trend) are maintained.
[0074] Through this method, the embodiment of the present invention can generate new time series data that has similar statistical characteristics to the original data but is not completely the same, thereby greatly enriching the time dimension of the test data set.
[0075] By way of example, this process is described using an order system of an e-commerce platform.
[0076] First, the embodiment of the present invention collects a batch of initial order data from public information on the Internet. These data include basic information such as order amount, product category, and order time. However, these original data may have problems such as uneven distribution and insufficient coverage of boundary cases. For example, the embodiment of the present invention may lack order data for large orders or specific holidays.
[0077] To solve this problem, the embodiment of the present invention first applies the multi-objective regional Bayesian optimization technology. The embodiment of the present invention defines multiple optimization goals, such as increasing the proportion of large orders, improving the coverage of holiday orders, and maintaining the diversity of commodity categories. The system will generate new order data through iterative optimization based on these goals. For example, it may generate some orders close to the maximum order amount limit of the platform, or high-frequency purchase behaviors during important holidays.
[0078] Next, the embodiments of the present invention focus on the processing of time series data. The data of the order system has obvious time characteristics, such as periodic fluctuations (increase in order volume on weekends) and seasonal trends (peak sales during holidays). The embodiments of the present invention use time enhancement and variational Bayesian methods to process these time series characteristics. Specifically, the embodiments of the present invention may stretch or compress the original time series to simulate the order distribution under different time scales. For example, the embodiments of the present invention can generate data that simulates intensive orders during long holidays, or simulates sparse orders during late night hours.
[0079] In this way, the embodiment of the present invention not only increases the amount of test data, but more importantly, improves the quality and coverage of the data. The enhanced data set contains more edge cases and abnormal scenarios, such as orders with extremely large amounts, frequently canceled orders, and international orders across multiple time zones. These data can help the embodiment of the present invention to more comprehensively test the functions and performance of the order system.
[0080] It should be noted that, in the entire enhancement process, the embodiment of the present invention always maintains respect for the original data distribution. Although the newly generated data expands the original distribution range, it still maintains reasonable statistical characteristics to ensure the authenticity and effectiveness of the test.
[0081] Through such a data enhancement process, the embodiment of the present invention finally obtains a richer and more diverse test data set. This data set not only includes conventional order situations, but also covers various extreme situations and boundary conditions, laying a solid foundation for subsequent comprehensive testing. This method greatly improves the possibility of discovering potential bugs and system defects in the embodiment of the present invention, thereby helping the embodiment of the present invention to build a more robust and reliable order system.
[0082] S3: Semantic Understanding and Extension
[0083] S3.1: Read software development documents and extract key information using natural language processing techniques
[0084] This step aims to extract key information from software development documents that helps generate high-quality test data. The specific implementation includes the following aspects:
[0085] 1. Use lexical analysis and syntactic analysis techniques to preprocess software development documents:
[0086] Lexical analysis: Segment the text into words or tokens, identify parts of speech and word forms. Syntactic analysis: Analyze the grammatical structure of the sentence and build a syntax tree.
[0087] 2. Use named entity recognition technology to identify key entities and attributes in the document:
[0088] Identify entities in a specific field, such as users, products, functional modules, etc. Extract attribute information of entities, such as data type, value range, etc.
[0089] 3. Use dependency parsing techniques to extract relationships and constraints between entities:
[0090] Analyze the dependencies between entities, such as subject-predicate relationships, modifier relationships, etc. Extract constraints in business logic, such as "user age must be greater than 18 years old."
[0091] 4. Apply topic modeling techniques to identify the main topics and business rules in the documents:
[0092] Extract the topics of documents using algorithms such as LDA (Latent Dirichlet Allocation). Identify important business rules and functional descriptions based on topic distribution.
[0093] 5. Use word vector technology to calculate the semantic similarity between words to assist semantic understanding and expansion:
[0094] Train or use pre-trained word vector models (such as Word2Vec, GloVe). Calculate the cosine similarity between keywords to discover potential semantic associations.
[0095] Through these NLP technologies, the embodiments of the present invention can extract rich semantic information from software development documents to provide guidance and constraints for subsequent test data generation.
[0096] S3.2: Semantic understanding and expansion of extracted key information based on hierarchical classification Gaussian extended semantic model
[0097] like Figure 5 As shown in Figure 1, the Hierarchical Classified Gaussian Expansion Semantic Model (HCGESM) is a new semantic understanding and expansion model that can effectively capture the hierarchical relationship and semantic similarity between concepts. The specific implementation steps are as follows:
[0098] 1. Construct a hierarchy of semantic concepts, and use Gaussian distribution N(μ i ,Σ i )express:
[0099] Based on domain knowledge and document content, a concept tree is constructed. A multidimensional Gaussian distribution is assigned to each concept node, where the mean μ i Represents the central position of the concept, the covariance matrix Σ i Indicates the uncertainty and coverage of a concept.
[0100] 2. For a given input semantic x, calculate its Mahalanobis distance with each concept node.
[0101] The Mahalanobis distance takes into account the uncertainty of concepts and is more suitable for measuring semantic space than the Euclidean distance.
[0102] 3. Based on the calculated Mahalanobis distance, determine the concept category to which the input semantics x belongs:
[0103] Either nearest neighbor classification or soft classification methods can be used.
[0104] Consider the hierarchical relationship of concepts and allow multi-level concept attribution.
[0105] 4. Using the determined concept categories, based on the hierarchical relationship and similarity between concepts, generate new semantics related to the input semantics:
[0106] Sampling from the Gaussian distribution of the concept generates similar but not identical semantic vectors.
[0107] Consider parent-child concepts and sibling concepts, and generate related but different semantics.
[0108] 5. Use the generated new semantics to expand the original semantic space and increase the diversity and coverage of test data:
[0109] The generated new semantic vector is mapped back to the original feature space.
[0110] Generate test data samples that conform to specific concepts or rules based on new semantics.
[0111] Through HCGESM, the embodiments of the present invention can achieve in-depth understanding and intelligent expansion of the extracted key information, generate richer and more diverse test data, and maintain consistency with the original business semantics.
[0112] Take a smart home control system as an example:
[0113] In a smart home system, users may use a variety of different language expressions to control home devices. For example, commands such as "turn on the lights in the living room", "turn on the lights", and "light up the living room" actually express the same intention. The goal of the embodiments of the present invention is to understand these different expressions and expand them to more possible semantic variants in order to more comprehensively test the voice recognition and command processing functions of the system.
[0114] First, the embodiment of the present invention constructs a hierarchy of semantic concepts. In this structure, "device control" may be the top-level concept, which includes sub-concepts such as "lighting control", "temperature control", and "security control". "Lighting control" is further subdivided into "turn on the light", "turn off the light", "adjust the brightness", etc. Each concept node is represented by a Gaussian distribution, where the mean represents the central position of the concept and the covariance matrix represents the uncertainty and coverage of the concept.
[0115] Assume that the embodiment of the present invention extracts the key information "turn on the lights in the living room" from the software development document. The system first calculates the Mahalanobis distance between this input and each concept node. In this example, it may be closest to "lighting control" and "turn on the lights".
[0116] Based on this calculation result, the system determines that the input semantics belongs to the concept category of "turn on the light". Then, it uses the Gaussian distribution of this concept to generate related new semantics. For example, it may generate variants such as "turn on the living room lighting", "light up the living room", and "activate the ceiling light in the living room".
[0117] In addition, the system also considers the hierarchical relationship and similarity between concepts. For example, the parent concept of "turn on the light" is "lighting control", and the sibling concepts include "turn off the light" and "adjust brightness". Based on these relationships, the system may further expand and generate related but slightly different semantics such as "adjust the living room lights to the brightest" and "turn off the living room lights".
[0118] In this way, the embodiment of the present invention not only understands the original instruction "turn on the lights in the living room", but also expands a series of related semantic variants. These variants include synonymous expressions, similar instructions, and may even include some opposing instructions (such as "turn off the lights"), which helps to test the robustness of the system.
[0119] It is important to note that when generating these semantic variants, the system will take into account the language characteristics of the entire smart home field. For example, verbs such as "turn on", "open", and "start" may be common in different device controls, and the system will learn and apply these common patterns to generate more natural language expressions.
[0120] This method of semantic understanding and expansion enables the embodiments of the present invention to generate more comprehensive and diverse test cases. For example, the embodiments of the present invention can test whether the system can correctly understand indirect expressions such as "light up the living room", or test how it handles compound instructions such as "turn on the lights in the living room, but dim them a little". In this way, the embodiments of the present invention can more comprehensively evaluate the system's language understanding ability and command execution accuracy.
[0121] In general, this method based on hierarchical classification Gaussian extended semantic model enables the embodiment of the present invention to generate rich and diverse test data from limited initial information, thereby better verifying the functional integrity and user experience of the smart home control system. This not only improves the test coverage, but also enhances the system's ability to respond to various real user inputs.
[0122] S4: Test data generation and improvement
[0123] In the test data generation and improvement stage, the present invention adopts a series of innovative technologies to ensure that the generated test data not only conforms to the business logic, but also fully covers various test scenarios. First, the system will perform a consistency check on the initially generated test data based on the previously extracted business rules. This step is usually done with the help of a rule engine or a constraint satisfaction problem (CSP) solver to verify whether the data satisfies all known business rules. For data that does not meet the rules, the system will make corresponding adjustments or regenerate it.
[0124] Secondly, the present invention will fine-tune the abnormal values and boundary values in the test data based on the identified data constraints. This process includes identifying the valid value range and constraints for each field, and then generating test data that covers boundary conditions and abnormal situations. In this way, the embodiment of the present invention ensures that the generated data set contains not only normal values, but also boundary values and abnormal values, thereby comprehensively testing the robustness of the software.
[0125] Again, using the semantic understanding results obtained in the previous step, the system will supplement the key attributes and relationships that may be missing in the preliminary test data. This step is mainly based on the semantic expansion results generated by the HCGESM model to identify the attributes that may be missing. At the same time, the embodiment of the present invention also uses association rule mining technology to discover the potential relationships between attributes, and reasonably supplement the values of the missing attributes based on these findings.
[0126] In addition, in order to meet the needs of different business scenarios, the present invention adopts a variety of methods to generate a variety of test data combinations. The embodiment of the present invention uses a combinatorial testing method to generate test cases covering key parameter combinations, applies the Monte Carlo method to simulate random scenarios with different probability distributions, and considers the characteristics of time series to generate data changes reflecting different time scales (such as days, weeks, months, and seasons).
[0127] Finally, the generated test data is fully verified to ensure that it meets the functional and performance requirements of the software. This includes using static analysis tools to check whether the format and structure of the data are correct, applying dynamic verification methods (such as verifying the validity of the data in a simulated test environment), and collecting feedback from domain experts to ensure the rationality of the generated data in terms of business logic.
[0128] Through this series of steps, the embodiment of the present invention finally obtains a set of high-quality preliminary test data that not only conforms to the business logic but also fully covers various test scenarios. These data not only cover various functional modules and business scenarios of the software, but also include data of normal, boundary and abnormal situations, reflecting the real data distribution and business rules, and have time sequence and correlation, effectively simulating the actual business process.
[0129] S5: Test execution and result collection
[0130] In the test execution and result collection stage, the present invention actually applies the generated test data to software testing and comprehensively collects test results and various performance indicators. First, the embodiment of the present invention needs to prepare the test environment. This includes building a test environment similar to the production environment, and configuring necessary test tools and frameworks, such as automated testing tools, performance monitoring tools, etc.
[0131] Secondly, based on the generated test data, the embodiment of the present invention designs test cases covering various scenarios, including multiple dimensions such as functional testing, performance testing, and security testing. In order to improve the test efficiency, the embodiment of the present invention uses test automation tools (such as Selenium, JMeter, etc.) to write test scripts and embeds the generated test data into these automation scripts.
[0132] During the test execution process, the embodiment of the present invention not only runs the automated test scripts and executes the designed test cases, but also performs manual tests on test scenarios that cannot be automated. At the same time, the embodiment of the present invention uses monitoring tools to observe the behavior and performance of the software during the test in real time, and records key indicators such as response time, resource usage, error rate, etc.
[0133] The collection of test results is a comprehensive and detailed process. The embodiment of the present invention records the pass / fail status of each test case, captures and records the exceptions and error information that occur during the test, and collects test logs containing detailed execution steps and intermediate results. In addition, the embodiment of the present invention also collects key performance indicators such as response time, throughput, CPU usage, memory usage, etc., as well as the results of load testing and stress testing to evaluate the extreme performance of the system.
[0134] In the embodiments of the present invention, the embodiments of the present invention also pay special attention to the collection of user experience data. If possible, the embodiments of the present invention will collect experience data simulating user operations, such as page loading time, operation fluency, etc. These data are very important for evaluating the actual use experience of the software.
[0135] In addition, the embodiment of the present invention uses a code coverage tool to analyze the code coverage of the test and evaluate the coverage of the test data for the business scenario. Finally, the embodiment of the present invention performs a preliminary analysis of the collected data, generates a test report and performance chart, and uses a data visualization tool to intuitively display the test results and performance trends.
[0136] Through this comprehensive test execution and result collection process, the embodiment of the present invention can comprehensively evaluate the quality and performance of the software and provide a solid data foundation for subsequent optimization.
[0137] S6: Dynamic Adjustment and Optimization
[0138] S6.1: Based on the test results, use reinforcement learning algorithms to dynamically adjust the test data generation strategy
[0139] In the dynamic adjustment and optimization stage, the present invention introduces a reinforcement learning algorithm to continuously optimize the test data generation process. Figure 6 As shown, first, the embodiment of the present invention models the test data generation process as a Markov decision process (MDP). In this model, the state represents the characteristics of the current test data set, such as data distribution, coverage, etc.; the action represents the possible data generation or modification operation, such as adding a specific type of data, adjusting data distribution, etc.; the reward function is defined based on the test results and reflects the quality of the test data.
[0140] In order to better represent and process this complex decision problem, the embodiment of the present invention uses a vectorization method to represent the characteristics of the test data set, such as the proportion of each type of data, the number of scenarios covered, etc. At the same time, the embodiment of the present invention defines a series of possible operations as the action space, such as "adding boundary value data" and "adjusting the periodicity of time series data".
[0141] In the present invention, the design of the reward function is a key link. The embodiment of the present invention comprehensively considers factors such as test coverage, error detection rate and test efficiency. Test coverage reflects the coverage of software functions by test data, error detection rate measures the ability of test data to find software defects, and test efficiency considers test execution time and resource consumption. These factors are combined by weight to form the final reward function, and the weights can be adjusted according to specific needs.
[0142] In order to learn the optimal data generation strategy, the embodiment of the present invention adopts a deep Q network (DQN). DQN is a reinforcement learning algorithm that combines deep learning and Q learning, and is particularly suitable for dealing with large-scale state space problems. In the implementation of the embodiment of the present invention, the deep neural network is used as an approximator of the Q function, with the input being the state representation and the output being the Q value of each possible action. The embodiment of the present invention uses an ε-greedy strategy to balance exploration and utilization, ensuring that the algorithm can have the opportunity to explore potential better strategies while utilizing the known optimal strategy.
[0143] It should be noted that in order to optimize the learning process of DQN, the embodiment of the present invention adopts experience replay and target network technology. Experience replay improves sample utilization efficiency by storing and reusing past experience. The target network improves the stability of training by using a separate network to calculate the target Q value. The combination of these two technologies greatly improves the efficiency and effect of learning.
[0144] In practical applications, the embodiments of the present invention continuously learn complex nonlinear strategies through continuous iteration and optimization to achieve continuous improvement in the test data generation process. The system will regularly update the Q network to adapt to changes in software and test requirements. At the same time, experience is continuously accumulated in practical applications to further optimize decision-making strategies.
[0145] Through this dynamic adjustment mechanism based on reinforcement learning, the system of the embodiment of the present invention can continuously adjust and optimize the test data generation strategy according to the actual test results, thereby continuously improving the test efficiency and quality.
[0146] S6.2: Repeat the above steps to continuously optimize the test data generation process and form a closed-loop intelligent testing process
[0147] Based on the dynamic adjustment strategy of reinforcement learning, the present invention constructs a closed-loop intelligent testing process. First, the embodiment of the present invention regularly evaluates the quality of the current test data and the test effect, and analyzes the changing trends of key indicators such as test coverage and error detection rate. This periodic evaluation provides an important basis for subsequent optimization.
[0148] Secondly, based on the evaluation results, the embodiment of the present invention will update the reinforcement learning model. This includes adjusting the reward function to reflect the latest test requirements and priorities. In this way, the embodiment of the present invention ensures that the system can continue to adapt to changing test environments and goals.
[0149] After the strategy is updated, the system will apply the new strategy to generate test data. In this process, the embodiment of the present invention will gradually eliminate inefficient test data and increase high-quality test cases. This dynamic adjustment ensures the continuous optimization of the test data set.
[0150] In addition, an important feature of the present invention is continuous learning. The embodiment of the present invention continuously adds newly generated data and its test results to the experience pool, continuously enriching and updating the knowledge base of the model. This mechanism enables the system to learn from each test and continuously improve its ability to generate high-quality test data.
[0151] It should be emphasized that the system of the embodiment of the present invention has strong adaptability. According to changes such as software version updates and new function additions, the system can dynamically adjust the goals and strategies of test data generation. At the same time, it maintains sensitivity to emerging boundary conditions and abnormal situations to ensure the comprehensiveness and effectiveness of the test.
[0152] Through this closed-loop intelligent testing process, the present invention can continuously improve the quality and efficiency of test data, adapt to the dynamic changes of software development, and ultimately achieve the goal of continuously improving software quality. This method not only greatly improves testing efficiency, but also effectively responds to various challenges in the software development process, providing strong support for improving software quality.
[0153] In general, the intelligent software test data generation method and system based on Internet public information provided by the present invention realizes the automatic generation of high-quality, authentic and wide-coverage test data by combining a variety of advanced artificial intelligence technologies. This method not only improves the test efficiency, but also can adapt to the changes in software requirements and complex business logic, providing an innovative solution for improving software quality.
[0154] Example 2
[0155] The present application also provides an intelligent software test data generation system based on Internet public information, such as Figure 2 As shown, including:
[0156] Data collection and preprocessing module, used to collect relevant data from public information on the Internet and perform preprocessing based on software requirements and test scenarios;
[0157] A data enhancement module is used to enhance the preprocessed data using a multi-objective regional Bayesian optimization technique, and to process the time series data in the preprocessed data using a time enhancement and variational Bayesian method to generate enhanced time series data;
[0158] The semantic understanding module is used to read software development documents, extract key information using natural language processing technology, and perform semantic understanding and expansion of the extracted key information based on the hierarchical classification Gaussian extended semantic model;
[0159] The data improvement module is used to improve and adjust the enhanced data and enhanced time series data according to the results of semantic understanding and expansion, and generate preliminary test data that conforms to business logic;
[0160] A test execution module, which is used to apply the generated preliminary test data to the software testing process and collect test results and performance indicators;
[0161] The dynamic adjustment module is used to dynamically adjust the test data generation strategy based on the test results using a reinforcement learning algorithm.
[0162] A data storage module, used to store collected relevant data, generated test data and test results;
[0163] Model training module, used to train and update various machine learning models used in the system;
[0164] The user interface module is used to receive software requirements and test scenarios input by users and display test results and performance indicators.
[0165] The present application also provides a computer device, the computer device comprising:
[0166] at least one processor; and,
[0167] a memory communicatively connected to the at least one processor; wherein,
[0168] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned intelligent software test data generation method based on Internet public information.
[0169] An embodiment of the present application also provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute the above-mentioned intelligent software test data generation method based on Internet public information.
[0170] An embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the above-mentioned method for generating intelligent software test data based on Internet public information.
[0171] The terms "first", "second", "third", "fourth", "1", "2", etc. (if any) in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that shown or described in the drawings.
[0172] It should be understood that, although each operation step is indicated by arrows in the flowchart of the embodiment of the present application, the implementation order of these steps is not limited to the order indicated by the arrows. Unless clearly stated herein, in some implementation scenarios of the embodiment of the present application, the implementation steps in each flowchart can be performed in other orders according to demand. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on actual implementation scenarios. Some or all of these sub-steps or stages may be executed at the same time, and each sub-step or stage in these sub-steps or stages may also be executed at different times respectively. In different scenarios of execution time, the execution order of these sub-steps or stages may be flexibly configured according to demand, and the embodiment of the present application does not limit this.
[0173] The above is only an optional implementation method for some implementation scenarios of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the solution of the present application, other similar implementation methods based on the technical ideas of the present application are also within the protection scope of the embodiments of the present application.
Claims
1. A method for generating intelligent software test data based on Internet public information, characterized in that: The following steps are involved: Based on software requirements and test scenarios, relevant data is collected from public information on the Internet and preprocessed; Multi-objective regional Bayesian optimization techniques are used to enhance the preprocessed data; Use time enhancement and variational Bayesian methods to process the time series data in the preprocessed data to generate enhanced time series data; Read software development documents, extract key information using natural language processing technology, and perform semantic understanding and expansion of the extracted key information based on the hierarchical classification Gaussian extended semantic model; According to the results of semantic understanding and expansion, the enhanced data and enhanced time series data are improved and adjusted to generate preliminary test data that conforms to business logic; Apply the generated preliminary test data to the software testing process and collect test results and performance indicators; Based on the test results, the test data generation strategy is dynamically adjusted using reinforcement learning algorithms; Repeat the above steps to continuously optimize the test data generation process and form a closed-loop intelligent testing process.
2. The method according to claim 1, characterized in that The multi-objective regional Bayesian optimization technology is used to enhance the pre-processed data, specifically including: Define the optimization objective function set {f1(x), f2(x), ..., f k (x)}, where x represents the parameter set of data enhancement and k is the number of optimization objectives; Each objective function was modeled using a Gaussian process; Select the next evaluation point by maximizing the expected improvement. Iterate the optimization within the predefined search space until a Pareto optimal solution that meets the conditions is found.
3. The method according to claim 1, characterized in that The time series data is processed using the time enhancement and variational Bayes method, specifically including: Perform time warping and time interpolation processing on the original time series data; Construct a variational autoencoder (VAE) model, in which both the encoder and decoder use a recurrent neural network (RNN) structure; Learn the VAE’s hidden variable z by minimizing the reconstruction error and KL divergence; Utilize the learned VAE model to generate new time series data while maintaining the temporal characteristics of the data.
4. The method according to claim 1, characterized in that The software development document is read and key information is extracted using natural language processing technology, including: Use lexical analysis and syntactic analysis techniques to preprocess software development documents; Use named entity recognition technology to identify key entities and attributes in documents; Use dependency parsing techniques to extract relationships and constraints between entities; Apply topic modeling techniques to identify major topics and business rules in documents; Use word vector technology to calculate the semantic similarity between words to assist semantic understanding and expansion.
5. The method according to claim 1, characterized in that: The semantic understanding and expansion of the extracted information based on the hierarchical classification Gaussian extended semantic model specifically includes: Construct a hierarchy of semantic concepts, and use Gaussian distribution N(μ i ,Σ i )express; For a given input semantics x, calculate its Mahalanobis distance with each concept node; Based on the calculated Mahalanobis distance, determine the concept category to which the input semantics x belongs; Using the determined concept categories, new semantics related to the input semantics are generated based on the hierarchical relationship and similarity between concepts; Use the generated new semantics to expand the original semantic space and increase the diversity and coverage of test data.
6. The method according to claim 1, characterized in that According to the results of semantic understanding and expansion, the enhanced data and enhanced time series data are improved and adjusted, specifically including: Perform consistency check on the generated preliminary test data according to the extracted business rules; Adjust outliers and boundary values in preliminary test data based on identified data constraints; Use semantic understanding results to supplement key attributes and relationships missing in preliminary test data; Generate a variety of test data combinations based on the business scenario requirements analyzed; The generated test data is verified to ensure that it meets the functional and performance requirements of the software.
7. The method according to claim 1, characterized in that Based on the test results, the test data generation strategy is dynamically adjusted using a reinforcement learning algorithm, specifically including: Model the generation process of test data as a Markov decision process (MDP); Define the state in the MDP as the current test data set, and the action as the possible data generation or modification operation; Define a reward function based on test coverage, error detection rate, and test efficiency; Use Deep Q Network (DQN) to learn optimal data generation strategies; Use experience replay and target network technology to optimize the learning process of DQN; Through continuous iteration and optimization, complex nonlinear strategies are learned to achieve continuous improvement in the test data generation process.
8. An intelligent software test data generation system based on Internet public information, characterized in that: include: Data collection and preprocessing module, used to collect relevant data from public information on the Internet and perform preprocessing based on software requirements and test scenarios; A data enhancement module is used to enhance the preprocessed data using a multi-objective regional Bayesian optimization technique, and to process the time series data in the preprocessed data using a time enhancement and variational Bayesian method to generate enhanced time series data; The semantic understanding module is used to read software development documents, extract key information using natural language processing technology, and perform semantic understanding and expansion of the extracted key information based on the hierarchical classification Gaussian extended semantic model; The data improvement module is used to improve and adjust the enhanced data and enhanced time series data according to the results of semantic understanding and expansion, and generate preliminary test data that conforms to business logic; A test execution module, which is used to apply the generated preliminary test data to the software testing process and collect test results and performance indicators; The dynamic adjustment module is used to dynamically adjust the test data generation strategy based on the test results using a reinforcement learning algorithm.
9. The system according to claim 8, characterized in that Also includes: A data storage module, used to store collected relevant data, generated test data and test results; Model training module, used to train and update various machine learning models used in the system; The user interface module is used to receive software requirements and test scenarios input by users and display test results and performance indicators.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Automatic testing method for intelligent software
CN116594913A
Loop code test data generation method based on deep learning fuzzy test
CN116680164A
Software function automatic test method and system, terminal and medium
CN117421217A
Automatic test case generation device based on large language model
CN117806980A
Automatic test method for reducing test technical threshold of intelligent terminal system
CN117931620A