Test case generation method, device, equipment and readable storage medium

By chunking and sensitivity analysis of the requirements documents, combining online and local big models to generate test cases, the problems of low data security and high cost in the financial industry are solved, and efficient and secure test case generation is achieved.

CN120277002BActive Publication Date: 2025-08-19CHANGJIANG SECURITIES
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510769842.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-10
Publication Date
2025-08-19
Estimated Expiration
2045-06-10

AI Technical Summary

Technical Problem

In the prior art, the financial industry has problems of low data security and high cost when using AI models to generate test cases. In particular, direct call to online models may lead to data privacy leakage and high costs.

Method used

By chunking the preset requirements documents based on natural language processing technology NLP and data sensitivity, multiple target requirements documents with different sensitivity are generated, and test cases are generated based on the sensitivity call online or local models, and finally the test cases are integrated to reduce costs on the basis of ensuring data security and compliance.

Benefits of technology

It realizes that on the premise of ensuring data security, effectively reduces the cost of test case generation, improves the efficiency and accuracy of test case generation, reduces manual intervention, and improves the reliability and security of the software system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120277002B_ABST
    Figure CN120277002B_ABST
Patent Text Reader

Abstract

A test case generation method, apparatus, device and readable storage medium relate to the field of software testing technology, including segmenting a preset requirement document based on natural language processing technology NLP and data sensitivity to generate multiple target requirement documents with different sensitivities; for each first target requirement document, calling an online large model or a local large model to generate at least one first test case for the first target requirement document; for each second target requirement document, calling a local large model to generate at least one second test case for the second target requirement document, wherein the sensitivity of the second target requirement document is greater than that of the first target requirement document; integrating all first test cases and second test cases to generate a target test case set corresponding to the preset requirement document. Through this application, the cost of generating test cases can be effectively reduced on the basis of ensuring data security and compliance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software testing technology, and in particular to a test case generation method, apparatus, device and readable storage medium. Background Art

[0002] The increasingly complex nature of the financial industry places extremely high demands on the reliability, security, and compliance of software systems, making testing crucial. With the development of artificial intelligence (AI) technology, the financial industry has begun exploring the use of large AI models to automatically generate test cases based on business requirements documents. This allows for convenient application in both manual and automated testing, reducing the time required to manually write cases and improving overall project testing efficiency.

[0003] Related technologies often rely on paid online large-scale models to generate test cases. However, financial business testing requires strict compliance with data privacy and laws and regulations. Directly invoking online models to generate test cases can lead to data privacy leaks. Furthermore, relying solely on paid models is expensive, hindering cost control. Therefore, reducing the cost of test case generation while ensuring data security and compliance is an urgent issue. Summary of the Invention

[0004] The present application provides a test case generation method, apparatus, device and readable storage medium, which can solve the technical problems in the prior art of low data security and high test case generation cost caused by the complete use of paid online large models to generate test cases.

[0005] In a first aspect, an embodiment of the present application provides a test case generation method, the test case generation method comprising:

[0006] Based on natural language processing (NLP) technology and data sensitivity, the preset requirement document is segmented to generate multiple target requirement documents with different sensitivities.

[0007] For each first target requirement document, calling an online large model or a local large model to generate at least one first test case for the first target requirement document;

[0008] For each second target requirement document, calling the local large model to generate at least one second test case for the second target requirement document, where the sensitivity of the second target requirement document is greater than that of the first target requirement document;

[0009] All first test cases and second test cases are integrated to generate a target test case set corresponding to the preset requirement document.

[0010] In conjunction with the first aspect, in one embodiment, calling the online large model or the local large model to generate a first test case for the first target requirement document includes:

[0011] When the sensitivity of the first target requirement document is within a preset first sensitivity threshold range, calling the online large model to generate at least one first test case for the first target requirement document;

[0012] When the sensitivity of the first target requirement document is within a preset second sensitivity threshold range, calculating a target difference between the sensitivity and complexity of the first target requirement document, and calling an online large model or a local large model according to the target difference to generate at least one first test case for the first target requirement document;

[0013] The lower limit of the second sensitive threshold interval is greater than or equal to the upper limit of the first sensitive threshold interval.

[0014] In conjunction with the first aspect, in one embodiment, calling an online large model or a local large model according to the target difference to generate a first test case for a first target requirement document includes:

[0015] When the target difference is greater than or equal to 0, calling the local large model to generate at least one first test case for the first target requirement document;

[0016] When the target difference is less than 0, the online large model is called to generate at least one first test case for the first target requirement document.

[0017] In conjunction with the first aspect, in one embodiment, integrating all first test cases and second test cases to generate a target test case set corresponding to the preset requirement document includes:

[0018] Determine whether there is a test case with the same case name among all the first test cases and the second test cases;

[0019] If so, remove all test cases with the same case name from the first test cases and the second test cases, and generate a target test case set corresponding to the preset requirement document based on all test cases with different case names from the first test cases and the second test cases;

[0020] If not, a target test case set corresponding to the preset requirement document is generated based on all the first test cases and the second test cases.

[0021] In conjunction with the first aspect, in one embodiment, before the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity, the method further includes:

[0022] Determining whether the preset requirement document can be made public;

[0023] If yes, then executing the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity;

[0024] If not, the local big model is called to generate a target test case set for the preset requirement document.

