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

By chunking and collaborating the preset demand documents and multi-model co-generating test cases, the problems of high cost and low security of online big model generation are solved, and efficient and secure test case generation is achieved in the financial industry.

CN120277002AActive Publication Date: 2025-07-08CHANGJIANG SECURITIES

Patent Information

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

AI Technical Summary

Technical Problem

In the prior art, using paid online models to generate test cases has problems such as low data security and high cost, and it is difficult to effectively reduce the cost of test cases generation while ensuring data security and compliance.

Method used

By chunking the preset requirements documents based on natural language processing technology and data sensitivity, multiple target requirements documents with different sensitivity are generated, and test cases are generated by combining online large models and local large models. After integration, it forms a collection of target test cases to avoid relying entirely on paid online large models.

Benefits of technology

On the basis of ensuring data security and compliance, the cost of generating test cases is reduced, the efficiency and accuracy of generating test cases is improved, manual intervention is reduced, and the reliability and security of the software system is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120277002A_ABST
    Figure CN120277002A_ABST
Patent Text Reader

Abstract

The invention discloses a test case generation method, device and equipment and a readable storage medium, and relates to the technical field of software testing, and the method comprises the steps: partitioning a preset demand document based on a natural language processing technology NLP and data sensitivity, so as to generate a plurality of target demand documents with different sensitivities; for each first target demand document, calling an online large model or a local large model to generate at least one first test case for the first target demand document; for each second target demand document, calling the local large model to generate at least one second test case for the second target demand document, the sensitivity of the second target demand document being greater than that of the first target demand document; and integrating all the first test cases and the second test cases to generate a target test case set corresponding to the preset demand document. According to the method and the device, the generation cost of the test case can be effectively reduced on the basis of ensuring the data security and compliance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] The business of the financial industry is becoming increasingly complex, with extremely high requirements for the reliability, security, and compliance of software systems. Therefore, the testing link is crucial. Among them, with the development of artificial intelligence (AI) technology, the financial industry has begun to explore methods for automatically generating test cases based on business requirement documents using AI large models, so as to be conveniently applied to manual testing and automated testing, thereby shortening the time for manually writing cases and improving the overall project testing efficiency.

[0003] In related technologies, test case generation is often achieved through paid online large models. However, financial business testing needs to strictly comply with data privacy and laws and regulations. Directly calling an online model to generate test cases may lead to data privacy leakage problems, and using only paid models also has the problem of high costs, which is not conducive to cost control. It can be seen that how to reduce the generation cost of test cases on the basis of ensuring data security and compliance is an urgent problem to be solved currently. Summary of the Invention

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

[0005] In a first aspect, an embodiment of this application provides a test case generation method, and the test case generation method includes: Based on natural language processing technology NLP and data sensitivity, the preset requirement document is segmented to generate multiple target requirement documents with different sensitivities; For each first target requirement document, an online large model or a local large model is called to generate at least one first test case for the first target requirement document; For each second target requirement document, a local large model is called to generate at least one second test case for the second target requirement document, and the sensitivity of the second target requirement document is greater than that of the first target requirement document; All the first test cases and second test cases are integrated to generate a target test case set corresponding to the preset requirement document.

[0006] In combination with the first aspect, in an implementation, the calling of an online large model or a 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, call 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, calculate the target difference between the sensitivity and complexity of the first target requirement document, and call the online large model or the local large model according to the target difference to generate at least one first test case for the first target requirement document; Among them, the lower limit value of the second sensitivity threshold range is greater than or equal to the upper limit value of the first sensitivity threshold range.

[0007] Combined with the first aspect, in an implementation manner, the 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: When the target difference is greater than or equal to 0, call 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, call the online large model to generate at least one first test case for the first target requirement document.

[0008] Combined with the first aspect, in an implementation manner, 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: Judge whether there are test cases with the same case name among all the first test cases and the second test cases; If so, eliminate the test cases with the same case name among all the first test cases and the second test cases, and generate a target test case set corresponding to the preset requirement document based on the test cases with different case names among all the first test cases and the second test cases; If not, generate a target test case set corresponding to the preset requirement document based on all the first test cases and the second test cases.

[0009] Combined with the first aspect, in an implementation manner, before the step of partitioning the preset requirement document based on the natural language processing technology NLP and data sensitivity, it further includes: Judge whether the preset requirement document can be made public; If so, execute the step of partitioning the preset requirement document based on the natural language processing technology NLP and data sensitivity; If not, call the local large model to generate a target test case set for the preset requirement document.

