A test case generation system construction method and a test case generation method

By using Transformer-based multimodal data fusion technology, the efficiency and accuracy issues of test case generation in the system requirements specification of multimodal data are solved, achieving efficient and accurate test case generation and clear tabular output.

CN120670326BActive Publication Date: 2025-11-07NANJING DAHAN NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511180304.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-22
Publication Date
2025-11-07
Estimated Expiration
2045-08-22

AI Technical Summary

Technical Problem

Existing technologies struggle to efficiently and accurately generate test cases from system requirements specifications based on multimodal data, resulting in low test coverage and poor test case quality.

Method used

We employ a Transformer-based text classification and analysis algorithm, combined with multimodal data fusion technology. Through the normalization and standardization of the system requirements specification, we perform data cleaning and structuring. We utilize a deep Transformer model for feature abstraction and semantic feature representation, construct a test case generation system, and generate test cases through end-to-end model optimization.

Benefits of technology

It improves the efficiency and accuracy of test case generation, reduces errors caused by human intervention, ensures comprehensive coverage of test points, and outputs clear tabular test case documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120670326B_ABST
    Figure CN120670326B_ABST
Patent Text Reader

Abstract

The application discloses a test case generation system construction method, which comprises the following steps: performing data cleaning on a functional module part of a system requirement specification, obtaining a structured functional data set, performing format processing on the structured functional data set, obtaining a structured data test case framework template file, and preprocessing to obtain a structured data basic test case framework data set; and training a model based on a Transformer-based text classification analysis on the structured data basic test case framework data set. Through the method, a test case data set is obtained, test case content is supplemented, and a test case with a table format is output. The test case generation system construction method can improve the efficiency of writing test cases. The application further discloses a test case generation method.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of software testing, and particularly relates to a test case generation system construction method based on a Transformer and multi-modal data fusion. BACKGROUND

[0002] With the increasing size of software systems and the increasing complexity of applications, software testing work is facing unprecedented challenges. In the traditional software development process, the writing of test cases usually relies on manual extraction of function and business logic information from system requirement specifications. This method not only has a large workload and takes a long time, but also is prone to incomplete test coverage due to human oversight, thereby affecting the quality and stability of software products. At the same time, requirement specifications usually exist in the form of mixed text and images and other multi-modal forms, and manual identification and integration of these multi-modal information often has many uncertainties and difficulties, especially in structured expression and implicit requirement supplement.

[0003] In recent years, natural language processing technology and Transformer models based on deep learning have made remarkable achievements in semantic understanding and information extraction. At the same time, the development of multi-modal data fusion technology makes it possible to use both text and image information sources for more comprehensive and accurate requirement analysis. However, how to efficiently apply these advanced technologies to the construction of a system for automatically generating test cases is still a problem to be solved in the industry.

[0004] In the prior art, although some documents and methods have proposed text analysis of requirement documents, OCR image recognition, and semantic extraction schemes based on Transformers or other deep models, they are often independent of each other and difficult to achieve unified, efficient, and accurate information extraction and automatic test case generation for system requirement specifications containing multi-modal data. The traditional methods have limitations in processing requirement document standardization, missing parameter labeling, and implicit requirement recognition, and are prone to miss key test points, which cannot ensure test coverage and test case quality. SUMMARY

[0005] To solve the above technical problems, the application discloses a test case generation system construction method, 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 actual work.

[0006] To achieve the above purpose, the technical solution adopted by the application is as follows: a test case generation system construction method, the method comprising:

[0007] Step 1, normalize and standardize the system requirement specification, and analyze and clean the data of the functional requirement module content. Use multi-modal to analyze the requirements and enhance the knowledge of the structured processing, and get the structured function data set Clean_Function_Dataset_List:

[0008] The system requirement specification is normalized and standardized, and the standard for normalization and standardization is to use specific keywords to segment the content;

[0009] For the pictures in the system requirement specification, decompress the image file, correct the perspective and adaptively binarize the pre-processing, and perform text recognition to obtain the image recognition processing text;

[0010] Read the content of the system requirement specification and parse it into pure text format. The parsed pictures are automatically labeled with [Image:Imagen] placeholder, where Imagen is the nth picture in the functional requirement part of the system requirement specification. The extracted text content and image recognition processing text list Image_OCR_Processing_Text_List are merged into a continuous text string ContinuousStrText;