[0025] In conjunction with the first aspect, in one embodiment, before the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity, the method further includes:

[0026] Perform semantic analysis on the initial requirements document based on NLP technology to extract target key information;

[0027] Perform key entity annotation on the initial requirement document using named entity recognition (NER) technology and the target key information to obtain a new requirement document;

[0028] Converting the new requirement document into a formatted requirement document according to a preset requirement document template;

[0029] The formatted requirement document is processed for terminology standardization and redundant content elimination based on a fuzzy matching algorithm and a text similarity algorithm to generate a preset requirement document.

[0030] In conjunction with the first aspect, in one embodiment, before the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity, the method further includes:

[0031] Desensitize the sensitive fields in the initial requirement document based on the field desensitization method and / or encryption desensitization algorithm to generate a preset requirement document.

[0032] In a second aspect, an embodiment of the present application provides a test case generation device, the test case generation device comprising:

[0033] A document segmentation module is used to segment the preset requirement document based on natural language processing (NLP) technology and data sensitivity to generate multiple target requirement documents with different sensitivities.

[0034] A first generating module, configured to call an online large model or a local large model to generate at least one first test case for each first target requirement document;

[0035] a second generating module configured to call the local large model to generate at least one second test case for each second target requirement document, wherein the sensitivity of the second target requirement document is greater than that of the first target requirement document;

[0036] The use case integration module is used to integrate all the first test cases and the second test cases to generate a target test case set corresponding to the preset requirement document.

[0037] In conjunction with the second aspect, in one embodiment, the first generating module is specifically configured to:

[0038] When the sensitivity of the first target requirement document is within a preset first sensitivity threshold range, calling the online large model to generate at least one first test case for the first target requirement document;

[0039] When the sensitivity of the first target requirement document is within a preset second sensitivity threshold range, calculating a target difference between the sensitivity and complexity of the first target requirement document, and calling an online large model or a local large model according to the target difference to generate at least one first test case for the first target requirement document;

[0040] The lower limit of the second sensitive threshold interval is greater than or equal to the upper limit of the first sensitive threshold interval.

[0041] In conjunction with the second aspect, in one embodiment, the first generating module is further configured to:

[0042] When the target difference is greater than or equal to 0, calling the local large model to generate at least one first test case for the first target requirement document;

[0043] When the target difference is less than 0, the online large model is called to generate at least one first test case for the first target requirement document.

[0044] In conjunction with the second aspect, in one embodiment, the use case integration module is specifically configured to:

[0045] Determine whether there is a test case with the same case name among all the first test cases and the second test cases;

[0046] If so, remove all test cases with the same case name from the first test cases and the second test cases, and generate a target test case set corresponding to the preset requirement document based on all test cases with different case names from the first test cases and the second test cases;

[0047] If not, a target test case set corresponding to the preset requirement document is generated based on all the first test cases and the second test cases.

[0048] In conjunction with the second aspect, in one embodiment, the document segmentation module is further configured to:

[0049] Determining whether the preset requirement document can be made public;

[0050] If yes, then executing the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity;

[0051] If not, the second generating module is enabled to call the local large model to generate a target test case set for the preset requirement document.

[0052] In conjunction with the second aspect, in one embodiment, the test case generating device further includes a preprocessing module, which is used to:

[0053] Perform semantic analysis on the initial requirements document based on NLP technology to extract target key information;

[0054] Perform key entity annotation on the initial requirement document using named entity recognition (NER) technology and the target key information to obtain a new requirement document;

[0055] Converting the new requirement document into a formatted requirement document according to a preset requirement document template;

[0056] The formatted requirement document is processed for terminology standardization and redundant content elimination based on a fuzzy matching algorithm and a text similarity algorithm to generate a preset requirement document.

[0057] In conjunction with the second aspect, in one embodiment, the preprocessing module is further configured to:

[0058] Desensitize the sensitive fields in the initial requirement document based on the field desensitization method and / or encryption desensitization algorithm to generate a preset requirement document.

[0059] In a third aspect, an embodiment of the present application provides a test case generation device, which includes a processor, a memory, and a test case generation program stored on the memory and executable by the processor, wherein when the test case generation program is executed by the processor, the steps of the aforementioned test case generation method are implemented.

[0060] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a test case generation program is stored, wherein when the test case generation program is executed by a processor, the steps of the test case generation method as described above are implemented.

[0061] The beneficial effects of the technical solutions provided in the embodiments of the present application include:

[0062] The preset requirement document is segmented by NLP technology and data sensitivity to generate multiple target requirement documents with different sensitivities, and the online big model or the local big model is called to generate the first test case for the first target requirement document with lower sensitivity, while the local big model is called to generate the second test case for the second target requirement document with higher sensitivity, so as to ensure data security and reduce costs; finally, all the first test cases and the second test cases are integrated to generate a target test case set corresponding to the preset requirement document. It can be seen that this application uses different big models to generate test cases for segmented documents with different sensitivities, without relying entirely on paid online big models, so as to effectively reduce the cost of test case generation while ensuring data security and compliance. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] Figure 1 This is a flow chart of an embodiment of the test case generation method of the present application;

[0064] Figure 2 For this application Figure 1 Detailed flow chart of step S20;

[0065] Figure 3 Generate a specific flow chart for the test cases involved in the embodiment of this application;