[0010] In combination with the first aspect, in one implementation, before the step of chunking the preset requirement document based on natural language processing technology NLP and data sensitivity, the following steps are further included: Semantically parse the initial requirement document based on NLP technology to extract target key information; Perform key entity annotation on the initial requirement document through named entity recognition technology NER and the target key information to obtain a new requirement document; Convert the new requirement document into a formatted requirement document according to a preset requirement document template; Perform term standardization processing and redundant content elimination processing on the formatted requirement document based on a fuzzy matching algorithm and a text similarity algorithm to generate a preset requirement document.

[0011] In combination with the first aspect, in one implementation, before the step of chunking the preset requirement document based on natural language processing technology NLP and data sensitivity, the following steps are further included: Perform desensitization processing on sensitive fields in the initial requirement document based on a field desensitization method and / or an encryption desensitization algorithm to generate a preset requirement document.

[0012] In the second aspect, an embodiment of the present application provides a test case generation device, and the test case generation device includes: A document chunking module, which is used to chunk a preset requirement document based on natural language processing technology NLP and data sensitivity to generate multiple target requirement documents with different sensitivities; A first generation module, which is used to call an online large model or a local large model for each first target requirement document to generate at least one first test case for the first target requirement document; A second generation module, which is used to call a local large model for each second target requirement document to generate at least one second test case for the second target requirement document, and the sensitivity of the second target requirement document is greater than that of the first target requirement document; A use case integration module, which 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.

[0013] In combination with the second aspect, in one implementation, the first generation module is specifically used for: When the sensitivity of the first target requirement document is within a preset first sensitivity threshold range, call 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, calculate the target difference between the sensitivity and complexity of the first target requirement document, and call 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; Wherein, the lower limit value of the second sensitivity threshold range is greater than or equal to the upper limit value of the first sensitivity threshold range.

[0014] Combined with the second aspect, in one implementation, the first generation module is further specifically configured to: When the target difference is greater than or equal to 0, call a 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, call an online large model to generate at least one first test case for the first target requirement document.

[0015] Combined with the second aspect, in one implementation, the use case integration module is specifically configured to: Determine whether there are test cases with the same case name among all the first test cases and the second test cases; If so, eliminate the test cases with the same case name among all the first test cases and the second test cases, and generate a target test case set corresponding to the preset requirement document based on the test cases with different case names among all the first test cases and the second test cases; If not, generate a target test case set corresponding to the preset requirement document based on all the first test cases and the second test cases.

[0016] Combined with the second aspect, in one implementation, the document chunking module is further configured to: Determine whether the preset requirement document can be made public; If so, perform the step of chunking the preset requirement document based on natural language processing technology NLP and data sensitivity; If not, enable the second generation module to call a local large model to generate a target test case set for the preset requirement document.

[0017] Combined with the second aspect, in one implementation, the test case generation device further includes a preprocessing module, which is used for: Perform semantic parsing on the initial requirement document based on NLP technology to extract target key information; Perform key entity annotation on the initial requirement document through named entity recognition technology NER and the target key information to obtain a new requirement document; Convert the new requirement document into a formatted requirement document according to a preset requirement document template; The formatted requirement document is processed for term standardization and redundant content removal based on a fuzzy matching algorithm and a text similarity algorithm to generate a preset requirement document.

[0018] In combination with the second aspect, in an implementation, the preprocessing module is further configured to: Desensitize sensitive fields in the initial requirement document based on a field desensitization method and / or an encryption desensitization algorithm to generate a preset requirement document.

[0019] 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. When the test case generation program is executed by the processor, the steps of the foregoing test case generation method are implemented.

[0020] 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. When the test case generation program is executed by a processor, the steps of the test case generation method as described above are implemented.

[0021] The beneficial effects brought by the technical solution provided by the embodiment of the present application include: The preset requirement document is segmented through NLP technology and data sensitivity to generate multiple target requirement documents with different sensitivities. An online large model or a local large model is called to generate a first test case for the first target requirement document with a lower sensitivity, and at the same time, a local large model is called to generate a second test case for the second target requirement document with a higher sensitivity 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 the present application generates test cases for segmented documents with different sensitivities using different large models, without completely relying on a paid online large model, so as to effectively reduce the generation cost of test cases on the basis of ensuring data security and compliance. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 It is a schematic flowchart of an embodiment of the test case generation method of the present application; Figure 2 For the present application Figure 1 It is a detailed flowchart of step S20 in the present application; Figure 3 It is a specific flowchart of test case generation involved in the solution of the embodiment of the present application; Figure 4 It is a schematic diagram of functional modules of an embodiment of the test case generation device of the present application; Figure 5This is a schematic diagram of the hardware structure of the test case generation device involved in the solution of the embodiment of the present application. Detailed implementation manners