[0011] Use bidirectional LSTM-CRF architecture for requirement entity recognition, dynamically generate regular expression templates through differentiable rule engine, realize adaptive adjustment of regular parameters, then use the regular expression dynamically generated by reinforcement learning optimization strategy, and slice technology, extract and segment the data according to the keywords from the continuous text string ContinuousStringText, and store all the segmented data content in the structured function data set Clean_Function_Dataset_List=[data1, data2, data3,...,datan], n∈[1,NewFunctionListLen], get the structured function data set Clean_Function_Dataset_List.

[0012] Step 2, design a feature abstraction architecture based on deep Transformer, and get the semantic feature representation dataset Semantic_Feature_Representation_Dataset:

[0013] The structured function dataset Clean_Function_Dataset_List is preliminarily embedded by using a Word2Vec model pre-trained based on a software field requirement document corpus, and a four-layer Transformer encoder is used to abstract the embedded vectors in depth to generate a semantic feature representation dataset Semantic_Feature_Representation_Dataset with high generalization capability. The pre-trained Word2Vec model adopts a Skip-gram architecture, and the specific parameters are: word vector dimension 300, window size 12, and negative sampling number 5. The training process optimizes the word vector representation by minimizing the context prediction loss function. The model can map the text segments in the structured function dataset to low-dimensional vectors with domain semantic correlation, providing a basis for feature abstraction by the four-layer Transformer encoder.

[0014] Step 3, create a semantic guidance-based test case template construction method, and obtain a structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile:

[0015] Read the content in 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.

[0016] Step 4, pre-process the supplementary data content, and obtain a structured data basic test case framework dataset MindMap_BaseTestCase_Framework_DataFile:

[0017] Preview the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile, and use the global semantic information captured by the Transformer to pre-process 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.

[0018] Step 5, establish the co-evolution mechanism of requirement preprocessing and model training, realize end-to-end joint optimization through differentiable data processing pipeline, get a Transformer-based model Case_Transformer-based:

[0019] Using the structured data-based test case framework data set MindMap_BaseTestCase_Framework_DataFile to build a dual-channel training system with parallel structured data processing channels and text semantic processing channels, and synchronously optimizing the requirement analysis parameters in the model fine-tuning stage. Set the dynamic learning rate allocation strategy, so that the parameter update rate (η_ocr=5e-6) of the system requirement specification standardization and standardization processing is lower than that of the four-layer Transformer encoder (η_main=2e-5), and the text-image features are aligned by the cross-modal contrast loss function. Innovatively introduce the requirement reconstruction verification module, map the test cases generated by the model back to pseudo-demand documents, and calculate the semantic fidelity (BLEU≥0.65) with the original input. When detecting generation errors caused by missing parameter annotations, automatically trigger the iterative update of the [UNK] placeholder completion rule. Implement a three-stage optimization strategy during training: fix the text cleaning rules for the first 3000 iterations, focus on feature extraction capability training; open the semantic similarity threshold parameter (0.65-0.75 dynamic interval) for 5000 iterations in the middle, enable adaptive deduplication mechanism; activate the closed-loop feedback channel for the last 2000 iterations, adjust the multi-modal fusion weight according to the test case coverage (function point coverage≥92%). Establish a dual evaluation system to monitor the parameter annotation accuracy (≥95%) and document structure compliance (ISO29148 matching degree≥98%) on the demand side, and require boundary condition completeness (≥90%) and abnormal scenario coverage (≥85%) on the use case side. When the composite index improvement rate of the last 20 epochs is less than 0.5%, start the early stopping mechanism, and output the final optimized model Case_Transformer-based. An epoch represents the process of inputting the structured data-based test case framework data set (MindMap_BaseTestCase_Framework_DataFile) into the model for one forward propagation and backward optimization.

[0020] Further, step 1 further includes the following sub-steps:

[0021] The system requirement specification is standardized and standardized, and the standard for standardization and standardization is content segmentation using specific keywords, such as system architecture, functional requirements, non-functional requirements, automatic annotation of missing parameters [UNK] placeholder, using context information, guessing the possible value of the missing parameter, and removing repeated descriptions through adjacent paragraph semantic similarity calculation (cosine threshold > 0.7);