[0066] Figure 4 This is a functional module diagram of an embodiment of a test case generation device of the present application;

[0067] Figure 5 A schematic diagram of the hardware structure of the test case generation device involved in the embodiment of the present application. DETAILED DESCRIPTION

[0068] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0069] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0070] In a first aspect, an embodiment of the present application provides a test case generation method.

[0071] In one embodiment, referring to Figure 1 , Figure 1This is a flow chart of an embodiment of the test case generation method of this application. Figure 1 As shown, the test case generation method includes:

[0072] Step S10: Segment the preset requirement document based on natural language processing technology NLP and data sensitivity to generate multiple target requirement documents with different sensitivities.

[0073] For example, it should be noted that the preset requirement document refers to the document used to generate test cases. In this embodiment, NLP (Natural Language Processing) technology is used to segment the preset requirement document into blocks to ensure that the resulting text blocks contain complete semantic information. Specifically, document hard segmentation is first performed, that is, basic text segmentation technology is used to initially divide the preset requirement document into several small blocks of text according to natural paragraphs, chapter titles, or a fixed number of characters to ensure that the data can be efficiently processed by the system. However, since this is only a simple physical segmentation and does not consider the semantic integrity of the text, semantic incoherence may occur. Therefore, a context model is also required to determine whether consecutive texts belong to the same paragraph. If so, they are merged; if not, they are separated into separate blocks. Specifically, semantic similarity calculation and context understanding models can be used to detect the semantic connection between adjacent text blocks. By analyzing semantic relevance, referential relationships, and topic coherence, text segments that are physically separated but semantically closely connected are identified and merged into semantically complete units, thereby ensuring that each final text block contains complete and independent information.

[0074] A trained deep learning model (such as the BERT model) is then used to determine the data sensitivity of each text block. This sensitivity is then assigned to the corresponding text block to generate a target requirement document with sensitivity information. The sensitivity of different target requirement documents may or may not be the same. It should be noted that the methods and principles for calculating and determining the sensitivity of text blocks are common knowledge in the field and will not be elaborated here for the sake of brevity.

[0075] Furthermore, in one embodiment, before the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity, the method further includes:

[0076] Perform semantic analysis on the initial requirements document based on NLP technology to extract target key information;

[0077] Perform key entity annotation on the initial requirement document using named entity recognition (NER) technology and the target key information to obtain a new requirement document;

[0078] Converting the new requirement document into a formatted requirement document according to a preset requirement document template;

[0079] The formatted requirement document is processed for terminology standardization and redundant content elimination based on a fuzzy matching algorithm and a text similarity algorithm to generate a preset requirement document.

[0080] For example, it should be noted that the initial requirement document refers to the requirement document written by engineers based on the test requirements. However, different engineers may have different coding habits and methods, so that the same test requirements may also produce requirement documents in different formats, which will affect the accurate generation of test cases. It can be seen that standardization of requirement documents is a key step to improve the accuracy of test case generation. Therefore, this embodiment will use technical means to convert the requirement documents into a unified and structured format to enhance the AI model's ability to understand the document and significantly reduce the error rate of subsequent test case generation.

[0081] Specifically, NLP technology is first used to conduct a comprehensive semantic analysis of the initial requirements document to accurately extract target key information such as business logic, operation steps, input and output data, and constraints. This is then used to identify key entities based on this target key information to generate a new requirements document. This involves using syntactic analysis to decompose complex sentence structures. Based on this target key information and combined with NER (Named Entity Recognition) technology, the decomposition results are annotated with key entities (such as module names and operation actions). This is used to identify the actions, entities, and constraints involved in the requirements document, thereby providing core data for generating test cases. The unstructured or semi-structured new requirements document is then structured and parsed using a local large model using a pre-set requirements document template to generate a formatted requirements document. This ensures standardization and consistency of document input, eliminating the issue of inconsistent formats in manually written documents. The pre-set requirements document template specifies module names, operation descriptions, input and output definitions, functional constraints, and exception handling rules.

[0082] It should be noted that when implementing the standardization of requirement documents, terminology normalization can also be performed, that is, using a business dictionary or industry glossary to unify ambiguous or inconsistent terms appearing in the document to ensure accurate semantic expression and concise documents without losing important content; specifically, a terminology management system that includes a business dictionary and a standard glossary can be built, and the terms in the formatted requirement documents can be compared and replaced through a fuzzy matching algorithm to resolve ambiguous terminology expressions in the document and eliminate ambiguity, thereby ensuring consistency and accuracy of expression; in addition, text similarity algorithms (such as TF-IDF or similarity detection based on semantic vectors) can be used to automatically identify redundant content or repeated descriptions in formatted requirement documents, and mark or remove redundant content to retain the core information of the document, making it concise and easy for the model to understand.

[0083] It can be seen that this embodiment provides a clearer and more complete information source for the AI big model by standardizing the requirement document before calling the AI big model to generate test cases, so as to enhance the big model's understanding ability and processing efficiency, thereby improving the accuracy of generated test cases.

[0084] Furthermore, in one embodiment, before the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity, the method further includes:

[0085] Desensitize the sensitive fields in the initial requirement document based on the field desensitization method and / or encryption desensitization algorithm to generate a preset requirement document.