[0023] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0024] To make the purpose, technical solution and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.

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

[0026] In one embodiment, referring to Figure 1 , Figure 1 This is a schematic flowchart of the embodiment of the test case generation method of the present application. As Figure 1 shown, the test case generation method includes: Step S10: Based on natural language processing technology NLP and data sensitivity, the preset requirement document is segmented to generate multiple target requirement documents with different sensitivities.

[0027] Exemplarily, it should be noted that the preset requirement document refers to the document for generating test cases; in this embodiment, the preset requirement document will be segmented through NLP (Natural Language Processing) technology to ensure that the text blocks obtained by segmentation all contain complete semantic information. Specifically, first perform hard document segmentation, that is, adopt basic text segmentation technology and initially cut the preset requirement document into several small pieces of text according to natural paragraphs, chapter titles or fixed character numbers to ensure that the data can be efficiently processed by the system; however, since it is only a simple physical segmentation without considering the semantic integrity of the text, there may be problems of semantic incoherence. Therefore, it is also necessary to judge whether the continuous text belongs to the same paragraph through the context model. If it belongs, merge it; if it does not belong, form a separate block; among them, specifically, semantic similarity calculation and context understanding model can be used to detect the semantic connection between adjacent text blocks, so as to identify those text fragments that are physically separated but semantically closely connected by analyzing semantic correlation, reference relationship and topic coherence, and merge them into semantic complete units, so as to ensure that each final text block contains complete and independent information.

[0028] Then, the data sensitivity of each text block is determined by the trained deep learning model (such as the BERT model), and this sensitivity is assigned to the corresponding text block to generate a target requirement document with sensitivity information. The sensitivities of different target requirement documents may be the same or different. It should be noted that the methods and principles for calculating and determining the sensitivity of text blocks are common knowledge in the art, so for the sake of simplicity of description, they will not be elaborated here.

[0029] Further, in one embodiment, before the step of dividing the preset requirement document based on natural language processing technology NLP and data sensitivity, the following steps are further included: Performing semantic parsing on the initial requirement document based on NLP technology to extract target key information; Performing key entity annotation on the initial requirement document through named entity recognition technology NER 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; Performing term standardization processing and redundant content elimination processing on the formatted requirement document based on a fuzzy matching algorithm and a text similarity algorithm to generate a preset requirement document.

[0030] Exemplarily, it should be noted that the initial requirement document refers to the requirement document written by engineers based on test requirements. However, the code writing habits and methods of different engineers may vary, so the same test requirements may be written into requirement documents in different formats, which will affect the accurate generation of test cases. It can be seen that standardizing the requirement document is a key step in improving the accuracy of generating test cases. Therefore, in this embodiment, the requirement document will be converted into a unified and structured format through technical means to enhance the understanding ability of the AI large model for the document and significantly reduce the error rate of subsequent test case generation.

[0031] Specifically, first, the NLP technology is 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 constraint conditions. Then, key entity identification is performed through the target key information to generate a new requirements document, that is, the complex sentence structure is decomposed through syntactic analysis technology, and based on the target key information and combined with NER (Named Entity Recognition) technology, key entities (such as module names, operation actions, etc.) are marked for the decomposition results to be used for the recognition of actions, entities, and constraints involved in the requirements document, thereby providing core basic data for generating test cases. Then, combined with the manually preset requirements document template, the local large model is used to perform structured parsing on the unstructured or semi-structured new requirements document to obtain a formatted requirements document to ensure the standardization and consistency of document input, thereby eliminating the problem of inconsistent manual writing formats. Among them, the preset requirements document template clearly defines module names, operation descriptions, input and output definitions, function constraints, and exception handling rules, etc.

[0032] It should be noted that when standardizing the requirements document, the normalization of terms can also be carried out, that is, the fuzzy or inconsistent terms appearing in the document are unified using a business dictionary or industry glossary to ensure accurate semantic expression and make the document concise without losing important content. Specifically, a term management system containing a business dictionary and a standard glossary can be constructed, and the terms in the formatted requirements document are compared and replaced through a fuzzy matching algorithm to solve the ambiguous term expressions in the document, eliminate ambiguity, and thus ensure the consistency and accuracy of the expression. In addition, text similarity algorithms (such as TF-IDF or semantic vector-based similarity detection, etc.) can also be used to automatically identify redundant content or repeated descriptions in the formatted requirements document, and mark or remove the redundant content to retain the core information of the document, making it refined and easy for the model to understand.