[0022] For the pictures in the functional requirements part of the system requirement specification, the zipfile module of Python is used to decompress the image file, perspective correction and adaptive binarization preprocessing are performed through OpenCV, Paddle OCR tool is used for text recognition, improved Faster-ENMS algorithm is used to detect the text area in the document image, and deformable convolution-based spatial transformation network (Deformable STN) is constructed for geometric correction, as follows:

[0023] ,

[0024] Where W is the deformation field, p is the pixel coordinate, Δp is the offset, STN is the spatial transformation network, and the parameter is the spatial transformation network of θ. The feature extraction of image I; On the basis of Paddle OCR tool, an adversarial training strategy is introduced, and a generative adversarial network GAN is used to synthesize distortion samples, as follows:

[0025] ,

[0026] Where G is the generator, D is the discriminator, z is the noise vector, L perceptual is the perception loss, so as to extract the text with confidence threshold ≥ 90%, establish a cross-modal attention alignment mechanism, as follows:

[0027] ,

[0028] Where q text is the text feature, k image is the image feature, and d is the dimension. The corrected image feature and the text feature are semantically aligned, 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 of the n-th picture Imagen in the functional requirements part of the system requirement specification.

[0029] The content in the system requirement specification is read and parsed into pure text format using the python-docx extension package, and the parsed images are automatically labeled with the [Image:Imagen] placeholder (Imagen is the nth image in the functional requirements section of the system requirement specification). The extracted text content and image recognition processing text list Image_OCR_Processing_Text_List are merged into a continuous text string ContinuousStrText.

[0030] The demand entity recognition is performed using a bidirectional LSTM-CRF architecture, and the formula is as follows:

[0031] ,

[0032] where β ij is the attention weight of entity j to position i, k e j represents the unique identifier of the entity in the knowledge graph, W is the entity embedding mapping matrix, and N(i) represents the set of entities related to position i; Regular expression templates are dynamically generated through a differentiable rule engine to achieve adaptive adjustment of regular parameters, and the formula is as follows:

[0033] ,

[0034] where T is the syntax dependency tree of the input text, r is the generated regular expression component sequence, W is the learnable parameter matrix, and then the regular expression generated by the reinforcement learning optimization strategy and the slicing technique are used to extract and segment data from the continuous text string ContinuousStringText according to the keywords, and all segmented data content is stored in the structured function dataset Clean_Function_Dataset_List=[data1, data2, data3,...,datan], n∈[1,NewFunctionListLen];

[0035] where the length of the structured function dataset Clean_Function_Dataset_List is denoted as NewFunctionListLen, the nth data information in the structured function dataset Clean_Function_Dataset_List is denoted as datan, and the format of the nth data datan is {keyword: keyword value}, the regular expression can be adjusted according to the system requirement specification, for example: r"function requirement(.*?)non-functional requirement", and the slicing can be adjusted according to the system requirement specification, for example: split(';'). The reinforcement learning optimization strategy formula is as follows:

[0036] ,

[0037] where s is the current regular expression pattern, a is the add / delete / modify operation (such as optimizing.* to \d+), R(s, a × )=coverage gain × 10+diversity score, and slicing technique, data extraction and segmentation according to keywords from continuous text string ContinuousStringText, and all segmented data contents are stored in structured function data set Clean_Function_Dataset_List=[data1, data2, data3,...,datan], n∈[1, NewFunctionListLen], to obtain structured function data set Clean_Function_Dataset_List; wherein the length of structured function data set Clean_Function_Dataset_List is denoted as NewFunctionListLen, the nth data information in structured function data set Clean_Function_Dataset_List is denoted as datan, the format of the nth data datan is {keyword: keyword value}, the regular expression can be adjusted according to the system requirement specification, for example: r"function requirement (.*?) non-functional requirement", and the slicing can be adjusted according to the system requirement specification, for example: split(';');

[0038] Further, step 2 includes the following sub-steps:

[0039] The pre-trained Word2Vec model is used to preliminarily embed the structured function data set Clean_Function_Dataset_List, and a four-layer Transformer encoder is used to abstract the embedding vector into deep features, each layer is set to 8 heads of attention mechanism, hidden dimension 512 and feedforward layer dimension 2048, Dropout (random inactivation) and Layer Normalization (layer normalization) are introduced in the multi-head self-attention module, and the scaling parameter γ is configured as 0.1 and the Dropout rate is 0.3, to prevent overfitting and accelerate model convergence, thereby generating a high-order semantic feature representation data set Semantic_Feature_Representation_Dataset with high generalization ability.