[0086] For example, in this embodiment, a document security algorithm will be enabled to protect sensitive information through multi-layer technical means. That is, before the demand document enters the AI big model, the demand document will first be pre-processed using desensitizing technology to achieve data security protection. It should be noted that this embodiment may preferably use field desensitization and / or encryption desensitization as desensitization methods to achieve sensitive information protection; wherein, field desensitization refers to automatically identifying sensitive data (such as ID number, account information, transaction amount, etc.) in the requirement document through regular expressions, and using randomly generated placeholders, masks or false data to replace the original values, such as using placeholders (such as "****1234") or false data to replace real data, and using tools for generating virtual data such as the Faker library in Python to generate false data that meets the format requirements, so as to retain the original meaning of the field while outputting the requirement document, thereby avoiding desensitization affecting model understanding; encryption desensitization refers to using symmetric encryption algorithms (such as AES) to encrypt data in the requirement document (such as personal identity information and encryption keys, etc., involving highly sensitive fields) and store the encryption keys locally to ensure the security of the desensitization process, and when necessary, use the local key decryption mechanism to restore sensitive information, thereby ensuring the business continuity of the system.

[0087] In this embodiment, a hierarchical desensitization strategy can be applied according to the sensitivity of different contents in the demand document: highly sensitive data is fully desensitized or encrypted, medium sensitive data is partially masked, and low sensitive data retains the original content for analysis. Specifically, regular expressions or sensitive information detection tools can be used to scan the fields in the demand document to identify sensitive data such as ID card numbers, bank card numbers, and mobile phone numbers, and the sensitive data can be classified and marked according to a predefined list of sensitive data types to obtain high, medium, and low sensitivity data. It should be noted that the above is only a presentation of the embodiment, and the classification of sensitive data can also be adaptively adjusted according to actual needs; among them, for the identified low-sensitivity fields, it is possible to choose not to perform data desensitization processing, for medium-sensitive fields, field desensitization or encryption desensitization can be used alone to perform data desensitization, and for highly sensitive fields, field desensitization and encryption desensitization can be combined to achieve data desensitization.

[0088] It should be understood that if data desensitization is performed before document standardization, the sensitive fields in the initial requirement document are directly desensitized through field desensitization and / or encryption desensitization to generate a preset requirement document; and if data desensitization is performed after document standardization, the requirement document that has been standardized is desensitized through field desensitization and / or encryption desensitization to generate a preset requirement document.

[0089] Step S20: For each first target requirement document, call the online big model or the local big model to generate at least one first test case for the first target requirement document.

[0090] Exemplarily, in this embodiment, the first target requirement document refers to a requirement document with relatively low sensitivity, and the second target requirement document refers to a requirement document with relatively high sensitivity, wherein the boundary thresholds of the two can be determined according to actual needs and are not limited here; for example, assuming the percentage system is used as an example and 60 is used as the boundary threshold, the target requirement document with a sensitivity less than 60 is considered to be the first target requirement document, and the target requirement document with a sensitivity greater than or equal to 60 is considered to be the second target requirement document.

[0091] It should be understood that for the first target requirement document with relatively low sensitivity, this embodiment can generate the first test case for it by calling the online large model to improve the accuracy of the test case; of course, it can also generate the first test case for it by calling the local large model to reduce the cost of generating the test case. It should be noted that whether it is an online large model or a local large model, the architecture of the two can be the same or different, and the specific method can be determined according to actual needs. The method and principle of how to generate test cases through the large model are common knowledge in this field, so for the sake of brevity, they will not be repeated here; among them, the generation capability and accuracy of the local large model can be continuously optimized by fine-tuning the model and feedback mechanism.

[0092] It should be understood that since a target requirement document may contain multiple functional code blocks, the large model usually generates multiple test cases for the target requirement document, that is, the number of test cases corresponding to a target requirement document is related to the number of functional code blocks it contains.

[0093] Further, see Figure 2 As shown, calling the online large model or the local large model to generate a first test case for the first target requirement document includes:

[0094] Step S201: When the sensitivity of the first target requirement document is within a preset first sensitivity threshold range, calling the online large model to generate at least one first test case for the first target requirement document;

[0095] Step S202: When the sensitivity of the first target requirement document is within a preset second sensitivity threshold range, a target difference between the sensitivity and complexity of the first target requirement document is calculated, and an online large model or a local large model is called according to the target difference to generate at least one first test case for the first target requirement document;

[0096] The lower limit of the second sensitive threshold interval is greater than or equal to the upper limit of the first sensitive threshold interval.

[0097] For example, in order to better balance data security and the accuracy of test case generation, this embodiment will also take the task characteristics corresponding to the requirements document (such as task complexity and task coverage, etc.) as one of the reference factors for calling the large model; among them, for the calculation of complexity, the number of functional points, logical branches, input and output conditions and other structural elements in the requirements document can be used as indicators of statistical complexity, and weights are assigned to different indicators, and then weighted processing is performed to generate a complexity score; of course, complexity calculation can also be completed in other ways, which are not limited here.

[0098] In this embodiment, the first target requirement document with relatively low sensitivity can be further distinguished by setting different sensitive threshold intervals. For example, the first sensitive threshold interval is set to determine whether the first target requirement document has low sensitivity, and the second sensitive threshold interval is set to determine whether the first target requirement document has medium sensitivity. It should be noted that the upper and lower limit values of the first sensitive threshold interval and the second sensitive threshold interval can be determined according to actual needs and are not limited here, as long as the lower limit value of the second sensitive threshold interval is greater than or equal to the upper limit value of the first sensitive threshold interval. For example, taking the percentage system as an example, the first sensitive threshold interval can be set to [0,30) and the second sensitive threshold interval can be set to [30,60).