[0033] It can be seen that in this embodiment, by performing standardization processing on the requirements document before calling the AI large model to generate test cases, a relatively clear and complete information source is provided for the AI large model to enhance the understanding ability and processing efficiency of the large model, thereby improving the accuracy of generating test cases.

[0034] Furthermore, in one embodiment, before the step of partitioning the preset requirements document based on natural language processing technology NLP and data sensitivity, it further includes: Performing desensitization processing on sensitive fields in the initial requirements document based on field desensitization methods and / or encryption desensitization algorithms to generate a preset requirements document.

[0035] Exemplarily, in this embodiment, a document security algorithm will be enabled to protect sensitive information through multiple technical means. That is, before the requirement document enters the AI large model, the desensitization technology is first used to preprocess the requirement document to achieve data security protection. It should be noted that in this embodiment, field desensitization and / or encryption desensitization can be preferably used as the desensitization method to achieve sensitive information protection. Among them, field desensitization refers to automatically identifying sensitive data (such as ID numbers, account information, transaction amounts, etc.) in the requirement document through regular expressions, and replacing the original value with randomly generated placeholders, masks, or fake data. For example, using placeholders (such as "****1234") or fake data to replace the real data, and using tools for generating virtual data such as the Faker library in Python to generate fake data that meets the format requirements, so as to retain the original meaning of the field while outputting the requirement document, thus avoiding the impact of desensitization on model understanding. Encryption desensitization refers to using symmetric encryption algorithms (such as AES) to encrypt the data in the requirement document (such as fields involving high sensitivity such as personal identity information and encryption keys), and storing the encryption key locally to ensure the security of the desensitization process. And when necessary, the local key decryption mechanism can be used to restore the sensitive information, thus ensuring the business continuity of the system.

[0036] In this embodiment, a hierarchical desensitization strategy can be applied according to the sensitivity of different contents in the requirement document: high-sensitive data is fully desensitized or encrypted, medium-sensitive data is processed with partial masking, and low-sensitive data is retained in its original form for analysis. Specifically, regular expressions or sensitive information detection tools can be first used to scan the fields in the requirement document to identify sensitive data such as ID numbers, bank card numbers, and mobile phone numbers, and classify and mark the sensitive data according to a predefined list of sensitive data types to obtain high, medium, and low-sensitive data. It should be noted that the above is only the 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-sensitive fields, data desensitization processing can be optionally not performed. For medium-sensitive fields, field desensitization or encryption desensitization can be used alone for data desensitization. For high-sensitive fields, data desensitization can be jointly achieved by combining field desensitization and encryption desensitization.

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

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

[0039] 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. Among them, the boundary threshold between the two can be determined according to actual needs and is not limited herein. For example, assuming a percentage system and taking 60 as the boundary threshold, it is considered that the target requirement document with a sensitivity less than 60 is the first target requirement document, while the target requirement document with a sensitivity greater than or equal to 60 is the second target requirement document.

[0040] It should be understood that for the first target requirement document with relatively low sensitivity, in this embodiment, an online large model can be called to generate the first test case for it to improve the accuracy of the test case. Of course, a local large model can also be called to generate the first test case for it to reduce the generation cost of the test case. It should be noted that whether it is an online large model or a local large model, their architectures can be the same or different, which can be specifically determined according to actual needs. Moreover, the methods and principles of generating test cases through large models are common knowledge in the art. Therefore, for the sake of simplicity of description, they will not be elaborated herein. Among them, the generation ability and accuracy of the local large model can be continuously optimized through fine-tuning the model and the feedback mechanism.

[0041] 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.

[0042] Further, as shown in Figure 2 The calling of the online large model or the local large model to generate the first test case for the first target requirement document includes: Step S201: When the sensitivity of the first target requirement document is within a preset first sensitive threshold interval, call the online large model to generate at least one first test case for the first target requirement document; Step S202: When the sensitivity of the first target requirement document is within a preset second sensitive threshold interval, calculate the target difference between the sensitivity and the complexity of the first target requirement document, and call the online large model or the local large model to generate at least one first test case for the first target requirement document according to the target difference; Among them, 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.