[0040] Further, step 3 includes the following sub-steps:

[0041] Read the content in the semantic feature representation dataset Semantic_Feature_Representation_Dataset, according to the pre-defined label fields (module, test scenario, priority, precondition, input data, execution step, expected result), use json extension package and regular expression technology for data format processing, fine classification of text, intelligent supplement of implicit requirements of 7 dimensions (product function / performance / reliability / maintainability / security / usability / compatibility), get structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile, wherein the regular expression can be adjusted according to the format of the data, for example: r"(\w+):(\w+)".

[0042] Further, step 4 includes the following sub-steps:

[0043] 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 of the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile, including product function, system compatibility, product performance, product usability, product reliability, product safety, and software maintainability, to obtain the structured data basic test case framework dataset MindMap_BaseTestCase_Framework_DataFile.

[0044] Further, step 5 includes the following sub-steps:

[0045] A double-channel training system is constructed using a structured data-based test case framework dataset MindMap_BaseTestCase_Framework_DataFile, and requirement analysis parameters are optimized synchronously in the model fine-tuning stage. A dynamic learning rate allocation strategy is set, so that the parameter update rate of the OCR geometric correction network (eta_ocr=5e-6) is lower than that of the main body Transformer network (eta_main=2e-5), and the text-image feature alignment degree is constrained through a cross-modal contrast loss function. A requirement reconstruction verification module is innovatively introduced, and the test cases generated by the model are reversely mapped into pseudo requirement documents, and the semantic fidelity (BLEU>=0.65) is calculated with the original input. When the generation error caused by the missing of the parameter label is detected, the iteration update of the [UNK] placeholder completion rule is automatically triggered. A three-stage optimization strategy is implemented during the training process: the text cleaning rule is fixed for the first 3000 iterations to focus on the feature extraction capability cultivation; the semantic similarity threshold parameter (0.65-0.75 dynamic interval) is opened for the middle 5000 iterations to enable the adaptive deduplication mechanism; and the closed-loop feedback channel is activated for the last 2000 iterations to reversely adjust the multi-modal fusion weight according to the test case coverage (function point coverage>=92%). A double evaluation system is established to monitor the parameter label accuracy (>=95%) and document structure compliance (ISO29148 matching degree>=98%) on the requirement side, and the boundary condition completeness (>=90%) and abnormal scene coverage (>=85%) on the use case side. When the composite index improvement rate of 20 consecutive epochs is less than 0.5%, the early stopping mechanism is started, and the final optimized model Case_Transformer-based is output.

[0046] The application further discloses a test case generation method, which comprises the following steps: processing the content of a system requirement specification of a model Case_Transformer-based obtained by implementing the test case generation system construction method, obtaining a complete test case dataset FinalTestCaseDataList in a list form from aspects of product function, system compatibility, product performance, product usability, product reliability, product safety and software maintainability, traversing the test case dataset FinalTestCaseDataList in a list form, and batch-writing the test case dataset FinalTestCaseDataList into a file in a table form, and outputting a test case document table TestCaseDataList in a table format.

[0047] Compared with the prior art, the method has the following advantages:

[0048] (1) The efficiency of test engineers in writing test cases is improved, and the writing time is shortened.

[0049] (2) Can improve the clarity, accuracy and coverage of test case writing.

[0050] (3) Can reduce the error influence caused by manual intervention, through structured data design test case, clear thinking, clear regulations, ensure the comprehensive coverage of each test point, and will not appear missing.

[0051] (4) The file format is converted into table format, which is convenient for importing various systems and archiving as training data for continuous use.

[0052] (5) The test case generation system construction method based on the fusion of Transformer and multi-modal data constructed by the application is suitable for the general testing industry. BRIEF DESCRIPTION OF DRAWINGS

[0053] Figure 1 The test case generation system construction method of the embodiment of the application is a whole flow chart.

[0054] Figure 2 The preprocessing flow chart of the test case generation system construction method of the embodiment of the application.

[0055] Figure 3 The flow chart of the test case generation method of the embodiment of the application. DETAILED DESCRIPTION

[0056] In order to assist the professionals in the art to understand the application more deeply, the technical details of the application will be fully and clearly described below through specific embodiments and in conjunction with the related drawings.