[0099] Among them, when the sensitivity of the first target requirement document is within the first sensitive threshold range, it means that the sensitivity of the first target requirement document is very low and no more data security protection measures are required. At this time, in order to effectively improve the accuracy of its test case generation, the online large model will be directly called to generate the first test case for it. When the sensitivity of the first target requirement document is within the second sensitive threshold range, it means that the sensitivity of the first target requirement document is moderate. At this time, a suitable large model can be selected for it based on the two aspects of data security and test case generation accuracy. Specifically, the target difference between the sensitivity and complexity of the first target requirement document can be calculated to measure whether data security or test case generation accuracy is the priority through the size of the target difference. If data security is the priority, the local large model will be called to generate the first test case for it, otherwise the online large model will be called to generate the first test case for it.

[0100] Furthermore, in one embodiment, calling the online large model or the local large model according to the target difference to generate a first test case for the first target requirement document includes:

[0101] When the target difference is greater than or equal to 0, calling the local large model to generate at least one first test case for the first target requirement document;

[0102] When the target difference is less than 0, the online large model is called to generate at least one first test case for the first target requirement document.

[0103] For example, in this embodiment, if the target difference between the sensitivity and complexity of the first target requirement document is greater than or equal to 0, it means that its sensitivity is higher than its complexity, and data security needs to be given priority, that is, a more secure test case generation environment needs to be provided for it. Therefore, this embodiment will generate the first test case for it by calling the local large model to ensure its data security.

[0104] It is understandable that, since financial business test scenarios are often more complex, the local large model may return test cases with errors or inaccuracies, so that the test cases cannot be used directly and need to be manually reviewed later, which will not only result in high costs but also will not significantly improve test efficiency. In this embodiment, the online large model is called to handle complex scenarios or generate high-quality test cases while ensuring data desensitization. Specifically, if the target difference between the sensitivity and complexity of the first target requirement document is less than 0, indicating that its complexity is higher than its sensitivity, then the accuracy of test case generation needs to be given priority on the basis of data desensitization, that is, it is necessary to provide it with a more accurate test case generation environment. Therefore, this embodiment will generate the first test case for it by calling the online large model to improve the accuracy of test case generation, and then avoid manual review, thereby solving the problems of high cost and low efficiency caused by manual review.

[0105] Step S30: For each second target requirement document, call the local large model to generate at least one second test case for the second target requirement document, where the sensitivity of the second target requirement document is greater than that of the first target requirement document.

[0106] For example, in this embodiment, for the second target requirement document with relatively high sensitivity, a higher security level environment will be provided to generate test cases, that is, the local large model will be directly called to generate the second test case for it, so as to avoid the impact of security risks existing in the online network on its security, thereby effectively improving data security.

[0107] Step S40: Integrate all first test cases and second test cases to generate a target test case set corresponding to the preset requirement document.

[0108] For example, in this embodiment, the test cases output by the online large model are integrated with the test cases generated by the local large model, that is, the first test cases corresponding to all the first target requirement documents and the second test cases corresponding to all the second target requirement documents are merged to generate a target test case set corresponding to the preset requirement document, so as to improve the coverage and generation quality of the test cases, and the target test case set is stored for direct use by manual testing or automated testing. It should be noted that this embodiment can also check whether the generated test cases comply with the logic and constraints of the requirement documents, provide feedback on unqualified test cases and re-optimize them to further improve the accuracy of the test cases.

[0109] It can be seen that in this embodiment, for a preset requirement document, the paid online big model is not used entirely to generate test cases for it. Instead, it is divided according to sensitivity and complexity, and the local big model is called to generate test cases for the parts with high sensitivity and moderate sensitivity and low complexity, and the online big model is directly called to generate test cases for the parts with low sensitivity. For the parts with moderate sensitivity but high complexity, the parts are first aligned and desensitized before calling the online big model to generate test cases, so as to effectively reduce the cost of generating test cases while ensuring data security and compliance. In general, this embodiment provides a solution for calling multiple models to improve the effectiveness of AI-generated test cases, so as to ensure the security and compliance of business requirement documents, increase the coverage of test cases and improve the accuracy of generated test cases, which can effectively reduce manual intervention, ensure test quality, and thus improve the reliability and security of software systems.

[0110] Furthermore, in one embodiment, the integrating of all first test cases and second test cases to generate a target test case set corresponding to the preset requirement document includes:

[0111] Determine whether there is a test case with the same case name among all the first test cases and the second test cases;

[0112] If so, remove all test cases with the same case name from the first test cases and the second test cases, and generate a target test case set corresponding to the preset requirement document based on all test cases with different case names from the first test cases and the second test cases;

[0113] If not, a target test case set corresponding to the preset requirement document is generated based on all the first test cases and the second test cases.

[0114] For example, it should be understood that because the same functional code block may appear repeatedly in different locations within a preset requirements document, different target requirements documents may contain the same functional code block, resulting in the online large model and the local large model themselves potentially outputting the same test case, and the online large model may also output the same test case as the local large model. Therefore, when integrating the test cases output by the online large model and the local large model, this embodiment needs to eliminate redundant test cases to ensure the uniqueness and comprehensiveness of the output.