[0043] Exemplarily, to better balance data security and the accuracy of test case generation, this embodiment will also use the task characteristics corresponding to the requirement document (such as task complexity and task coverage) as one of the reference factors for invoking the large model; among them, for the calculation of complexity, the number of function points, logical branches, input and output conditions and other structured elements in the requirement document can be used as the indicators for statistical complexity, and weights are assigned to different indicators, and then weighted processing is performed to generate a complexity score; of course, other methods can also be used to complete the complexity calculation, which is not limited here.

[0044] In this embodiment, for the first target requirement document with relatively low sensitivity, it can be further distinguished by setting different sensitive threshold intervals. For example, a first sensitive threshold interval is set to determine whether the first target requirement document belongs to low sensitivity, and a second sensitive threshold interval is set to determine whether the first target requirement document belongs to medium sensitivity; it should be noted that the specific values of the upper and lower limits of the first sensitive threshold interval and the second sensitive threshold interval can be determined according to actual needs, which 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 as [0, 30) and the second sensitive threshold interval can be set as [30, 60).

[0045] Among them, when the sensitivity of the first target requirement document is within the first sensitive threshold interval, it means that the sensitivity of the first target requirement document is very low, and no more data security protection measures need to be taken. At this time, in order to effectively improve the accuracy of its test case generation, the online large model will be directly invoked to generate the first test case for it. And when the sensitivity of the first target requirement document is within the second sensitive threshold interval, 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 both data security and the accuracy of test case generation; specifically, the target difference between the sensitivity and complexity of the first target requirement document can be calculated to measure whether data security or the accuracy of test case generation is the main focus through the size of the target difference; if data security is the main focus, the local large model is called to generate the first test case for it, otherwise the online large model is called to generate the first test case for it.

[0046] Furthermore, in one embodiment, the step of invoking an online large model or a local large model to generate a first test case for the first target requirement document according to the target difference includes: When the target difference is greater than or equal to 0, the local large model is called 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.

[0047] Exemplarily, 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, indicating that its sensitivity is higher than its complexity, then data security should be prioritized. That is, a test case generation environment with higher security needs to be provided for it. Therefore, in this embodiment, the first test case will be generated for it by calling the local large model to ensure the security of its data.

[0048] It can be understood that due to the complexity of financial business test scenarios, the local large model may return incorrect or inaccurate test cases, resulting in the inability to directly use these test cases and requiring later manual review. This not only causes high costs but also does not significantly improve test efficiency. In this embodiment, however, 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 on the basis of data desensitization, the accuracy of test case generation should be prioritized. That is, a test case generation environment with higher accuracy needs to be provided for it. Therefore, in this embodiment, the first test case will be generated for it by calling the online large model to improve the accuracy of test case generation, thereby avoiding manual review and solving the problems of high costs and low efficiency caused by manual review.

[0049] 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.

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

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

[0052] Exemplarily, 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 store the target test case set for direct use by manual testing or automated testing. It should be noted that this embodiment can also check whether the generated test cases meet the logic and constraints of the requirement documents, provide feedback and re-optimize the unqualified test cases, so as to further improve the accuracy of the test cases.

[0053] 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, but it is divided according to sensitivity and complexity, so that 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 online big model is first aligned for desensitization processing and then called to generate test cases, so as to effectively reduce the cost of generating test cases on the basis of 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 and ensure test quality, thereby improving the reliability and security of software systems.

[0054] Further, in one embodiment, 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 in the first test cases and the second test cases, and generate a target test case set corresponding to the preset requirement document based on the test cases with different case names in all 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.

[0055] Exemplarily, it should be understood that since the same functional code block may appear repeatedly at different positions in a preset requirement document, different target requirement documents may contain the same functional code block, so that both the online large model and the local large model itself may output the same test cases, and the online large model may also output the same test cases as the local large model. Therefore, when integrating the test cases output by the online large model and the local large model in this embodiment, it is necessary to eliminate the redundantly appearing test cases to ensure the uniqueness and comprehensiveness of the output.

[0056] Specifically, since the test cases corresponding to each functional code block have unique case names, this embodiment will determine whether there are the same test cases among the first test cases, the second test cases, and between the first test cases and the second test cases by the case names; if so, that is, at least two test cases have the same case name, it indicates that these test cases are redundant test cases, then retain one of the test cases and eliminate the other redundant test cases, and then build a target test case set based on the remaining test cases with different case names; if not, that is, the case names of all test cases are different, it means that there are no redundant test cases, then directly build a target test case set based on all test cases.