[0057] As shown in the figure, the test case generation system construction method of the embodiment includes the following steps: Figure 1 Step 1, the system requirement specification is standardized and standardized, and the functional requirement module content is analyzed and cleaned, and the multi-modal is used for requirement analysis and knowledge enhancement structure processing, and the structured function data set Clean_Function_Dataset_List is obtained.

[0058] According to

[0059] Further illustrate step 1, specifically including the following sub-steps: Figure 2

[0060] ​The system requirements specification is standardized and normalized. The standard for standardization and normalization is defined as using specific keywords to segment the content, such as system architecture, functional requirements, and non-functional requirements. Missing parameters are automatically marked with [UNK] placeholders. The possible values ​​of missing parameters are inferred by using context information. Duplicate descriptions are removed by calculating the semantic similarity between adjacent paragraphs (cosine threshold > 0.7).

[0061] For the images present in the functional requirements section of the system requirements specification, the image files were decompressed using Python's zipfile module, preprocessed with perspective correction and adaptive binarization using OpenCV, and text recognition was performed using Paddle OCR. An improved Faster-ENMS algorithm was employed to detect text regions in the document images. Finally, a Deformable STN-based spatial transformation network was constructed for geometric correction, as shown in the following formula:

[0062] ,

[0063] Where W is the deformation field, p is the pixel coordinate, ∆p is the offset, STN is the spatial transformation network, and the spatial transformation network with parameter θ extracts features from image I; an adversarial training strategy is introduced based on the Paddle OCR tool, and distorted samples are synthesized by a generative adversarial network (GAN), as shown in the following formula:

[0064] ,

[0065] Where G is the generator, D is the discriminator, z is the noise vector, and L is the noise vector. perceptual To perceive the loss, text with a confidence threshold ≥90% is extracted, and a cross-modal attention alignment mechanism is established, as shown in the following formula:

[0066] ,

[0067] Where q text For text features, k image Let d be the image feature and d be the dimension. Semantically align the corrected image features with the text features to construct an image recognition processing text list Image_OCR_Processing_Text_List=[Image1_data, Image2_data, Image3_data, ...,Imagen_data], where n∈[1,Imagen], and 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.

[0068] The system requirement specification content is read and parsed into pure text format using the python-docx extension package, and the parsed images are automatically labeled with the [Image:Imagen] placeholder (Imagen is the nth image in the functional requirements section of the system requirement specification). The extracted text content and image recognition processing text list Image_OCR_Processing_Text_List are merged into a continuous text string ContinuousStrText.

[0069] The demand entity recognition is performed using a bidirectional LSTM-CRF architecture, and the formula is as follows:

[0070] ,

[0071] where β 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; Regular expression templates are dynamically generated through a differentiable rule engine to achieve adaptive adjustment of regular parameters, and the formula is as follows:

[0072] ,

[0073] where T is the syntax dependency tree of the input text, r is the generated regular expression component sequence, W is the learnable parameter matrix, and then the regular expression generated by the reinforcement learning optimization strategy and the slicing technique are used to extract and segment data from the continuous text string ContinuousStringText according to the keywords, and all segmented data content is stored in the structured function dataset Clean_Function_Dataset_List=[data1, data2, data3,...,datan], n∈[1,NewFunctionListLen];

[0074] where the length of the structured function dataset Clean_Function_Dataset_List is denoted as NewFunctionListLen, the nth data information in the structured function dataset Clean_Function_Dataset_List is denoted as datan, and the format of the nth data datan is {keyword: keyword value}, the regular expression can be adjusted according to the system requirement specification, for example: r"function requirement(.*?)non-functional requirement", and the slicing can be adjusted according to the system requirement specification, for example: split(';'). The reinforcement learning optimization strategy formula is as follows:

[0075] ,

[0076] where s is the current regular expression pattern, a is an add / delete / modify operation (e.g. optimizing.* to \d+), R(s, a × )=coverage gain × 10+diversity score;

[0077] Step 2: Design a deep Transformer-based feature abstraction architecture to obtain a semantic feature representation dataset Semantic_Feature_Representation_Dataset. Specifically, the following sub-steps are included:

[0078] A Word2Vec model (word vector dimension 300, window size 12, negative sampling number 5) based on the software field requirement document corpus is used to preliminarily embed the structured functional dataset Clean_Function_Dataset_List, and a four-layer Transformer encoder is used to perform deep feature abstraction on the embedded vectors. Each layer is set to 8 heads of attention mechanism, hidden dimension 512, and feedforward layer dimension 2048. Dropout and LayerNormalization are introduced in the multi-head self-attention module, and the scaling parameter γ is set to 0.1 and the Dropout rate is set 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.

[0079] Step 3: Create a semantic-guided test case template construction method to obtain a structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile:

[0080] Read the content in the semantic feature representation dataset Semantic_Feature_Representation_Dataset, according to the pre-defined label fields (module, test scenario, priority, precondition, input data, execution step, expected result), use json extension package and regular expression technology for data format processing, fine classification of text, intelligent supplement of 7 dimensions of implicit requirements (product function / performance / reliability / maintainability / security / usability / compatibility), get structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile, wherein the regular expression can be adjusted according to the format of datan, for example: r"(\w+):(\w+)";

[0081] Step 4: Pre-process the supplementary data content to obtain the structured data basic test case framework dataset MindMap_BaseTestCase_Framework_DataFile:

[0082] 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 of the structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile, including product function, system compatibility, product performance, product usability, product reliability, product safety, and software maintainability, to obtain the structured data basic test case framework dataset MindMap_BaseTestCase_Framework_DataFile;

[0083] Step 5: Establish a co-evolution mechanism for requirement preprocessing and model training, and realize end-to-end joint optimization through a differentiable data processing pipeline to obtain a Transformer-based model Case_Transformer-based:

[0084] The structured data processing channel and the text semantic processing channel are constructed in parallel using the structured data base test case framework data set MindMap_BaseTestCase_Framework_DataFile to build a double-channel training system, and the demand analysis parameters are optimized synchronously in the model fine-tuning stage. A dynamic learning rate allocation strategy is set to make the parameter update rate (η_ocr=5e-6) of the system requirement specification standardization and standardization processing lower than that of the four-layer Transformer encoder (η_main=2e-5), and the alignment degree of the text-image features is constrained by the cross-modal contrast loss function. The demand reconstruction verification module is introduced innovatively, and the test case generated by the model is reversely mapped to the pseudo-demand document, and the semantic fidelity (BLEU≥0.65) is calculated with the original input. When the generation error caused by the missing parameter annotation is detected, the iteration update of the [UNK] placeholder completion rule is automatically triggered. A three-stage optimization strategy is implemented during the training process: the text cleaning rule is fixed for the first 3000 iterations to focus on the feature extraction capability cultivation; the semantic similarity threshold parameter (0.65-0.75 dynamic interval) is opened for the middle 5000 iterations, and the adaptive deduplication mechanism is enabled; the closed-loop feedback channel is activated for the last 2000 iterations, and the multi-modal fusion weight is adjusted reversely according to the test case coverage (function point coverage≥92%). A double evaluation system is established to monitor the parameter annotation accuracy (≥95%) and document structure compliance (ISO29148 matching degree≥98%) on the demand side, and the boundary condition completeness (≥90%) and abnormal scene coverage rate (≥85%) on the use case side. When the composite index improvement rate of 20 consecutive epochs is less than 0.5%, the early stopping mechanism is started, and the final optimized model Case_Transformer-based is output.

[0085] As Figure 3 shown, the embodiment introduces a test case generation system construction method: the above steps are also performed, further, the model Case_Transformer-based is used to process the system requirement specification content, and a test case document table TestCaseDataList with a table format is output. Specifically, it includes the following sub-steps:

[0086] The model Case_Transformer-based processing system requirement specification content is used to obtain a complete test case data set FinalTestCaseDataList in a list form from product functions, system compatibility, product performance, product usability, product reliability, product safety, and software maintainability, traverse the test case data set FinalTestCaseDataList in a list form, and write the test case data set FinalTestCaseDataList in batches into a table form file, and output a test case document table TestCaseDataList in a table format.

[0087] The test case generation system construction method provided by the embodiment of the application designs a test case through structured data, has a clear idea and clear regulation, ensures comprehensive coverage of various test points, and does not miss any point, then converts a file format into a table format, and is convenient for importing a system and archiving as training data for continuous use. The efficiency of a test engineer in writing a test case is improved, the writing time is shortened, and the clarity and quality of the test case are improved.