[0115] Specifically, since the test case corresponding to each functional code block has a unique case name, this embodiment will use the case name to determine whether there are identical test cases between the first test cases, the second test cases, and the first test case and the second test case; if they exist, that is, there are at least two test cases with the same case name, then these test cases are characterized as redundant test cases, and one of the test cases is retained, and the other redundant test cases are eliminated, and then the target test case set is constructed based on the remaining test cases with different case names; and if they do not exist, that is, the case names of all test cases are different, indicating that there are no redundant test cases, then the target test case set is directly constructed based on all test cases.

[0116] Furthermore, in one embodiment, before the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity, the method further includes:

[0117] Determining whether the preset requirement document can be made public;

[0118] If yes, then executing the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity;

[0119] If not, the local big model is called to generate a target test case set for the preset requirement document.

[0120] For example, in this embodiment, a trained deep learning model such as BERT can be used to determine whether the text in the preset requirement document contains sensitive information (such as whether it involves security issues) and calculate the probability of containing sensitive information (i.e., the probability of insecurity); if the probability exceeds a preset probability threshold (e.g., 50%), it is considered that it should not be disclosed, that is, if it is disclosed, its security will be threatened. Therefore, in order to avoid this problem, this embodiment will directly call the local big model to generate a target test case set for it to ensure data security; however, if the probability does not exceed the preset probability threshold, it is considered that it can be disclosed, and then a suitable online big model or local big model can be selected for it according to the specific sensitivity and complexity to generate a target test case set, so as to effectively reduce the cost of test case generation while ensuring data security and compliance.

[0121] It can be seen that this embodiment further improves the effectiveness of large-scale model generation test cases through strategies such as standardized processing of requirement documents, activation of document security algorithms, and multi-model calling, and reduces manual intervention to reduce testing costs and improve testing efficiency. Among them, standardized processing of requirement documents solves the problem of low accuracy of model return data caused by non-standard test documents; activation of document security algorithms solves the problem of data privacy leakage, and multi-model calling solves the problem of narrow coverage and low efficiency of a single test model. In summary, this embodiment significantly improves the effectiveness of test cases and provides strong support for technological innovation and application practice in the field of financial testing.

[0122] The following combination Figure 3 Describe the test case generation process and method.

[0123] The test engineer logs in to the test platform website and uploads the initial requirement document corresponding to the test requirements provided by the product manager on the AI case generation interface to standardize the initial requirement document and perform data security protection processing to generate a preset requirement document; secondly, it can be judged whether the preset requirement document is executed for the first time based on whether the test requirement is recorded in the log. If not, the correspondence between the test requirement recorded in the log and the historically used big model can be used to select the big model corresponding to the test requirement to generate a test case for the preset requirement document; if so, it is necessary to further determine whether the preset requirement document can be made public. If not, only the local big model can be selected to ensure document security; if it can be made public, the preset requirement document is segmented according to sensitivity to select the local big model or the online big model based on the segmentation results.

[0124] The requirements document is then parsed to convert it into a standardized JSON data structure, which specifically includes the following key information: product identifier, first-level menu name, function point name, and requirement content. The selected model parameters and the parsed document JSON data string are then input through the API provided by the large model management platform. The corresponding large model is then called and configured to generate a test case that meets the requirements according to the predefined prompt. The test case is encapsulated and returned in a standard JSON format, which includes the following key information: product, first-level menu name, function point name, case name, preconditions, test steps, and expected results. After receiving the JSON data, the back-end service parses it to generate an Excel file that conforms to the standard format and uploads it to the designated attachment storage center. The front-end returns a more intuitive interface displaying the test case details based on the interface. Furthermore, if you are not satisfied with the test cases generated for certain requirements, you can optimize the results by adding or modifying specific requirements and re-executing the model call process until the expected output is obtained. This iterative process can be repeated to ensure the accuracy and reliability of the results.

[0125] In summary, this embodiment addresses the problem of a single model failing to fully meet testing requirements by leveraging the collaborative work of a local and online large model. Taking both security and performance into consideration, the locally deployed large model is prioritized for processing requirement documents. While the local large model, due to its controlled deployment environment, can maximize data security, it may not fully cover complex scenarios due to model size limitations. To address this shortcoming, this embodiment introduces a more powerful online large model as a supplement. Specifically, the requirement document is divided into multiple parts. Based on the data's sensitivity, the highly sensitive parts that cannot be made public are processed by the local large model, while the publicly available parts are processed using the online large model to generate test cases. Furthermore, the scheduling system dynamically selects the appropriate model based on task characteristics (such as complexity and coverage). The generated test cases are also verified for logical and business consistency. Test cases that do not meet the requirements are fed back to the scheduling system for optimization of model invocation strategies. Furthermore, to avoid redundancy or conflict in test cases generated by multiple models, this embodiment integrates test cases using semantic analysis and similarity detection techniques to remove redundant cases and ensure unique and comprehensive output. This embodiment can significantly improve the accuracy and applicability of generated test cases through the above-mentioned multi-model collaboration approach, and ultimately improve the overall efficiency and quality of financial software testing.

