Test case generation system construction method and test case generation method
Through Transformer-based algorithms and multimodal data fusion technology, the problem of difficult test generation in the existing technology is solved, and an efficient and accurate test case generation system construction method is realized, which solves the system requirements of multimodal data that are difficult to solve in the existing technology, and generates an efficient and effective test case generation system construction method, which solves the technical problems of multimodal data that are difficult to solve in the existing technology, and provides an efficient and accurate test case generation system construction method, which solves the technical problems existing in the existing technology and realizes efficient and accurate test case generation.
Patent Information
- Application Number
- CN202511180304.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-22
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2045-08-22
AI Technical Summary
Existing technologies make it difficult to automatically generate test cases from system requirement specifications based on multimodal data efficiently and accurately, resulting in low test coverage and poor use case quality.
Using the Transformer-based text classification analysis algorithm, combined with multimodal data fusion technology, the system requirement specification is normalized and standardized, a bidirectional LSTM-CRF architecture is used for requirement entity recognition, a feature abstraction architecture based on deep Transformer is designed, a semantically guided test case template is created, and end-to-end optimization is performed through a differentiable data processing pipeline to generate a structured test case framework.
It improves the efficiency and accuracy of test case generation, reduces manual intervention errors, ensures comprehensive coverage of test points, and improves the quality and coverage of test cases.
Smart Images