[0057] Furthermore, in one embodiment, before the step of chunking the preset requirement document based on natural language processing technology NLP and data sensitivity, it further includes: Determine whether the preset requirement document can be made public; If so, execute the step of chunking the preset requirement document based on natural language processing technology NLP and data sensitivity; If not, call the local large model to generate a target test case set for the preset requirement document.

[0058] Exemplarily, 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 insecurity probability); among them, if this probability exceeds a preset probability threshold (such as 50%), it is considered that it should not be made public, that is, if it is made public, its security will be threatened. Therefore, to avoid this problem, this embodiment will directly call the local large model to generate a target test case set for it to ensure data security; however, if this probability does not exceed the preset probability threshold, it is considered that it can be made public, and then an appropriate online large model or local large model can be selected according to the specific sensitivity and complexity to generate a target test case set, so as to effectively reduce the generation cost of test cases on the basis of ensuring data security and compliance.

[0059] It can be seen that through strategies such as the standardization of requirement documents, the enabling of document security algorithms, and the invocation of multiple models, this embodiment further improves the effectiveness of generating test cases by large models and reduces manual intervention to lower test costs and improve test efficiency. Among them, the standardization of requirement documents solves the problem of low accuracy of the data returned by the model caused by non-standard test documents; the enabling of document security algorithms solves the problem of privacy leakage of data, and the invocation of multiple models solves the problems 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.

[0060] The following will describe Figure 3 the generation process and method of test cases.

[0061] 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 perform standardization and data security protection processing on the initial requirement document and generate a preset requirement document. Secondly, it can be judged whether the preset requirement document is executed for the first time according to whether the test requirement is recorded in the log. If not, the large model corresponding to the test requirement can be selected through the corresponding relationship between the test requirement recorded in the log and the large model used in history to generate test cases for the preset requirement document; if so, it is necessary to further judge whether this preset requirement document can be made public. If it cannot be made public, only the local large model is supported to ensure document security; if it can be made public, the preset requirement document is block-processed according to the sensitivity to select the local large model or the online large model according to the block result.

[0062] Then, the requirement document is parsed to convert it into a standardized JSON - format data structure, which may specifically include the following key information: the product identification, the name of the first - level menu, the name of the function point, and the requirement content, etc. Then, through the API interface provided by the large - model management platform, the selected model parameters and the parsed document JSON data string are input. Next, the corresponding large model is called and made to generate test cases that meet the requirements according to the predefined prompt requirements, and the test cases are encapsulated and returned in the standard JSON format, which may include the following key information: the product to which it belongs, the name of the first - level menu, the name of the function point, the case name, the pre - condition, the test steps, the expected result, etc. After receiving the JSON - format data, the backend service will parse it to generate an Excel file in the standard format and upload it to the specified attachment storage center. The front - end will display a more intuitive detailed interface of the test cases according to the interface return. In addition, if you are not satisfied with the test cases generated for some requirements, you can optimize the results by adding or modifying specific requirements and re - execute the model - calling process until you obtain the output result that meets the expectations. This iterative process can be repeated to ensure the accuracy and reliability of the results.

[0063] In summary, in this embodiment, through the collaborative work of the local large model and the online large model, the problem that a single model is difficult to fully meet the test requirements is solved. Considering the comprehensive factors of security and performance, the local - deployed large model is preferentially called to process the requirement document. Since the deployment environment of the local large model is controlled, it can ensure data security to the greatest extent, but it may not be able to fully cover complex scenarios due to model - scale limitations. To make up for this deficiency, this embodiment introduces a more powerful online large model as a supplement, that is, the requirement document is divided into multiple parts. The highly sensitive parts that cannot be made public are handed over to the local large model for processing according to the data - sensitivity level, while the publicly available parts are used to call the online large model to generate test cases. At the same time, the scheduling system can be used to dynamically select a suitable model according to the task characteristics (such as complexity, coverage, etc.). The logic and business consistency of the generated test cases can also be verified. For test cases that do not meet the conditions, they will be fed back to the scheduling system for optimizing the model - calling strategy. In addition, to avoid redundancy or conflicts in the test cases generated by multiple models, this embodiment uses semantic - analysis and similarity - detection technologies to integrate the test cases to remove redundant cases and ensure that the output content is unique and comprehensive. Through the above - mentioned multi - model collaboration method, this embodiment can significantly improve the accuracy and applicability of the generated test cases, and ultimately improve the overall efficiency and quality of financial software testing.

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