[0126] In a second aspect, an embodiment of the present application also provides a test case generation device.

[0127] In one embodiment, referring to Figure 4 , Figure 4This is a functional module diagram of an embodiment of the test case generation device of this application. Figure 4 As shown, the test case generating device includes:

[0128] A document segmentation module is used to segment the preset requirement document based on natural language processing (NLP) technology and data sensitivity to generate multiple target requirement documents with different sensitivities.

[0129] A first generating module, configured to call an online large model or a local large model to generate at least one first test case for each first target requirement document;

[0130] a second generating module configured to call the local large model to generate at least one second test case for each second target requirement document, wherein the sensitivity of the second target requirement document is greater than that of the first target requirement document;

[0131] The use case integration module is used to integrate all the first test cases and the second test cases to generate a target test case set corresponding to the preset requirement document.

[0132] Furthermore, in one embodiment, the first generating module is specifically configured to:

[0133] When the sensitivity of the first target requirement document is within a preset first sensitivity threshold range, calling the online large model to generate at least one first test case for the first target requirement document;

[0134] When the sensitivity of the first target requirement document is within a preset second sensitivity threshold range, calculating a target difference between the sensitivity and complexity of the first target requirement document, and calling an online large model or a local large model according to the target difference to generate at least one first test case for the first target requirement document;

[0135] The lower limit of the second sensitive threshold interval is greater than or equal to the upper limit of the first sensitive threshold interval.

[0136] Furthermore, in one embodiment, the first generating module is further configured to:

[0137] When the target difference is greater than or equal to 0, calling the local large model to generate at least one first test case for the first target requirement document;

[0138] When the target difference is less than 0, the online large model is called to generate at least one first test case for the first target requirement document.

[0139] Furthermore, in one embodiment, the use case integration module is specifically configured to:

[0140] Determine whether there is a test case with the same case name among all the first test cases and the second test cases;

[0141] If so, remove all test cases with the same case name from the first test cases and the second test cases, and generate a target test case set corresponding to the preset requirement document based on all test cases with different case names from the first test cases and the second test cases;

[0142] If not, a target test case set corresponding to the preset requirement document is generated based on all the first test cases and the second test cases.

[0143] Furthermore, in one embodiment, the document segmentation module is further configured to:

[0144] Determining whether the preset requirement document can be made public;

[0145] If yes, then executing the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity;

[0146] If not, the second generating module is enabled to call the local large model to generate a target test case set for the preset requirement document.

[0147] Furthermore, in one embodiment, the test case generating device further includes a preprocessing module, which is used to:

[0148] Perform semantic analysis on the initial requirements document based on NLP technology to extract target key information;

[0149] Perform key entity annotation on the initial requirement document using named entity recognition (NER) technology and the target key information to obtain a new requirement document;

[0150] Converting the new requirement document into a formatted requirement document according to a preset requirement document template;

[0151] The formatted requirement document is processed for terminology standardization and redundant content elimination based on a fuzzy matching algorithm and a text similarity algorithm to generate a preset requirement document.

[0152] Furthermore, in one embodiment, the pre-processing module is further configured to:

[0153] Desensitize the sensitive fields in the initial requirement document based on the field desensitization method and / or encryption desensitization algorithm to generate a preset requirement document.

[0154] Among them, the functional implementation of each module in the above-mentioned test case generation device corresponds to the various steps in the above-mentioned test case generation method embodiment, and its functions and implementation processes are no longer repeated here.

[0155] In a third aspect, an embodiment of the present application provides a test case generation device, which may be a personal computer (PC), a laptop computer, a server, or other device with data processing capabilities.

[0156] Reference Figure 5 , Figure 5 Schematic diagram of the hardware structure of the test case generation device involved in the embodiment of the present application. In the embodiment of the present application, the test case generation device may include a processor, a memory, a communication interface and a communication bus.

[0157] The communication bus may be of any type and is used to interconnect the processor, memory, and communication interface.

[0158] Communication interfaces include input / output (I / O) interfaces, physical interfaces, and logical interfaces. These interfaces interconnect components within the test case generation device, as well as interfaces that connect the test case generation device to other devices (such as other computing devices or user equipment). Physical interfaces can include Ethernet, fiber, and ATM interfaces; user equipment can include displays and keyboards.

[0159] The memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0160] The processor may be a general-purpose processor that can call a test case generation program stored in a memory and execute the test case generation method provided in the embodiments of the present application. For example, the general-purpose processor may be a central processing unit (CPU). The method executed when the test case generation program is called can be referenced in the various embodiments of the test case generation method of the present application and will not be further described here.

[0161] Those skilled in the art will understand that Figure 5The hardware structure shown in the figure does not constitute a limitation to the present application and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0162] In a fourth aspect, an embodiment of the present application also provides a computer-readable storage medium.

[0163] The readable storage medium of the present application stores a test case generation program, wherein when the test case generation program is executed by a processor, the steps of the test case generation method as described above are implemented.

[0164] Among them, the method implemented when the test case generation program is executed can refer to the various embodiments of the test case generation method of this application, and will not be repeated here.

[0165] It should be noted that the serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0166] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices. The terms "first", "second" and "third" are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit the "first", "second" and "third" to different types.

[0167] In the description of the embodiments of this application, the words "exemplary," "for example," or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary," "for example," or "for example" in the embodiments of this application should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary," "for example," or "for example" is intended to present the relevant concepts in a concrete manner.