[0088] The above embodiments are only used for describing the technical idea of the application, and should not be regarded as limiting the protection scope of the application. Based on the technical idea of the application, any non-essential modification, expansion or replacement on a specific implementation scheme, as long as the variation does not deviate from the core technical scheme of the application, should be regarded as falling within the protection scope of the application. The protection scope of the application is defined by the appended claims and their equivalents.

Claims

1. A test case generation system construction method characterized by comprising: Comprising the following steps; Step 1, the system requirement specification is standardized and standardized, and the data analysis and data cleaning of the function requirement module content are carried out, and the multi-modal requirement analysis and knowledge enhancement structure is processed, and the structured function data set Clean_Function_Dataset_List is obtained: The system requirement specification is standardized and standardized, and the pictures in the function requirement part of the system requirement specification are decompressed, perspective correction, adaptive binary preprocessing, and text recognition; read the content of the system requirement specification and parse it into pure text format; the extracted text content and image recognition processing text list Image_OCR_Processing_Text_List are merged into a continuous text string ContinuousStrText; perform requirement entity recognition, dynamically generate regular expression templates through a differentiable rule engine, realize adaptive adjustment of regular parameters, then use the regular expression dynamically generated by the reinforcement learning optimization strategy, and slice technology, according to the key words from the continuous text string ContinuousStringText Data extraction and segmentation, get structured function data set Clean_Function_Dataset_List; Step 2, design a feature abstraction architecture based on deep Transformer, get semantic feature representation dataset Semantic_Feature_Representation_Dataset: Use the Word2Vec model pre-trained based on the software field requirement document corpus to preliminarily embed the structured function data set Clean_Function_Dataset_List, and use a four-layer Transformer encoder to perform deep feature abstraction on the embedded vector to generate a semantic feature representation dataset Semantic_Feature_Representation_Dataset; Step 3, create a test case template construction method based on semantic guidance, get structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile: Read the contents 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 field, and get 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 base test case framework dataset MindMap_BaseTestCase_Framework_DataFile; Step 5, establish a co-evolution mechanism for requirement preprocessing and model training, and realize end-to-end joint optimization through a differentiable data processing pipeline to obtain a Transformer-based model Case_Transformer-based: Use the structured data base test case framework dataset MindMap_BaseTestCase_Framework_DataFile to construct a dual-channel training system with parallel structured data processing channels and text semantic processing channels, and optimize the requirement analysis 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 standardization and standardization processing lower than the four-layer Transformer encoder; Establish a dual evaluation system, requiring parameter annotation accuracy ≥ 95% on the demand side and document structure compliance ≥ 98%; On the use case side, the boundary condition completeness ≥ 90%, and the abnormal scene coverage rate ≥ 85%; Output the final optimized model Case_Transformer-based.