Figure CN120670326A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software testing, and in particular relates to a method for constructing a test case generation system based on Transformer and multimodal data fusion. Background Art
[0002] With the increasing scale and complexity of software systems, software testing faces unprecedented challenges. In traditional software development, test case development often relies on manual extraction of functional and business logic information from system requirements specifications. This approach is not only labor-intensive and time-consuming, but also prone to incomplete test coverage due to human oversight, thus impacting the quality and stability of software products. Furthermore, requirements specifications often exist in a variety of formats, mixing text and images. Manually identifying and integrating this multimodal information often presents numerous uncertainties and difficulties, particularly in terms of structured expression and implicit requirements supplementation.
[0003] In recent years, deep learning-based natural language processing technologies and Transformer models have achieved remarkable results in semantic understanding and information extraction. Furthermore, the development of multimodal data fusion technology has enabled the simultaneous use of both text and image information sources for more comprehensive and accurate requirements analysis. However, how to efficiently apply these advanced technologies to the construction of systems for automatically generating test cases remains a pressing challenge in the industry.
[0004] While some existing literature and methods have proposed text parsing, OCR image recognition, and semantic extraction solutions based on Transformers or other deep learning models for requirements documents, these approaches are often independent and struggle to achieve unified, efficient, and accurate information extraction and automated test case generation for system requirements specifications containing multimodal data. Traditional methods also have limitations in standardizing requirements documents, annotating missing parameters, and identifying implicit requirements. These methods can easily miss key test points, making it difficult to ensure test coverage and test case quality. Summary of the Invention
[0005] In response to the above technical problems, the present invention discloses a method for constructing a test case generation system, which optimizes test case generation by using a Transformer-based text classification analysis algorithm, constructs a test case conversion generation tool, and applies it to practical work.
[0006] To achieve the above-mentioned purpose, the present invention adopts a technical solution: a method for constructing a test case generation system, the method comprising: Step 1: Normalize and standardize the system requirement specifications, analyze and clean the functional requirement module content, and use multimodality to perform structured processing of requirement analysis and knowledge enhancement to obtain the structured functional dataset Clean_Function_Dataset_List: The system requirement specification is normalized and standardized, and the standard for normalization and standardization is defined as using specific keywords to segment content; For the pictures in the system requirements specification, decompress the image files, perform perspective correction and adaptive binarization preprocessing, perform text recognition, and obtain the image recognition processed text; Read the content of the system requirements specification and parse it into plain text format. The parsed images are automatically annotated with the [Image:Imagen] placeholder, where Imagen is the nth image in the functional requirements section of the system requirements specification. The extracted text content and the image recognition processing text list Image_OCR_Processing_Text_List are merged into a continuous text string ContinuousStrText; A bidirectional LSTM-CRF architecture is used for demand entity recognition. A differentiable rule engine is used to dynamically generate regular expression templates to achieve adaptive adjustment of regular parameters. Then, regular expressions dynamically generated by reinforcement learning optimization strategies and slicing technology are used to extract and segment data from the continuous text string ContinuousStringText based on keywords. All the segmented data content is stored in a structured function dataset Clean_Function_Dataset_List=[data1, data2, data3, ...,datan], n∈[1,NewFunctionListLen], to obtain the structured function dataset Clean_Function_Dataset_List.
[0007] Step 2: Design a feature abstraction architecture based on deep Transformer to obtain the semantic feature representation dataset Semantic_Feature_Representation_Dataset: A Word2Vec model pre-trained on a corpus of software domain requirements documents was used to perform preliminary embedding on the structured function dataset, Clean_Function_Dataset_List. Deep feature abstraction of the embeddings was then performed using a four-layer Transformer encoder, generating the highly generalizable Semantic Feature Representation Dataset. The pre-trained Word2Vec model uses a Skip-gram architecture with parameters such as word embedding dimension 300, window size 12, and number of negative samples 5. The training process optimizes the word embedding representation by minimizing a contextual prediction loss function. This model maps text snippets from the structured function dataset into low-dimensional vectors with domain semantic associations, providing a foundation for feature abstraction in the subsequent four-layer Transformer encoder.
[0008] Step 3: Create a test case template construction method based on semantic guidance and obtain the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile: Read the content of the semantic feature representation dataset Semantic_Feature_Representation_Dataset, and use the json extension package and regular expression technology to format the data according to the pre-defined label field to obtain the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile.
[0009] Step 4: Preprocess the supplementary data content to obtain the structured data base test case framework dataset MindMap_BaseTestCase_Framework_DataFile: Preview the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile, use the global semantic information captured by Transformer to preprocess and supplement the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile, and obtain the structured data basic test case framework dataset MindMap_BaseTestCase_Framework_DataFile.
[0010] Step 5: Establish a co-evolutionary mechanism for demand preprocessing and model training, implement end-to-end joint optimization through a differentiable data processing pipeline, and obtain a Transformer-based model Case_Transformer-based: Using the structured data basic test case framework dataset, MindMap_BaseTestCase_Framework_DataFile, a dual-channel training system was constructed, with a parallel structured data processing channel and a text semantic processing channel. Requirements parsing parameters were simultaneously optimized during the model fine-tuning phase. A dynamic learning rate allocation strategy was implemented to ensure that the parameter update rate (η_ocr=5e-6) for normalization and standardization of the system requirements specification was lower than that of the four-layer Transformer encoder (η_main=2e-5). A cross-modal contrastive loss function was used to constrain the alignment of text and image features. An innovative requirements reconstruction and verification module was introduced, which reverse-mapped the test cases generated by the model into pseudo-requirements documents and calculated semantic fidelity (BLEU ≥ 0.65) with the original input. When generation errors caused by missing parameter annotations were detected, it automatically triggered iterative updates of the [UNK] placeholder completion rules. During training, a three-stage optimization strategy was implemented: For the first 3,000 iterations, fixed text cleaning rules were used to focus on developing feature extraction capabilities. For the next 5,000 iterations, the semantic similarity threshold parameter (dynamic range 0.65-0.75) was adjusted to enable adaptive deduplication. For the final 2,000 iterations, a closed-loop feedback channel was activated, inversely adjusting the multimodal fusion weights based on test case coverage (function point coverage ≥ 92%). A dual evaluation system was established: on the demand side, parameter annotation accuracy (≥ 95%) and document structure compliance (ISO29148 alignment ≥ 98%) were monitored; on the use case side, boundary condition completeness (≥ 90%) and exception scenario coverage (≥ 85%) were required. When the composite metric improvement rate for 20 consecutive epochs was less than 0.5%, an early stopping mechanism was initiated, and the final optimized model, Case_Transformer-based, was output. An epoch represents the complete input of the structured data base test case framework dataset (MindMap_BaseTestCase_Framework_DataFile) into the model, followed by a single forward propagation and backward optimization.
[0011] Furthermore, step 1 also includes the following sub-steps: Normalize and standardize system requirement specifications. The standard for normalization and standardization is to segment content using specific keywords, such as system architecture, functional requirements, and non-functional requirements. Missing parameters are automatically marked with [UNK] placeholders. Contextual information is used to infer possible values for missing parameters. Duplicate descriptions are removed by calculating semantic similarity between adjacent paragraphs (cosine threshold > 0.7). For the images in the functional requirements section of the system requirements specification, we used Python's zipfile module to decompress the image files, performed perspective correction and adaptive binarization preprocessing with OpenCV, used the Paddle OCR tool for text recognition, adopted the improved Faster-ENMS algorithm to detect text areas in document images, and constructed a deformable convolution-based spatial transformer network (Deformable STN) for geometric correction. The formula is as follows: , Where W is the deformation field, p is the pixel coordinate, ∆p is the offset, STN is the spatial transformer network, and the spatial transformer network with parameter θ extracts features of image I. Based on the Paddle OCR tool, an adversarial training strategy is introduced to synthesize distorted samples through the generative adversarial network GAN. The formula is as follows: , Where G is the generator, D is the discriminator, z is the noise vector, L perceptual To achieve perceptual loss, we extract text with a confidence threshold ≥ 90% and establish a cross-modal attention alignment mechanism. The formula is as follows: , where q text is the text feature, k image is the image feature, d is the dimension, the corrected image feature is semantically aligned with the text feature, and the image recognition processing text list Image_OCR_Processing_Text_List=[Image1_data, Image2_data, Image3_data, ...,Imagen_data] is constructed, n∈[1,Imagen], where Imagen_data is the text content extracted by OCR processing from the nth image Imagen in the functional requirements section of the system requirements specification; The python-docx extension package is used to read the content of the system requirements specification and parse it into plain text format. The parsed images are automatically annotated with the [Image:Imagen] placeholder (Imagen is the nth image in the functional requirements section of the system requirements specification). The extracted text content and the image recognition processing text list Image_OCR_Processing_Text_List are merged into a continuous text string ContinuousStrText; The bidirectional LSTM-CRF architecture is used for demand entity recognition. The formula is as follows: , Among them, β ij is the attention weight of entity j to position i, k e j Represents the unique identifier of an entity in the knowledge graph, W is the entity embedding mapping matrix, and N(i) represents the set of entities related to position i. The regular expression template is dynamically generated by the differentiable rule engine to achieve adaptive adjustment of the regular parameters. The formula is as follows: , Where T is the grammatical dependency tree of the input text, r is the generated regular expression component sequence, and W is the learnable parameter matrix. Then, using the regular expression dynamically generated by the reinforcement learning optimization strategy and the slicing technology, data is extracted and segmented from the continuous text string ContinuousStringText according to keywords. All the segmented data content is stored in the structured function dataset Clean_Function_Dataset_List=[data1, data2, data3, ..., datan], n∈[1,NewFunctionListLen]; The length of the structured function dataset Clean_Function_Dataset_List is recorded as NewFunctionListLen, the nth data item in the structured function dataset Clean_Function_Dataset_List is recorded as datan, and the format of the nth data item datan is {keyword:keyword value}. The regular expression can be adjusted according to the system requirements specification, for example: r"Functional requirements (.*?) non-functional requirements". The slicing can be adjusted according to the system requirements specification, for example: split(';'). The reinforcement learning optimization strategy formula is as follows: , Where s is the current regular expression pattern, α is the add / delete / modify operation (such as optimizing .* to \d+), R(s,α× ) = Coverage Gain × 10 + diversity score, and slicing technology, extract and segment data from the continuous text string ContinuousStringText according to keywords, and store all the segmented data content into the structured function dataset Clean_Function_Dataset_List=[data1, data2, data3, ...,datan], n∈[1,NewFunctionListLen], to obtain the structured function dataset Clean_Function_Dataset_List. The length of the structured function dataset Clean_Function_Dataset_List is recorded as NewFunctionListLen, the nth data information in the structured function dataset Clean_Function_Dataset_List is recorded as datan, and the format of the nth data datan is {keyword:keyword value}. The regular expression can be adjusted according to the system requirements specification, for example: r"Functional requirements (.*?) non-functional requirements". The slicing can be adjusted according to the system requirements specification, for example: split(';'); Furthermore, step 2 includes the following sub-steps: The pre-trained Word2Vec model is used to perform preliminary embedding on the structured function dataset Clean_Function_Dataset_List, and a four-layer Transformer encoder is used to perform deep feature abstraction on the embedded vector. An 8-head attention mechanism, a hidden dimension of 512, and a feedforward layer dimension of 2048 are set for each layer. Dropout (random inactivation) and Layer Normalization (layer normalization) are introduced in the multi-head self-attention module. At the same time, the scaling parameter γ is configured to 0.1 and the Dropout rate is configured to 0.3 to prevent overfitting and accelerate model convergence, thereby generating a high-order semantic feature representation dataset Semantic_Feature_Representation_Dataset with high generalization ability.
[0012] Furthermore, step 3 includes the following sub-steps: Read the contents of the semantic feature representation dataset Semantic_Feature_Representation_Dataset, format the data using the JSON extension package and regular expression technology according to the predefined label fields (module, test scenario, priority, precondition, input data, execution steps, expected results), finely classify the text, and intelligently supplement the implicit requirements of seven dimensions such as system compatibility and security (product function / performance / reliability / maintainability / security / usability / compatibility). Obtain the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile. The regular expression can be adjusted according to the format of datan, for example: r"(\w+):(\w+)".
[0013] Furthermore, step 4 includes the following sub-steps: Preview the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile, and use the global semantic information captured by Transformer to perform preprocessing and supplement work on the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile in terms of product functions, system compatibility, product performance, product usability, product reliability, product security, and software maintainability, and obtain the structured data basic test case framework dataset MindMap_BaseTestCase_Framework_DataFile.
[0014] Furthermore, step 5 includes the following sub-steps: A dual-channel training system was constructed using the structured data base test case framework dataset, MindMap_BaseTestCase_Framework_DataFile, to simultaneously optimize requirement parsing parameters during the model fine-tuning phase. A dynamic learning rate allocation strategy was set to ensure that the parameter update rate of the OCR geometry correction network (η_ocr=5e-6) was lower than that of the main Transformer network (η_main=2e-5). A cross-modal contrastive loss function was used to constrain text-image feature alignment. An innovative requirement reconstruction verification module was introduced, which reverse-mapped the model-generated test cases into pseudo-requirements documents and calculated semantic fidelity (BLEU ≥ 0.65) with the original input. When generation errors caused by missing parameter annotations were detected, it automatically triggered iterative updates of the [UNK] placeholder completion rules. During training, a three-stage optimization strategy was implemented: For the first 3,000 iterations, fixed text cleaning rules were used to focus on developing feature extraction capabilities. For the next 5,000 iterations, the semantic similarity threshold parameter (dynamic range 0.65-0.75) was adjusted to enable adaptive deduplication. For the final 2,000 iterations, a closed-loop feedback channel was activated, inversely adjusting the multimodal fusion weights based on test case coverage (function point coverage ≥ 92%). A dual evaluation system was established: on the demand side, parameter annotation accuracy (≥ 95%) and document structure compliance (ISO29148 matching ≥ 98%) were monitored. On the use case side, boundary condition completeness (≥ 90%) and abnormal scenario coverage (≥ 85%) were required. An early stopping mechanism was initiated when the composite metric improvement rate was less than 0.5% for 20 consecutive epochs, and the final optimized model, Case_Transformer-based, was output.
[0015] The present invention also discloses a test case generation method, which obtains the content of the system requirement specification manual of the model Case_Transformer-based by implementing the above-mentioned test case generation system construction method, obtains a complete list-form test case data set FinalTestCaseDataList from the aspects of product function, system compatibility, product performance, product usability, product reliability, product safety, and software maintainability, traverses the list-form test case data set FinalTestCaseDataList, writes the test case data set FinalTestCaseDataList in batches into a table-form file, and outputs a test case document table TestCaseDataList in a table format.
[0016] Compared with the prior art, the method of the present invention has the following advantages: (1) Improved the efficiency of test engineers in writing test cases and shortened the writing time.
[0017] (2) It can improve the clarity, accuracy and coverage of test case writing.
[0018] (3) It can reduce the impact of errors that may be caused by manual intervention. By designing test cases based on structured data, the ideas are clear and the regulations are clear, ensuring that all test points are fully covered without omissions.
[0019] (4) The file format is converted into a table format, which is convenient for importing into various systems and archiving for continued use as training data.
[0020] (5) The test case generation system construction method based on Transformer and multimodal data fusion constructed by the present invention is applicable to the general testing industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 This is an overall flow chart of the test case generation system construction method of an embodiment of the present invention.
[0022] Figure 2 This is a preprocessing flowchart of a test case generation system construction method according to an embodiment of the present invention.
[0023] Figure 3 The flowchart of the test case generation method according to the embodiment of the present invention is shown. DETAILED DESCRIPTION
[0024] In order to assist professionals in this field to have a deeper understanding of the present invention, the technical details of the present invention will be comprehensively and clearly explained below through specific embodiments and in conjunction with relevant drawings.
[0025] like Figure 1 As shown, a test case generation system construction method of this embodiment includes the following steps: Step 1: Normalize and standardize the system requirement specification, analyze and organize the content of the functional requirement module, and clean the data. Use multimodality to perform structured processing of requirement analysis and knowledge enhancement to obtain the structured function dataset Clean_Function_Dataset_List.
[0026] in accordance with Figure 2 Step 1 is further explained, which includes the following sub-steps: Normalize and standardize system requirement specifications. The standard for normalization and standardization is to segment content using specific keywords, such as system architecture, functional requirements, and non-functional requirements. Missing parameters are automatically marked with [UNK] placeholders. Contextual information is used to infer possible values for missing parameters. Duplicate descriptions are removed by calculating semantic similarity between adjacent paragraphs (cosine threshold > 0.7). For the images in the functional requirements section of the system requirements specification, we used Python's zipfile module to decompress the image files, performed perspective correction and adaptive binarization preprocessing with OpenCV, used the Paddle OCR tool for text recognition, adopted the improved Faster-ENMS algorithm to detect text areas in document images, and constructed a deformable convolution-based spatial transformer network (Deformable STN) for geometric correction. The formula is as follows: , Where W is the deformation field, p is the pixel coordinate, ∆p is the offset, STN is the spatial transformer network, and the spatial transformer network with parameter θ extracts features of image I. Based on the Paddle OCR tool, an adversarial training strategy is introduced to synthesize distorted samples through the generative adversarial network GAN. The formula is as follows: , Where G is the generator, D is the discriminator, z is the noise vector, L perceptual To achieve perceptual loss, we extract text with a confidence threshold ≥ 90% and establish a cross-modal attention alignment mechanism. The formula is as follows: , where q text is the text feature, k image is the image feature, d is the dimension, the corrected image feature is semantically aligned with the text feature, and the image recognition processing text list Image_OCR_Processing_Text_List=[Image1_data, Image2_data, Image3_data, ...,Imagen_data] is constructed, n∈[1,Imagen], where Imagen_data is the text content extracted by OCR processing from the nth image Imagen in the functional requirements section of the system requirements specification; The python-docx extension package is used to read the content of the system requirements specification and parse it into plain text format. The parsed images are automatically annotated with the [Image:Imagen] placeholder (Imagen is the nth image in the functional requirements section of the system requirements specification). The extracted text content and the image recognition processing text list Image_OCR_Processing_Text_List are merged into a continuous text string ContinuousStrText; The bidirectional LSTM-CRF architecture is used for demand entity recognition. The formula is as follows: , Among them, βij is the attention weight of entity j to position i, k e j represents the unique identifier of entity j in the knowledge graph, W is the entity embedding mapping matrix, and N(i) represents the set of entities related to position i. The regular expression template is dynamically generated by the differentiable rule engine to achieve adaptive adjustment of the regular parameters. The formula is as follows: , Where T is the grammatical dependency tree of the input text, r is the generated regular expression component sequence, and W is the learnable parameter matrix. Then, using the regular expression dynamically generated by the reinforcement learning optimization strategy and the slicing technology, data is extracted and segmented from the continuous text string ContinuousStringText according to keywords. All the segmented data content is stored in the structured function dataset Clean_Function_Dataset_List=[data1, data2, data3, ..., datan], n∈[1,NewFunctionListLen]; The length of the structured function dataset Clean_Function_Dataset_List is recorded as NewFunctionListLen, the nth data item in the structured function dataset Clean_Function_Dataset_List is recorded as datan, and the format of the nth data item datan is {keyword:keyword value}. The regular expression can be adjusted according to the system requirements specification, for example: r"Functional requirements (.*?) non-functional requirements". The slicing can be adjusted according to the system requirements specification, for example: split(';'). The reinforcement learning optimization strategy formula is as follows: , Where s is the current regular expression pattern, α is the add / delete / modify operation (such as optimizing .* to \d+), R(s,α × ) = Coverage Gain × 10+ diversity score; Step 2: Design a feature abstraction architecture based on deep Transformer to obtain the semantic feature representation dataset Semantic_Feature_Representation_Dataset. This includes the following sub-steps: The Word2Vec model (word vector dimension 300, window size 12, negative sampling number 5) pre-trained based on the software domain requirement document corpus is used to perform preliminary embedding on the structured function dataset Clean_Function_Dataset_List, and a four-layer Transformer encoder is used to perform deep feature abstraction on the embedded vector. An 8-head attention mechanism, a hidden dimension of 512, and a feedforward layer dimension of 2048 are set for each layer. Dropout and LayerNormalization are introduced in the multi-head self-attention module. At the same time, the scaling parameter γ is configured to 0.1 and the dropout rate is configured to 0.3 to prevent overfitting and accelerate model convergence, thereby generating a high-order semantic feature representation dataset Semantic_Feature_Representation_Dataset with high generalization ability.
[0027] Step 3: Create a semantically guided test case template construction method to obtain the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile: Read the content of the semantic feature representation dataset Semantic_Feature_Representation_Dataset, format the data using the JSON extension package and regular expression technology according to the pre-defined label fields (module, test scenario, priority, precondition, input data, execution steps, expected results), finely classify the text, and intelligently supplement the implicit requirements of seven dimensions such as system compatibility and security (product function / performance / reliability / maintainability / security / usability / compatibility). Obtain the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile. The regular expression can be adjusted according to the format of datan, for example: r"(\w+):(\w+)"; Step 4: Preprocess the supplementary data content to obtain the structured data base test case framework dataset MindMap_BaseTestCase_Framework_DataFile: Preview the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile, and use the global semantic information captured by Transformer to perform preprocessing and supplement work on the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile, including product functions, system compatibility, product performance, product usability, product reliability, product security, and software maintainability, to obtain the structured data basic test case framework dataset MindMap_BaseTestCase_Framework_DataFile; Step 5: Establish a co-evolutionary mechanism for demand preprocessing and model training, achieve end-to-end joint optimization through a differentiable data processing pipeline, and obtain a Transformer-based model Case_Transformer-based: Using the structured data basic test case framework dataset, MindMap_BaseTestCase_Framework_DataFile, a dual-channel training system was constructed, with a parallel structured data processing channel and a text semantic processing channel. Requirements parsing parameters were simultaneously optimized during the model fine-tuning phase. A dynamic learning rate allocation strategy was implemented to ensure that the parameter update rate (η_ocr=5e-6) for normalization and standardization of the system requirements specification was lower than that of the four-layer Transformer encoder (η_main=2e-5). A cross-modal contrastive loss function was used to constrain the alignment of text and image features. An innovative requirements reconstruction and verification module was introduced, which reverse-mapped the test cases generated by the model into pseudo-requirements documents and calculated semantic fidelity (BLEU ≥ 0.65) with the original input. When generation errors caused by missing parameter annotations were detected, it automatically triggered iterative updates of the [UNK] placeholder completion rules. During training, a three-stage optimization strategy was implemented: For the first 3,000 iterations, fixed text cleaning rules were used to focus on developing feature extraction capabilities. For the next 5,000 iterations, the semantic similarity threshold parameter (dynamic range 0.65-0.75) was adjusted to enable adaptive deduplication. For the final 2,000 iterations, a closed-loop feedback channel was activated, inversely adjusting the multimodal fusion weights based on test case coverage (function point coverage ≥ 92%). A dual evaluation system was established: on the demand side, parameter annotation accuracy (≥ 95%) and document structure compliance (ISO29148 matching ≥ 98%) were monitored. On the use case side, boundary condition completeness (≥ 90%) and abnormal scenario coverage (≥ 85%) were required. An early stopping mechanism was initiated when the composite metric improvement rate was less than 0.5% for 20 consecutive epochs, and the final optimized model, Case_Transformer-based, was output.
[0028] like Figure 3 As shown, this embodiment introduces a method for constructing a test case generation system. The method also performs the above steps and further uses the Case_Transformer-based model to process the system requirements specification and output a test case document table TestCaseDataList in a tabular format. Specifically, the method includes the following sub-steps: Use the Case_Transformer-based model to process the content of the system requirement specification, and obtain a complete list-based test case dataset FinalTestCaseDataList from the aspects of product function, system compatibility, product performance, product usability, product reliability, product security, and software maintainability. Traverse the list-based test case dataset FinalTestCaseDataList, write the test case dataset FinalTestCaseDataList in batches into a table-based file, and output a test case document table TestCaseDataList in a table format.
[0029] The present invention provides a method for constructing a test case generation system. This method uses structured data to design test cases, ensuring clear and precise guidelines and comprehensive coverage of key test points. The system then converts the file format into a table format for easy system import and archiving as training data. This improves test case writing efficiency for test engineers, shortens writing time, and enhances the clarity and quality of test cases.
[0030] The above embodiments are intended only to illustrate the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Based on the technical concept proposed by the present invention, any non-substantial modification, extension, or substitution made to the specific implementation scheme should be deemed to fall within the scope of protection of the present invention as long as the changes do not deviate from the core technical solution of the present invention. The scope of protection of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for constructing a test case generation system, characterized in that: The following steps are included: Step 1: Normalize and standardize the system requirement specifications, analyze and clean the functional requirement module content, and use multimodality to perform structured processing of requirement analysis and knowledge enhancement to obtain the structured functional dataset Clean_Function_Dataset_List: Normalize and standardize the system requirements specification. For images in the functional requirements section of the system requirements specification, perform image file decompression, perspective correction, adaptive binarization preprocessing, and text recognition. Read the content of the system requirements specification and parse it into plain text format. Merge the extracted text content and the image recognition processing text list Image_OCR_Processing_Text_List into a continuous text string ContinuousStrText. Perform requirement entity recognition and dynamically generate regular expression templates through a differentiable rule engine to achieve adaptive adjustment of regular parameters. Then, use the regular expressions dynamically generated by the reinforcement learning optimization strategy and slicing technology to extract and segment data from the continuous text string ContinuousStringText based on keywords to obtain the structured function dataset Clean_Function_Dataset_List. Step 2: Design a feature abstraction architecture based on deep Transformer to obtain the semantic feature representation dataset Semantic_Feature_Representation_Dataset: The structured function dataset Clean_Function_Dataset_List is initially embedded using a Word2Vec model pre-trained on a corpus of software requirements documents. A four-layer Transformer encoder is then used to perform deep feature abstraction on the embedded vectors to generate the Semantic_Feature_Representation_Dataset. Step 3: Create a test case template construction method based on semantic guidance and obtain the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile: Read the content of the semantic feature representation dataset Semantic_Feature_Representation_Dataset, format the data using the JSON extension package and regular expression technology according to the pre-defined label fields, and obtain the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile; Step 4: Preprocess the supplementary data content to obtain the structured data base test case framework dataset MindMap_BaseTestCase_Framework_DataFile: Preview the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile, and use the global semantic information captured by Transformer to preprocess and supplement the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile to obtain the structured data basic test case framework dataset MindMap_BaseTestCase_Framework_DataFile; Step 5: Establish a co-evolutionary mechanism for demand preprocessing and model training, implement end-to-end joint optimization through a differentiable data processing pipeline, and obtain a Transformer-based model Case_Transformer-based: Use the structured data basic test case framework dataset MindMap_BaseTestCase_Framework_DataFile to build a dual-channel training system with parallel structured data processing channels and text semantic processing channels, and simultaneously optimize the requirement parsing parameters during the model fine-tuning stage; set a dynamic learning rate allocation strategy to make the parameter update rate of the system requirement specification for normalization and standardization lower than that of the four-layer Transformer encoder; establish a dual evaluation system to monitor parameter labeling accuracy ≥95% and document structure compliance ≥98% on the demand side; require boundary condition completeness ≥90% and abnormal scenario coverage ≥85% on the use case side; output the final optimized model Case_Transformer-based.
2. The test case generation system construction method according to claim 1, characterized in that: Step 1 also includes: Normalize and standardize system requirement specifications. The standards for normalization and standardization are defined as using specific keywords to segment content, automatically marking missing parameters with [UNK] placeholders, using contextual information to infer possible values for missing parameters, and removing duplicate descriptions by calculating semantic similarity between adjacent paragraphs. For the images in the functional requirements section of the system requirements specification, we used Python's zipfile module to decompress the image files, performed perspective correction and adaptive binarization preprocessing with OpenCV, used the Paddle OCR tool for text recognition, adopted the improved Faster-ENMS algorithm to detect text areas in document images, and constructed a Deformable STN based on convolution for geometric correction. The formula is: , Where W is the deformation field, p is the pixel coordinate, ∆p is the offset, STN is the spatial transformer network, and the spatial transformer network with parameter θ extracts features of image I. Based on the Paddle OCR tool, an adversarial training strategy is introduced to synthesize distorted samples through the generative adversarial network GAN. The formula is as follows: , Where G is the generator, D is the discriminator, z is the noise vector, L perceptual To achieve perceptual loss, we extract text with a confidence threshold ≥ 90% and establish a cross-modal attention alignment mechanism. The formula is as follows: , where q text is the text feature, k image is the image feature, d is the dimension, the corrected image feature is semantically aligned with the text feature, and the image recognition processing text list Image_OCR_Processing_Text_List=[Image1_data, Image2_data, Image3_data, ...,Imagen_data] is constructed, n∈[1,Imagen], where Imagen_data is the text content extracted by OCR processing from the nth image Imagen in the functional requirements section of the system requirements specification; Use the python-docx extension package to read the content of the system requirements specification and parse it into plain text format. The parsed images are automatically marked with the [Image:Imagen] placeholder, where Imagen is the nth image in the functional requirements section of the system requirements specification; Merge the extracted text content and the image recognition processing text list Image_OCR_Processing_Text_List into a continuous text string ContinuousStrText; The bidirectional LSTM-CRF architecture is used for demand entity recognition. The formula is as follows: , Among them, β ij is the attention weight of entity j to position i, k e j represents the unique identifier of entity j in the knowledge graph, W is the entity embedding mapping matrix, and N(i) represents the set of entities related to position i. The regular expression template is dynamically generated through the differentiable rule engine to achieve adaptive adjustment of the regular parameters. The formula is as follows: , Where T is the grammatical dependency tree of the input text, r is the generated regular expression component sequence, and W is the learnable parameter matrix; Then, using the regular expression dynamically generated by the reinforcement learning optimization strategy and the slicing technology, data is extracted and segmented from the continuous text string ContinuousStringText based on keywords; the regular expression formula is as follows: , Where s is the current regular expression pattern, α is the add / delete / modify operation (such as optimizing .* to \d+), R(s,α × ) = Coverage Gain × 10+ diversity score; Store all the segmented data contents into the structured function dataset Clean_Function_Dataset_List=[data1, data2, data3, ...,datan], n∈[1,NewFunctionListLen], and obtain the structured function dataset Clean_Function_Dataset_List; Among them, the length of the structured function dataset Clean_Function_Dataset_List is recorded as NewFunctionListLen, the nth data information in the structured function dataset Clean_Function_Dataset_List is recorded as datan, and the format of the nth data datan is {keyword:keyword value}.
3. The test case generation system construction method according to claim 2, characterized in that: Step 2 also includes: The pre-trained Word2Vec model is used to perform preliminary embedding on the structured function dataset Clean_Function_Dataset_List, and a four-layer Transformer encoder is used to perform deep feature abstraction on the embedded vector. An 8-head attention mechanism, a hidden dimension of 512, and a feedforward layer dimension of 2048 are set for each layer. Dropout and layer normalization are introduced in the 8-head self-attention module. At the same time, the scaling parameter γ is configured to 0.1 and the dropout rate is configured to 0.3 to generate the semantic feature representation dataset Semantic_Feature_Representation_Dataset.
4. The test case generation system construction method according to claim 3, characterized in that: Step 3 also includes: Read the content of the semantic feature representation dataset Semantic_Feature_Representation_Dataset, use the json extension package and regular expression technology to format the data according to the pre-defined label fields, perform fine classification of the text, supplement product functions, system compatibility, product performance, product usability, product reliability, product security, and software maintainability, and obtain the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile, where the regular expression can be adjusted according to the format of datan.
5. The test case generation system construction method according to claim 4, characterized in that: Step 5 also includes: Set a dynamic learning rate distribution strategy so that the parameter update rate of the OCR geometric correction network is η_ocr = 5e-6, and the main Transformer network is η_main = 2e-5.
6. The test case generation system construction method according to claim 5, characterized in that: Step 5 also includes: A requirement reconstruction and verification module is introduced to reversely map the test cases generated by the model into pseudo requirement documents, and calculate the semantic fidelity BLEU ≥ 0.65 with the original input. When a generation error caused by missing parameter annotations is detected, the iterative update of the [UNK] placeholder completion rule is automatically triggered.
7. The test case generation system construction method according to claim 1 or 6, characterized in that: Step 5 also includes: During the training process, a three-stage optimization strategy was implemented: the first 3,000 iterations fixed the text cleaning rules and focused on developing feature extraction capabilities; the middle 5,000 iterations opened the semantic similarity threshold parameter to 0.65-0.75, and enabled the adaptive deduplication mechanism; the last 2,000 iterations activated the closed-loop feedback channel, and reversely adjusted the multimodal fusion weights based on the test case coverage and function point coverage ≥92%.
8. The test case generation system construction method according to claim 7, characterized in that: Step 5 also includes: When the composite index improvement rate is less than 0.5% for 20 consecutive epochs, the early stopping mechanism is activated and the final optimized model Case_Transformer-based is output.
9. A test case generation method, characterized in that: By implementing the test case generation system construction method described in any one of claims 1 to 8, the model Case_Transformer-based processing system requirement specification content is obtained, and a complete list-form test case data set FinalTestCaseDataList is obtained from the aspects of product function, system compatibility, product performance, product usability, product reliability, product security, and software maintainability. The list-form test case data set FinalTestCaseDataList is traversed, and the test case data set FinalTestCaseDataList is batch-written into a table-form file, and a test case document table TestCaseDataList in a table format is output.
Citation Information
Patent Citations
Root Framework framework test case automatic generation method and system based on improved GPT2
CN116841893A
Test case generation method and device, terminal equipment and readable storage medium
CN117707922A
Text classification algorithm-based test case file generation and conversion system and construction method
CN117931680A
Software test case generation method and system based on bidirectional long and short memory algorithm
CN119669099A
Cited By
Software test expected result prediction method and system based on deep learning
CN121434100A
A Deep Learning-Based Method and System for Predicting Expected Results in Software Testing
CN121434100B