[0168] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.

[0169] In some processes described in the embodiments of the present application, multiple operations or steps are included that appear in a specific order. However, it should be understood that these operations or steps may not be performed in the order in which they appear in the embodiments of the present application or may be performed in parallel. The sequence numbers of the operations are only used to distinguish between different operations, and the sequence numbers themselves do not represent any order of execution. In addition, these processes may include more or fewer operations, and these operations or steps may be performed in sequence or in parallel, and these operations or steps may be combined.

[0170] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, or the part that contributes to the existing technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above and includes a number of instructions for enabling a terminal device to execute the methods described in each embodiment of this application.

[0171] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A test case generation method, characterized in that: The test case generation method comprises: Based on natural language processing (NLP) technology and data sensitivity, the preset requirement document is segmented to generate multiple target requirement documents with different sensitivities. For each first target requirement document, calling an online large model or a local large model to generate at least one first test case for the first target requirement document; For each second target requirement document, calling the local large model to generate at least one second test case for the second target requirement document, where the sensitivity of the second target requirement document is greater than that of the first target requirement document; Integrating all first test cases and second test cases to generate a target test case set corresponding to the preset requirement document; The calling of the online large model or the local large model to generate a first test case for the first target requirement document includes: When the sensitivity of the first target requirement document is within a preset first sensitivity threshold range, calling the online large model to generate at least one first test case for the first target requirement document; When the sensitivity of the first target requirement document is within a preset second sensitivity threshold range, calculating a target difference between the sensitivity and complexity of the first target requirement document, and calling an online large model or a local large model according to the target difference to generate at least one first test case for the first target requirement document; The lower limit of the second sensitive threshold interval is greater than or equal to the upper limit of the first sensitive threshold interval.

2. The test case generation method according to claim 1, wherein: The calling of the online large model or the local large model according to the target difference to generate a first test case for the first target requirement document includes: When the target difference is greater than or equal to 0, calling the local large model to generate at least one first test case for the first target requirement document; When the target difference is less than 0, the online large model is called to generate at least one first test case for the first target requirement document.

3. The test case generation method according to claim 1, wherein: The integrating all the first test cases and the second test cases to generate a target test case set corresponding to the preset requirement document includes: Determine whether there is a test case with the same case name among all the first test cases and the second test cases; If so, remove all test cases with the same case name from the first test cases and the second test cases, and generate a target test case set corresponding to the preset requirement document based on all test cases with different case names from the first test cases and the second test cases; If not, a target test case set corresponding to the preset requirement document is generated based on all the first test cases and the second test cases.

4. The test case generation method according to claim 1, wherein: Before the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity, the method further includes: Determining whether the preset requirement document can be made public; If yes, then executing the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity; If not, the local big model is called to generate a target test case set for the preset requirement document.

5. The test case generation method according to claim 1, wherein: Before the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity, the method further includes: Perform semantic analysis on the initial requirements document based on NLP technology to extract target key information; Perform key entity annotation on the initial requirement document using named entity recognition (NER) technology and the target key information to obtain a new requirement document; Converting the new requirement document into a formatted requirement document according to a preset requirement document template; The formatted requirement document is processed for terminology standardization and redundant content elimination based on a fuzzy matching algorithm and a text similarity algorithm to generate a preset requirement document.

6. The test case generation method according to claim 1, wherein: Before the step of segmenting the preset requirement document based on natural language processing technology NLP and data sensitivity, the method further includes: Desensitize the sensitive fields in the initial requirement document based on the field desensitization method and / or encryption desensitization algorithm to generate a preset requirement document.

7. A test case generating device, characterized in that: The test case generating device comprises: A document segmentation module is used to segment the preset requirement document based on natural language processing (NLP) technology and data sensitivity to generate multiple target requirement documents with different sensitivities. A first generating module, configured to call an online large model or a local large model to generate at least one first test case for each first target requirement document; a second generating module configured to call the local large model to generate at least one second test case for each second target requirement document, wherein the sensitivity of the second target requirement document is greater than that of the first target requirement document; A use case integration module, configured to integrate all first test cases and second test cases to generate a target test case set corresponding to the preset requirement document; The calling of the online large model or the local large model to generate a first test case for the first target requirement document includes: When the sensitivity of the first target requirement document is within a preset first sensitivity threshold range, calling the online large model to generate at least one first test case for the first target requirement document; When the sensitivity of the first target requirement document is within a preset second sensitivity threshold range, calculating a target difference between the sensitivity and complexity of the first target requirement document, and calling an online large model or a local large model according to the target difference to generate at least one first test case for the first target requirement document; The lower limit of the second sensitive threshold interval is greater than or equal to the upper limit of the first sensitive threshold interval.

8. A test case generation device, characterized in that: The test case generation device includes a processor, a memory, and a test case generation program stored in the memory and executable by the processor, wherein when the test case generation program is executed by the processor, the steps of the test case generation method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a test case generation program, wherein when the test case generation program is executed by a processor, the steps of the test case generation method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Document privacy security assessment method and device, equipment and medium

    CN116680743A

  • Test case generation method and device, terminal equipment and readable storage medium

    CN117707922A

  • Test case generation method, electronic equipment and storage medium

    CN119782173A