[0065] In one embodiment, referring to Figure 4 , Figure 4This is a schematic diagram of the functional modules of an embodiment of the test case generation device for this application. As Figure 4 shown, the test case generation device includes: A document chunking module, which is used to chunk a preset requirement document based on natural language processing technology (NLP) and data sensitivity to generate multiple target requirement documents with different sensitivities; A first generation module, which is used to call an online large model or a local large model for each first target requirement document to generate at least one first test case for the first target requirement document; A second generation module, which is used to call a local large model for each second target requirement document to generate at least one second test case for the second target requirement document, and the sensitivity of the second target requirement document is greater than that of the first target requirement document; A use case integration module, which 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.

[0066] Further, in one embodiment, the first generation module is specifically used for: When the sensitivity of the first target requirement document is within a preset first sensitive threshold range, call 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 sensitive threshold range, calculate the target difference between the sensitivity and complexity of the first target requirement document, and call the online large model or the local large model to generate at least one first test case for the first target requirement document according to the target difference; Wherein, the lower limit value of the second sensitive threshold range is greater than or equal to the upper limit value of the first sensitive threshold range.

[0067] Further, in one embodiment, the first generation module is specifically further used for: When the target difference is greater than or equal to 0, call 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, call the online large model to generate at least one first test case for the first target requirement document.

[0068] Further, in one embodiment, the use case integration module is specifically used for: Judge whether there are test cases with the same case name among all the first test cases and the second test cases; If so, eliminate the test cases with the same case name in all the first test cases and the second test cases, and generate a target test case set corresponding to the preset requirement document based on the test cases with different case names in all the first test cases and the second test cases; If not, generate a target test case set corresponding to the preset requirement document based on all the first test cases and the second test cases.

[0069] Further, in one embodiment, the document chunking module is further configured to: Determine whether the preset requirement document can be made public; If so, perform the step of chunking the preset requirement document based on the natural language processing technology NLP and data sensitivity; If not, cause the second generation module to call a local large model to generate a target test case set for the preset requirement document.

[0070] Further, in one embodiment, the test case generation device further includes a preprocessing module, which is used for: Perform semantic parsing on the initial requirement document based on NLP technology to extract target key information; Perform key entity annotation on the initial requirement document through named entity recognition technology NER and the target key information to obtain a new requirement document; Convert the new requirement document into a formatted requirement document according to a preset requirement document template; Perform term standardization processing and redundant content elimination processing on the formatted requirement document based on a fuzzy matching algorithm and a text similarity algorithm to generate a preset requirement document.

[0071] Further, in one embodiment, the preprocessing module is further configured to: Perform desensitization processing on sensitive fields in the initial requirement document based on a field desensitization method and / or an encryption desensitization algorithm to generate a preset requirement document.

[0072] Wherein, the function implementation of each module in the above test case generation device corresponds to each step in the above test case generation method embodiment, and its function and implementation process will not be elaborated here one by one.

[0073] In a third aspect, an embodiment of the present application provides a test case generation device, and the test case generation device can be a device with data processing functions such as a personal computer (PC), a laptop computer, a server, etc.

[0074] Refer to Figure 5 , Figure 5This is a schematic diagram of the hardware structure of the test case generation device involved in the solution of the embodiment of this application. In the embodiment of this application, the test case generation device may include a processor, a memory, a communication interface, and a communication bus.

[0075] Among them, the communication bus can be of any type and is used to interconnect the processor, the memory, and the communication interface.

[0076] The communication interface includes interfaces such as input / output (I / O) interfaces, physical interfaces, and logical interfaces for implementing the interconnection of components inside the test case generation device, as well as interfaces for implementing the interconnection between the test case generation device and other devices (such as other computing devices or user devices). The physical interface can be an Ethernet interface, a fiber optic interface, an ATM interface, etc.; the user device can be a display, a keyboard, etc.

[0077] 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 memory, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0078] The processor can be a general-purpose processor, and the general-purpose processor can call the test case generation program stored in the memory and execute the test case generation method provided by the embodiment of this application. For example, the general-purpose processor can be a central processing unit (CPU). Among them, the method executed when the test case generation program is called can refer to the various embodiments of the test case generation method of this application, which will not be elaborated here.

[0079] Those skilled in the art can understand that Figure 5 the hardware structure shown in does not constitute a limitation to this application, and it may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0080] Fourthly, the embodiment of this application also provides a computer-readable storage medium.

