Software configuration item test case generation method, system and device, medium and product
By parsing software configuration requirement documents using a large language model, high-quality test cases are generated, solving the problems of low efficiency and incomplete coverage in traditional testing methods, and achieving efficient and accurate test case generation.
Patent Information
- Application Number
- CN202511375989.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-24
- Publication Date
- 2025-12-02
AI Technical Summary
Traditional manual testing methods suffer from problems such as low testing efficiency, incomplete coverage, low accuracy, and high cost in software testing, and cannot meet the needs of agile development and continuous delivery.
The software configuration requirements document is parsed using a large language model to extract key configuration item information, generate configuration input data, and predict expected output data using an attention mechanism algorithm. This data is then filled into the test case template to generate test cases.
It improved the accuracy and efficiency of test cases, reduced manual operations, increased test coverage and quality, shortened the test cycle, and reduced costs.
Smart Images

Figure CN121051024A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of test case generation, and in particular to a method, system, device, medium, and product for generating test cases for software configuration items. Background Technology
[0002] In today's rapidly evolving software industry, with the widespread adoption of agile development and continuous delivery models, software testing faces new challenges. Traditional manual testing methods suffer from low testing efficiency, incomplete test coverage, low test case accuracy, and high testing costs, making them unable to meet the demands of rapid iteration and high-quality delivery. Summary of the Invention
[0003] The purpose of this application is to provide a method, system, device, medium, and product for generating software configuration item test cases, so as to improve the accuracy of test case generation and thus improve testing efficiency.
[0004] To achieve the above objectives, this application provides the following solution: Firstly, this application provides a method for generating test cases for software configuration items, including: Obtain the software configuration requirement document of the target software configuration item, and parse the software configuration requirement document using a large language model to obtain the key configuration item information of the target software configuration item; the key configuration item information includes configuration parameters, configuration scope, dependencies, constraints and exception branches; Based on the configuration item data characteristics, a large language model is used to generate configuration input data for the target software configuration items; the configuration item data characteristics are determined based on the structure and requirements of the software configuration data. Based on the configured input data, the expected output data of the target software configuration item is determined by using a large language model and an attention mechanism algorithm. Based on the key configuration item information, the configuration input data, the expected output data, and the test steps of the target software configuration item are filled into the test case template to generate test cases for the target software configuration item; the test case template includes the structure of input conditions, data format, expected output data format, and test steps.
[0005] Optionally, the software configuration requirements document can be parsed using a large language model to obtain key configuration item information for the target software configuration items, specifically including: The software configuration requirement document is preprocessed to obtain a processed software configuration requirement document; the preprocessing includes word segmentation, stop word removal, segmentation, and vectorization. The processed software configuration requirements document is parsed using a large language model to obtain key configuration item information for the target software configuration items.
[0006] Optionally, it also includes: Execute the test cases for the target software configuration items to obtain the actual output data; The actual output data is compared with the expected output data to verify the effectiveness of the test cases for the target software configuration item.
[0007] Optionally, string matching or numerical comparison algorithms can be used to compare the actual output data with the expected output data to verify the validity of the test cases for the target software configuration item.
[0008] Secondly, this application provides a software configuration item test case generation system, including: The configuration requirement parsing module is used to obtain the software configuration requirement document of the target software configuration item, and use a large language model to parse the software configuration requirement document to obtain the key configuration item information of the target software configuration item; the key configuration item information includes configuration parameters, configuration scope, dependencies, constraints and exception branches; The input data generation module is used to generate configuration input data for the target software configuration items based on the configuration item data characteristics and using a large language model; the configuration item data characteristics are determined based on the structure and requirements of the software configuration data. The expected output prediction module is used to determine the expected output data of the target software configuration item based on the configuration input data, using a large language model and an attention mechanism algorithm. The test case generation module is used to fill the configuration input data, the expected output data, and the test steps of the target software configuration item into the test case template according to the key configuration item information, and generate test cases for the target software configuration item; the test case template includes the structure of input conditions, data format, expected output data format, and test steps.
[0009] Optionally, the configuration requirement parsing module includes: The preprocessing unit is used to preprocess the software configuration requirement document to obtain a processed software configuration requirement document; the preprocessing includes word segmentation, stop word removal, segmentation and vectorization. The parsing unit is used to parse the processed software configuration requirements document using a large language model to obtain key configuration item information of the target software configuration items.
[0010] Thirdly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the software configuration item test case generation method described in any one of the above.
[0011] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the software configuration item test case generation method described in any one of the above.
[0012] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the software configuration item test case generation method described in any one of the above descriptions.
[0013] According to the specific embodiments provided in this application, this application has the following technical effects: This application provides a method, system, device, medium, and product for generating test cases for software configuration items. It involves obtaining a software configuration requirement document for the target software configuration item and parsing the document using a large language model to obtain key configuration item information. Based on the configuration item data characteristics, the large language model is used to generate configuration input data for the target software configuration item. These characteristics are determined based on the structure and requirements of the software configuration data. Based on the configuration input data, the large language model, combined with an attention mechanism algorithm, is used to determine the expected output data for the target software configuration item. Based on the key configuration item information, the configuration input data, expected output data, and test steps for the target software configuration item are filled into a test case template to generate test cases for the target software configuration item. The test case template includes the input data format, expected output data format, and the structure of the test steps. This application utilizes a large language model and test case templates to automatically generate more comprehensive and higher-quality test cases, effectively improving testing efficiency and quality. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 A schematic diagram of the structure of a software configuration item test case generation system provided in an embodiment of this application; Figure 2 Intelligent generation of method flowcharts for test cases; Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0016] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0017] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0018] In one exemplary embodiment, such as Figure 1 As shown, a method for generating test cases for software configuration items is provided, including the following steps: S1: Obtain the software configuration requirement document of the target software configuration item, and use a large language model to parse the software configuration requirement document to obtain the key configuration item information of the target software configuration item; the key configuration item information includes configuration parameters, configuration scope, dependencies, constraints and exception branches.
[0019] As an optional implementation, the software configuration requirements document is parsed using a large language model to obtain key configuration item information for the target software configuration items, specifically including: The software configuration requirements document is preprocessed to obtain a processed software configuration requirements document; the preprocessing includes word segmentation, stop word removal, segmentation, and vectorization.
[0020] The processed software configuration requirements document is parsed using a large language model to obtain key configuration item information for the target software configuration items.
[0021] In practical applications, a large language model is used to parse software configuration requirement documents and extract key configuration item information. Users upload their software configuration requirement documents to the system, where they undergo preprocessing, including word segmentation, stop word removal, segmentation, and vectorization. The large language model then performs deep learning analysis on the processed document to extract key configuration item information, such as configuration parameters, configuration scope, dependencies, business constraints, and abnormal branches. This extracted key information is represented as structured data for easier subsequent processing. An attention-based algorithm is employed to identify key configuration item information within the document.
[0022] Specifically, the document undergoes preprocessing using the text2vec word segmentation model, including word segmentation and stop word removal. A finely tuned Deepseek language model is used to parse the software configuration requirements document, employing a context-based key information location method to identify and extract key configuration items.
[0023] S2: Based on the configuration item data characteristics, use a large language model to generate configuration input data for the target software configuration items; the configuration item data characteristics are determined based on the structure and requirements of the software configuration data.
[0024] In practical applications, a large language model is used to generate possible configuration input data. Specifically, firstly, a strategy for generating input data is defined, including random generation and generation based on historical data, etc. Then, the large language model is used to generate possible configuration input data. Finally, the generated data is validated to ensure its validity and reasonableness.
[0025] First, based on the structure and requirements of the configuration data, a template or example describing the characteristics of the configuration data is written. Then, a large language model (such as a Transformers-based model) is used to generate diverse configuration input data based on this template. During the generation process, techniques such as conditional generation, rule-based generation, or generation based on historical data can be used to ensure that the model follows specific constraints when generating data. The verification process includes inputting the generated configuration data into the target system or simulation environment to check whether the system can process the data normally and whether the data meets the expected functional and performance requirements. The specific technique used is Natural Language Processing (NLP).
[0026] S3: Based on the configuration input data, use a large language model combined with an attention mechanism algorithm to determine the expected output data of the target software configuration item.
[0027] In practical applications, large oracle models such as DeepSeek are used to predict the expected output data of the configuration input data. A prediction model (based on an attention mechanism algorithm) is trained using historical test data of the software configuration items, and the trained model is then used to predict the expected output of the configuration input data.
[0028] First, the input data is cleaned and formatted. Then, a task-specific output layer is attached to the pre-trained large language model, and the model is fine-tuned using algorithms such as backpropagation and gradient descent. During model training, hyperparameters are adjusted by monitoring the loss and accuracy on the validation set to prevent overfitting. Finally, the model is evaluated on an independent test set (partial historical test data), and the predictive performance of the model is specifically quantified by calculating metrics such as accuracy and recall.
[0029] S4: Based on the key configuration item information, fill the configuration input data, the expected output data, and the test steps of the target software configuration item into the test case template to generate test cases for the target software configuration item; the test case template includes the structure of input conditions, data format, expected output data format, and test steps.
[0030] In practical applications, test case templates are generated based on the parsed key configuration item information. The test case template is defined, including input conditions, data format, and expected output format. Based on the extracted key configuration item information, the template is populated to generate specific test case templates.
[0031] The steps to fill in the template are as follows: First, define a test case template, including the input data format, expected output format, and test step structure. Then, based on the extracted key configuration item information, fill in the specific configuration input data, expected output data, and operation steps into the corresponding positions in the template to generate specific test cases. For example, the input data format can be defined as JSON format, such as {"username":"testuser","password":"testpass"}; the expected output format can be defined as {"status":"success","message":"Login successful"}; and the test steps can be defined as: 1. Open the login page; 2. Enter username and password; 3. Click the login button; 4. The verification page redirects to the homepage. Finally, fill in this specific information into the template to generate complete test cases.
[0032] In another implementation, test case templates are automatically generated based on the parsed key configuration information. These templates guide testers on how to construct test scenarios for specific software or system configurations, ensuring comprehensive coverage of all critical test points.
[0033] like Figure 2As shown, at the business requirements level, historical / experience data (test cases used in past projects, defects found in historical tests, including defect types, severity and resolution, historical changes to project requirements, and user feedback during product use, especially actual usage and issues) is collected, cleaned, and formatted. This data is then analyzed based on natural language processing and contextual understanding. At the rule extraction level, test case rules described in natural language undergo rule filtering, rule element extraction, and rule assembly. These rules are then made operational, and relationships are mined to form rule specifications. Test cases are generated based on the requirements analysis and rule specifications. The model processing toolchain optimizes the model using a fine-tuned large language model for classification and extraction, used for building a terminology database and event sequence domain knowledge. Test strategies are then applied to test case generation.
[0034] As an optional implementation, it also includes: Execute the test cases for the target software configuration items to obtain the actual output data.
[0035] The actual output data is compared with the expected output data to verify the effectiveness of the test cases for the target software configuration item.
[0036] As an optional implementation, string matching or numerical comparison algorithms are used to compare the actual output data with the expected output data to verify the validity of the test cases for the target software configuration item.
[0037] In practical applications, the generated test cases are compared with known test results to verify their effectiveness. Specifically, the generated test cases are executed to obtain actual output data, which is then compared with the expected output data to verify the effectiveness of the test cases. Test cases are executed in an isolated test environment to ensure the accuracy of the test results. Algorithms such as string matching and numerical comparison are used for result comparison.
[0038] First, an evaluation metric system is designed to quantify model performance, such as accuracy, precision, recall, and F1 score. Next, the model's predicted output is compared one-to-one with the actual data labels, recording the correctness of each prediction. Then, based on the comparison results, each evaluation metric is calculated to determine the overall model performance. Finally, cross-validation and multi-model comparisons are used to ensure the stability and reliability of the validation results. At this point, the test results are obtained, and the technical issues are resolved.
[0039] This application relates to a method for generating test cases for software configuration items, aiming to improve the efficiency and accuracy of software testing. The proposed method is a highly efficient configuration item test case generation tool integrating a large language model. It can automatically analyze the requirements document for software configuration items, extract key information, and utilize the deep learning capabilities of the large language model to generate comprehensive and accurate test cases. This method can automatically extract key configuration item information from the requirements document without manual intervention, significantly reducing the workload of testers and improving testing efficiency. This method is applicable to various types of software configuration item testing, whether it's simple parameter settings or complex business logic, it can generate corresponding test cases. Test cases generated through the large language model can cover more test scenarios, including normal processes, abnormal processes, and boundary conditions, thereby improving software quality. When software configuration items change, test cases can be quickly regenerated. First, the change point is identified and the scope of impact is assessed; then, matching test cases are retrieved from the test case library, and their reusability is evaluated; for test cases that cannot be reused, new test cases can be regenerated through model regeneration or editing. After manual review, existing test cases are updated, and outdated test cases are deleted. It is ensured that test cases are synchronized with the software version. The method described in this application can significantly shorten the testing cycle, reduce testing costs, and improve the stability and reliability of software products.
[0040] This application has the following advantages over related technologies: 1. Reduce manual operations: Automated processing reduces tedious steps such as copying and pasting documents, writing prompts, copying results, and saving test cases.
[0041] 2. Improved response speed and stability: By using file splitting and text vectorization, the response time of large models is reduced and the accuracy of the generated results is improved.
[0042] 3. Improve testing efficiency and quality: Automated test cases are more comprehensive and of higher quality, effectively improving testing efficiency and quality.
[0043] Based on the same inventive concept, this application also provides a system for generating test cases for software configuration items as described above. The solution provided by this system is similar to the solution described in the above method; therefore, the specific limitations in the software configuration item test case generation system embodiments provided below can be found in the limitations of the software configuration item test case generation method described above, and will not be repeated here.
[0044] In one exemplary embodiment, a software configuration item test case generation system is provided, comprising: The configuration requirement parsing module is used to obtain the software configuration requirement document of the target software configuration item, and to parse the software configuration requirement document using a large language model to obtain the key configuration item information of the target software configuration item; the key configuration item information includes configuration parameters, configuration scope, dependencies, constraints and exception branches.
[0045] The input data generation module is used to generate configuration input data for the target software configuration items based on the configuration item data characteristics using a large language model; the configuration item data characteristics are determined based on the structure and requirements of the software configuration data.
[0046] The expected output prediction module is used to determine the expected output data of the target software configuration item based on the configuration input data, using a large language model combined with an attention mechanism algorithm.
[0047] The test case generation module is used to fill the configuration input data, the expected output data, and the test steps of the target software configuration item into the test case template according to the key configuration item information, and generate test cases for the target software configuration item; the test case template includes the structure of input conditions, data format, expected output data format, and test steps.
[0048] As an optional implementation, the configuration requirement parsing module includes: The preprocessing unit is used to preprocess the software configuration requirement document to obtain a processed software configuration requirement document; the preprocessing includes word segmentation, stop word removal, segmentation and vectorization.
[0049] The parsing unit is used to parse the processed software configuration requirements document using a large language model to obtain key configuration item information of the target software configuration items.
[0050] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described software configuration item test case generation method.
[0051] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the above-described software configuration item test case generation method.
[0052] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the above-described software configuration item test case generation method.
[0053] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 3 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and databases. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media to run. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for generating test cases for software configuration items.
[0054] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0055] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0056] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
[0057] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, vector databases that store unstructured data. The processors involved in the embodiments provided in this application may be, but are not limited to, general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc.
[0058] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0059] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for generating test cases for software configuration items, characterized in that, include: Obtain the software configuration requirement document of the target software configuration item, and parse the software configuration requirement document using a large language model to obtain the key configuration item information of the target software configuration item; the key configuration item information includes configuration parameters, configuration scope, dependencies, constraints and exception branches; Based on the configuration item data characteristics, a large language model is used to generate configuration input data for the target software configuration items; the configuration item data characteristics are determined based on the structure and requirements of the software configuration data. Based on the configured input data, the expected output data of the target software configuration item is determined by using a large language model and an attention mechanism algorithm. Based on the key configuration item information, the configuration input data, the expected output data, and the test steps of the target software configuration item are filled into the test case template to generate test cases for the target software configuration item; the test case template includes the structure of input conditions, data format, expected output data format, and test steps.
2. The method for generating test cases for software configuration items according to claim 1, characterized in that, The software configuration requirements document is parsed using a large language model to obtain key configuration item information for the target software, specifically including: The software configuration requirement document is preprocessed to obtain a processed software configuration requirement document; the preprocessing includes word segmentation, stop word removal, segmentation, and vectorization. The processed software configuration requirements document is parsed using a large language model to obtain key configuration item information for the target software configuration items.
3. The method for generating test cases for software configuration items according to claim 1, characterized in that, Also includes: Execute the test cases for the target software configuration items to obtain the actual output data; The actual output data is compared with the expected output data to verify the effectiveness of the test cases for the target software configuration item.
4. The method for generating test cases for software configuration items according to claim 3, characterized in that, The actual output data and the expected output data are compared using string matching or numerical comparison algorithms to verify the validity of the test cases for the target software configuration item.
5. A software configuration item test case generation system, characterized in that, include: The configuration requirement parsing module is used to obtain the software configuration requirement document of the target software configuration item, and use a large language model to parse the software configuration requirement document to obtain the key configuration item information of the target software configuration item; the key configuration item information includes configuration parameters, configuration scope, dependencies, constraints and exception branches; The input data generation module is used to generate configuration input data for the target software configuration items based on the configuration item data characteristics using a large language model; the configuration item data characteristics are determined based on the structure and requirements of the software configuration data. The expected output prediction module is used to determine the expected output data of the target software configuration item based on the configuration input data, using a large language model and an attention mechanism algorithm. The test case generation module is used to fill the configuration input data, the expected output data, and the test steps of the target software configuration item into the test case template according to the key configuration item information, and generate test cases for the target software configuration item; the test case template includes the structure of input conditions, data format, expected output data format, and test steps.
6. The software configuration item test case generation system according to claim 5, characterized in that, The configuration requirement parsing module includes: The preprocessing unit is used to preprocess the software configuration requirement document to obtain a processed software configuration requirement document; the preprocessing includes word segmentation, stop word removal, segmentation, and vectorization. The parsing unit is used to parse the processed software configuration requirements document using a large language model to obtain key configuration item information of the target software configuration items.
7. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the software configuration item test case generation method according to any one of claims 1-4.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the software configuration item test case generation method according to any one of claims 1-4.
9. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the software configuration item test case generation method according to any one of claims 1-4.