2. The test case generation system construction method according to claim 1, wherein Step 1 also includes: The system requirement specification is standardized and standardized, and the standard for standardization and standardization processing is to use specific keywords to segment the content, automatically label [UNK] placeholders for missing parameters, use context information to infer possible values for missing parameters, and remove duplicate descriptions through adjacent paragraph semantic similarity calculation; For the pictures in the functional requirements part of the system requirement specification, use the zipfile module of Python to decompress the image file, perform perspective correction and adaptive binarization preprocessing through OpenCV, use Paddle OCR tool for text recognition, use the improved Faster-ENMS algorithm to detect the text area in the document image, and construct the spatial transformation network Deformable STN based on deformable convolution for geometric correction, formula: , Wherein W is the deformation field, p is the pixel coordinate, ∆p is the offset, STN is the spatial transformation network, and the parameter is the spatial transformation network of θ. The feature extraction of the image I; On the basis of Paddle OCR tool, the adversarial training strategy is introduced, and the distortion sample is synthesized 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 is the perceptual loss, so as to extract the text with a confidence threshold ≥ 90%, and a cross-modal attention alignment mechanism is established, and the formula is as follows: , wherein q text is a text feature, k image is an image feature, and d is a dimension. The corrected image feature is semantically aligned with the text feature, and an image recognition processing text list Image_OCR_Processing_Text_List=[Image1_data, Image2_data, Image3_data, …, Imagen_data] is constructed, n∈[1, Imagen], wherein Imagen_data is text content extracted by OCR processing of the nth picture Imagen in the functional requirement part of the system requirement specification. The content in the system requirement specification is read and parsed into pure text format by using the python-docx extension package, and the parsed images are automatically labeled with [Image:Imagen] placeholder, and Imagen is the nth image in the functional requirement part of the system requirement specification; The extracted text content and image recognition processing text list Image_OCR_Processing_Text_List are merged into a continuous text string ContinuousStrText; The demand entity recognition is carried out by using the bidirectional LSTM-CRF architecture, and the formula is as follows: , where β ij is the attention weight of entity j to position i, k e j denotes 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; a regular expression template is dynamically generated through a differentiable rule engine to realize adaptive adjustment of regular parameters, and the formula is as follows: , Wherein T is the syntax dependency tree of the input text, r is the generated regular expression component sequence, and W is the learnable parameter matrix; Then, the regular expression dynamically generated by the reinforcement learning optimization strategy and the slicing technology are used to extract and segment data from the continuous text string ContinuousStringText according to the keyword; The formula of the regular expression is as follows: , where s is the current regular expression pattern, a is an add / delete / modify operation, R(s, a) is the regular expression coverage gain × = coverage gain × 10 + diversity score; Store all the segmented data content in 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. Wherein, the length of the structured function dataset Clean_Function_Dataset_List is denoted as NewFunctionListLen, the nth data information in the structured function dataset Clean_Function_Dataset_List is denoted 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, wherein Step 2 also includes: The structured function dataset Clean_Function_Dataset_List is preliminarily embedded by using the pre-trained Word2Vec model, and the embedding vector is deeply abstracted by using the four-layer Transformer encoder, and each layer is set to 8 attention mechanisms, hidden dimension 512 and feedforward layer dimension 2048. In the 8-head self-attention module, random inactivation Dropout and layer normalization Layer Normalization are introduced, and the scaling parameter γ is set to 0.1 and the Dropout rate is set to 0.3, and the semantic feature representation dataset Semantic_Feature_Representation_Dataset is generated.

4. The test case generation system construction method according to claim 3, characterized by, Step 3 also includes: Read the content in the semantic feature representation dataset Semantic_Feature_Representation_Dataset, according to the pre-defined label field, use json extension package and regular expression technology for data formatting processing, fine classification of text, supplement product function, system compatibility, product performance, product usability, product reliability, product safety, software maintainability, get structured data test case framework template file MindMap_TestCase_Framework_TemplateDataFile, wherein 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 by, Step 5 further comprises: Set the dynamic learning rate allocation strategy, so that the parameter update rate of the OCR geometric correction network is η_ocr=5e-6, and the main body Transformer network is η_main=2e-5.

6. The test case generation system construction method according to claim 5, wherein Step 5 further comprises: Introduce the demand reconstruction verification module, map the test cases generated by the model back to the pseudo-demand document, and calculate the semantic fidelity BLEU≥0.65 with the original input. When detecting generation errors caused by missing parameter annotations, automatically trigger the iterative update of the [UNK] placeholder completion rule.

7. The test case generation system construction method according to claim 1 or 6, characterized by, Step 5 further comprises: Implement a three-stage optimization strategy during training: fix the text cleaning rules for the first 3000 iterations to focus on feature extraction capability training; open the semantic similarity threshold parameter for the middle 5000 iterations, with a semantic similarity threshold parameter of 0.65-0.75, and enable the adaptive deduplication mechanism; activate the closed-loop feedback channel for the last 2000 iterations, and adjust the multi-modal fusion weight according to the test case coverage function point coverage rate≥92%.

8. The test case generation system construction method according to claim 7, wherein, Step 5 further comprises: Start the early stopping mechanism when the composite index improvement rate is <0.5% for 20 consecutive epochs, and output the final optimized model Case_Transformer-based.

9. A test case generation method, characterized in that: The model Case_Transformer-based processes the system requirement specification content obtained by implementing the test case generation system construction method of any one of claims 1-8, and obtains a complete list of test case data sets FinalTestCaseDataList from product function, system compatibility, product performance, product usability, product reliability, product safety, and software maintainability. Traverse the list form of the test case data set FinalTestCaseDataList, and write the test case data set FinalTestCaseDataList in batches to the table form file, and output the test case document table TestCaseDataList with table format.

Citation Information

Patent Citations

  • Root Framework framework test case automatic generation method and system based on improved GPT2

    CN116841893A

  • Software test case generation method and system based on bidirectional long and short memory algorithm

    CN119669099A