[0081] The test case generation program is stored on the readable storage medium of this application. When the test case generation program is executed by a processor, the steps of the test case generation method as described above are implemented.

[0082] 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 the present application, which will not be elaborated here.

[0083] It should be noted that the serial numbers of the embodiments of the present application above are only for description and do not represent the superiority or inferiority of the embodiments.

[0084] The terms "including" and "having" and any variations thereof in the specification, claims and drawings of the present application are intended to cover non-exclusive inclusion. 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 may optionally further include steps or units not listed, or may optionally further include other steps or units inherent to these processes, methods, products or devices. The descriptions of "first", "second", "third", etc. are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit that "first", "second" and "third" are different types.

[0085] In the description of the embodiments of the present application, "exemplary", "for example" or "for instance" are used to represent examples, illustrations or explanations. Any embodiment or design solution described as "exemplary", "for example" or "for instance" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary", "for example" or "for instance" is intended to present relevant concepts in a specific manner.

[0086] In the description of the embodiments of the present application, unless otherwise specified, " / " means "or". For example, A / B may mean A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B may mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality of" means two or more than two.

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

[0088] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, 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 several instructions for causing a terminal device to execute the methods described in various embodiments of the present application.

[0089] The above are only the 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 by using the content of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present application.

Claims

1. A test case generation method, characterized in that The described test case generation method includes: Chunking 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, where the sensitivity of the second target requirement document is greater than that of the first target requirement document; Integrating all the first test cases and the second test cases to generate a target test case set corresponding to the preset requirement document.

2. The test case generation method according to claim 1, wherein The step of calling an online large model or a local large model to generate a first test case for a 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 to generate at least one first test case for the first target requirement document according to the target difference; Wherein, the lower limit value of the second sensitivity threshold range is greater than or equal to the upper limit value of the first sensitivity threshold range.

3. The test case generation method according to claim 2, wherein The step of calling an online large model or a local large model to generate a first test case for a first target requirement document according to the target difference 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, calling the online large model to generate at least one first test case for the first target requirement document.

4. The test case generation method according to claim 1, wherein The step of 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: Judging whether there are test cases with the same case name among all the first test cases and the second test cases; If so, eliminating the test cases with the same case name among all the first test cases and the second test cases, and generating a target test case set corresponding to the preset requirement document based on the test cases with different case names among all the first test cases and the second test cases; If not, generating a target test case set corresponding to the preset requirement document based on all the first test cases and the second test cases.

5. The test case generation method according to claim 1, wherein Before the step of chunking the preset requirement document based on natural language processing technology NLP and data sensitivity, it further includes: Judging whether the preset requirement document can be made public; If so, performing the step of chunking the preset requirement document based on natural language processing technology NLP and data sensitivity; If not, calling the local large model to generate a target test case set for the preset requirement document.

6. The test case generation method according to claim 1, wherein Before the step of chunking the preset requirement document based on natural language processing technology NLP and data sensitivity, it further includes: Semantically parse the initial requirement document based on NLP technology to extract target key information; Perform key entity annotation on the initial requirement document through the named entity recognition technology NER and the target key information to obtain a new requirement document; Convert the new requirement document into a formatted requirement document according to a preset requirement document template; Perform term standardization processing and redundant content elimination processing on the formatted requirement document based on a fuzzy matching algorithm and a text similarity algorithm to generate a preset requirement document.

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

8. A test case generation device, characterized in that, The test case generation device includes: A document chunking module, which is used to chunk the preset requirement document based on natural language processing technology NLP and data sensitivity to generate multiple target requirement documents with different sensitivities; A first generation module, which is used to call an online large model or a local large model for each first target requirement document to generate at least one first test case; A second generation module, which is used to call a local large model for each second target requirement document to generate at least one second test case, and the sensitivity of the second target requirement document is greater than that of the first target requirement document; A use case integration module, which 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.

9. 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 on the memory and executable by the processor. When the test case generation program is executed by the processor, the steps of the test case generation method described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that, A test case generation program is stored on the computer-readable storage medium. When the test case generation program is executed by a processor, the steps of the test case generation method described in any one of claims 1 to 7 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

  • Method and system for generating test case based on demand document, medium and equipment

    CN119105951A

  • Software requirement document analysis and test case automatic generation method and system based on large language model

    CN119512959A

  • Test case generation method, electronic equipment and storage medium

    CN119782173A

Cited By

  • Demand document generation method and device, equipment, medium and product

    CN120850965A

  • Hydrogen storage product document generation system and method

    CN121580986A