Test case generation method and device, storage medium and electronic equipment
The test case generation model built through a large language model uses case generation guidance to automatically extract verification points from test requirements and generate efficient and standardized test cases. This solves the problems of low software test case generation efficiency and insufficient coverage, and is suitable for FinTech scenarios.
Patent Information
- Application Number
- CN202510806561.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-09-26
AI Technical Summary
In existing technologies, software test case generation is inefficient and difficult to adapt to the rapid pace of R&D. Manual design cannot guarantee high-quality test coverage for financial systems.
A test case generation model is constructed through a large language model. The test design process and methodology in the use case generation guidance are utilized to provide a thinking framework and methodological anchor for the test case generation model, automatically extract test requirement points from test requirements, determine verification points and generate test cases.
It improves the efficiency and coverage of test case generation, ensures the coverage of test verification points, and improves the standardization of use case descriptions and data completeness.
Smart Images

Figure CN120705044A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of artificial intelligence technology, software testing, large models and deep learning technology, and can be applied to financial technology scenarios. This application specifically relates to a test case generation method, device, storage medium and electronic device. Background Art
[0002] A test case is a core concept in software testing. It refers to a set of standardized test units designed to verify specific functionality or requirements, consisting of a complete combination of input data, execution conditions, and expected results. Determining test cases involves multiple pre-processing steps, including requirements review, design review, test plan, and case design. In related technologies, all of these steps require the participation of testers, meaning that test cases are manually designed.
[0003] As the pace of application software releases becomes faster and faster, and the R&D model transforms to agile, the test design time is drastically compressed. At the same time, the development-test ratio continues to increase, and the test design time is tight and the task is heavy. Manually designed test cases are difficult to adapt to the R&D rhythm.
[0004] In addition, the stability of the financial system has high requirements for testing quality. Historically, hundreds of public test design points have been accumulated, covering security, performance, and user experience. Manually designed test cases cannot guarantee the coverage of test verification points. Summary of the Invention
[0005] The present application provides a test case generation method, device, storage medium and electronic device, which can achieve the purpose of improving the generation efficiency of test cases and the coverage of test verification points.
[0006] According to a first aspect of the present application, a test case generation method is provided, which is performed by a test case generation model, and the method includes:
[0007] Obtaining a use case generation guide constructed for the application to be tested, and extracting test requirement points from the test requirements of the application to be tested according to the test design process in the use case generation guide;
[0008] Determining a test verification point based on the test requirement point, and determining a target test method from a candidate test method in the use case generation guide based on the verification type to which the test verification point belongs;
[0009] Based on the target test method and the test verification points, a test case is generated for the application to be tested.
[0010] According to a second aspect of the present application, a test case generation device is provided, which is configured in a test case generation model, and the device includes:
[0011] A requirement point determination module is used to obtain a use case generation guide constructed for the application to be tested, and extract test requirement points from the test requirements of the application to be tested according to the test design process in the use case generation guide;
[0012] A test method determination module is used to determine a test verification point based on the test requirement point, and determine a target test method from the candidate test methods in the use case generation guide based on the verification type to which the test verification point belongs;
[0013] A test case generation module is used to generate a test case for the application to be tested based on the target test method and the test verification point.
[0014] According to a third aspect of the present invention, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the test case generation method as described in the embodiment of the present application.
[0015] According to the fourth aspect of the present invention, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor, wherein when the processor executes the computer program, the test case generation method as described in the embodiment of the present application is implemented.
[0016] According to the fifth aspect of the present application, an embodiment of the present application provides a computer program product, including a computer program, which implements the test case generation method as described in the embodiment of the present application when executed by a processor.
[0017] The technical solution of the present application, by integrating the test design process and test design method into the use case generation guidance provided for the test case generation model, builds a thinking framework for the test case generation model, and prompts the test case generation model to simulate the thinking process of professional testers. At the same time, it provides a methodological anchor for the test case generation model, and constrains the solution space of the test case generation model through methodology. Under the guidance of the use case generation guidance, the test case generation model extracts test requirement points from the test requirements of the application to be tested. Based on the test requirement points, the test verification points are determined, and based on the verification type to which the test verification points belong, the target test method is determined from the candidate test methods in the use case generation guidance. Based on the target test method and the test verification points, a test case is generated for the application to be tested. While improving the efficiency of test case generation, the quality of test case generation is improved in terms of use case description standardization, test case scenarios and data completeness, ensuring the coverage of test verification points.
[0018] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0020] Figure 1 is a flowchart of a test case generation method according to embodiment 1;
[0021] Figure 2 is a flowchart of the test case generation method provided in Example 2;
[0022] Figure 3 This is a schematic diagram of the structure of the test case generation device provided in Example 3 of the present application;
[0023] Figure 4 This is a structural diagram of an electronic device provided in Example 4 of the present application. DETAILED DESCRIPTION
[0024] 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 drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0025] It should be noted that the terms "first", "second", "target" and "candidate" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof 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 necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0026] Example 1
[0027] Figure 1This is a flowchart of the test case generation method provided in Example 1. This embodiment is applicable to the situation of automatically generating test cases. The method is executed by a test case generation model and can be executed by a test case generation device configured in the test case generation model. The test case generation device is implemented in the form of hardware and / or software and can be integrated into the electronic device running this system.
[0028] like Figure 1 As shown, the method includes:
[0029] S110 : Obtain a use case generation guide constructed for an application to be tested, and extract test requirement points from the test requirements of the application to be tested according to a test design process in the use case generation guide.
[0030] S120: Determine a test verification point based on the test requirement point, and determine a target test method from the candidate test methods in the use case generation guide based on the verification type to which the test verification point belongs.
[0031] S130: Generate a test case for the application to be tested based on the target test method and the test verification points.
[0032] The application under test refers to the application software that requires systematic verification. Test cases are automatically generated by the test case generation model and are structured test plans for systematic verification of the application under test.
[0033] The test case generation model is built on a large language model (LLM). A large language model (LLM) is a deep learning-based, ultra-large-scale natural language processing model that acquires language understanding and generation capabilities through training on massive amounts of text data. Large language models typically have parameters ranging from billions to trillions and utilize the Transformer architecture for efficient sequence data processing. The core capabilities of large language models include text understanding, generation, translation, and logical reasoning.
[0034] Prompts are text instructions or guiding inputs provided to the test case generation model to trigger and direct the model's generation of test cases for the application under test. Essentially, prompts act as a semantic switch that interacts with the test case generation model through natural language, translating user needs into semantic signals understandable to the test case generation model. This activates specific capabilities accumulated during pre-training, such as text generation and logical reasoning.
[0035] Optionally, in addition to the basic elements, the use case generation guidance also includes the test design process, candidate test methods and test requirements. Among them, the basic elements include: task description, instruction constraints and role setting. The task description is used to clearly inform the test case generation model of the type of content that needs to be generated. Instruction constraints are used to specify the output format, style or restrictions. Role setting is used to define the behavioral boundaries and knowledge perspective of the test case generation model. Exemplarily, the basic elements in the use case generation guidance can be "You are now a software testing expert who is good at extracting test verification points from requirement descriptions and generating test cases based on the extracted test verification points. Requirements: Output test verification points and test cases corresponding to pre-test verification points, and output in the format of use case name, test steps, expected results and test verification points."
[0036] The test design process and candidate test methods in the use case generation guidance provide test design ideas for the test case generation model. The test design process is used to build a thinking framework for the test case generation model, prompting the test case generation model to simulate the thinking process of professional testers. Candidate test methods refer to test design methods provided to the test case generation model through use case generation guidance. Candidate test methods are used to provide a methodological anchor for the test case generation model and constrain the solution space of the test case generation model through methodology. Optionally, the candidate test methods include: at least one of: equivalence class, orthogonal method, scenario method and path method. There are differences in the types of verification applicable to the test design methods. For example, equivalence class and orthogonal method are applicable to functional verification, and scenario method and path method are applicable to logical verification.
[0037] The test case generation model is based on the test design process in the use case generation guidance. It first understands the test requirements and extracts the test requirement points from the test requirements. According to the test requirement points and the contextual content associated with the test requirement points in the test requirements, the test verification points are determined. Among them, the test requirement points are used to determine the functions or quality requirements covered by the test and are the input benchmarks for the testing activities. The test verification points are specific verifiable items generated by engineering decomposition of the test requirement points, which directly guide the test case design. The specific content of the test requirement points and test verification points is not limited here, and is determined according to the actual situation. For example, the test requirement point is "the payment function needs to be automatically canceled after timeout", and the corresponding test verification point can be "the order status changes to canceled when the payment is not made after 15 minutes of verification."
[0038] The verification type of the test verification point is used to determine the test design method used to generate test cases for the application to be tested. Optionally, the verification type includes functional verification and logical verification.
[0039] The test case generation model determines a target test method with a matching verification type among the candidate test methods based on the verification type to which the test verification point belongs and the verification type to which the candidate test method is applicable.
[0040] The test case generation model uses the target test method to expand the test verification points and obtain the test cases corresponding to the test verification points. The test cases corresponding to the test verification points in the application to be tested are integrated to generate the test cases of the application to be tested.
[0041] Optionally, test cases are used to test the application to be tested, and successful test cases are added to the existing test cases to form case assets.
[0042] The technical solution of the present application, by integrating the test design process and test design method into the use case generation guidance provided for the test case generation model, builds a thinking framework for the test case generation model, and prompts the test case generation model to simulate the thinking process of professional testers. At the same time, it provides a methodological anchor for the test case generation model, and constrains the solution space of the test case generation model through methodology. Under the guidance of the use case generation guidance, the test case generation model extracts test requirement points from the test requirements of the application to be tested. Based on the test requirement points, the test verification points are determined, and based on the verification type to which the test verification points belong, the target test method is determined from the candidate test methods in the use case generation guidance. Based on the target test method and the test verification points, a test case is generated for the application to be tested. While improving the efficiency of test case generation, the quality of test case generation is improved in terms of use case description standardization, test case scenarios and data completeness, ensuring the coverage of test verification points.
[0043] In an optional embodiment, based on the verification type to which the test verification point belongs, the target test method is determined from the candidate test methods in the use case generation guide, including: if the verification type to which the test verification point belongs is functional verification, then the equivalence class and / or orthogonal method in the use case generation guide is determined as the target test method; if the verification type to which the test verification point belongs is logical verification, then the scenario method and / or path method in the use case generation guide is determined as the target test method.
[0044] Verification types include functional verification and logical verification. Functional verification involves system-level external behavior, focusing on black-box testing. The coverage objective of functional verification is requirement compliance. Logical verification ensures that system functionality meets expectations by verifying the correctness of business rules, code logic, or user processes. It involves internal code implementation and focuses on white-box analysis. The coverage objective of logical verification is logical completeness.
[0045] When the verification type of the test verification point is functional verification, the equivalence class and / or the orthogonal method are determined as the target test method. In other words, either the equivalence class or the orthogonal method can be determined as the target test method, or both the equivalence class and the orthogonal method can be determined as the target test method.
[0046] Among them, equivalence classes can systematically verify whether functions meet requirements by dividing the input domain into valid or invalid equivalence classes. For example, when testing the username input function, the equivalence class division will design use cases for the valid class of 8-digit numbers and the invalid class of non-digits. Equivalence classes are suitable for scenarios with a single input variable, and the equivalence partitions are covered by typical values. The orthogonal method is suitable for scenarios with multiple input variables, and the orthogonal table is used to reduce the number of use cases while covering the interactions between factors. Among them, equivalence classes and orthogonal methods can be used independently or in combination. The specific use of equivalence classes and orthogonal methods is determined according to actual conditions and is not limited here.
[0047] If the verification type for a test verification point is logical verification, the scenario and / or path methods used in the use case generation guide are selected as the target test methods. This means that either the scenario or path method can be selected as the target test method, or both. The scenario method verifies business processes by simulating user operation scenarios, such as basic and alternative flows. The path method verifies logical integrity by covering execution paths within the code or process.
[0048] The above technical solution provides a practical test design method determination scheme, which can be used to provide a methodological anchor for the test case generation model. By constraining the solution space of the test case generation model through methodology, it is beneficial to improve the scenario coverage and data completeness of the test cases.
[0049] In an optional embodiment, generating a test case for the application to be tested based on the target test method and the test verification point includes: semantically matching the test verification point with the test verification point associated with the existing test case to obtain a semantic matching result; based on the semantic matching result, determining a reference test case in the existing test case; and generating a test case for the application to be tested based on the reference test case and the target test method.
[0050] Optionally, the use case generation guide also includes a use case reference indication, which is used to instruct the test case generation model to determine a reference test case from the existing test cases, and generate a test case for the application to be tested based on the reference test case.
[0051] Existing test cases refer to existing successful test cases accumulated historically during the software testing process. Existing test cases are associated with test verification points. The test case generation model semantically matches the test verification points with the test verification points associated with existing test cases. The semantic matching results are used to determine which existing test cases can serve as reference test cases. Optionally, the semantic matching results include both successful and failed matches. Each existing test case has a corresponding semantic matching result. Existing test cases with a successful semantic matching result are designated as reference test cases.
[0052] Optionally, the test case generation model adopts a target test method to convert reference test cases into test cases that meet the test requirements, and generates test cases for the application to be tested by integrating the test cases corresponding to the test requirements.
[0053] The above technical solution uses existing test cases that match test verification points as a reference to generate test cases for the application under test. This allows the test case generation model to generate test cases for the application under test that are closer in content to successful test cases for the application's functional points, thereby improving the quality of test case generation.
[0054] In an optional embodiment, the use case generation guidance also includes industry knowledge, and the industry knowledge is used to assist the test case generation model in extracting the test requirement points from the test requirements; the industry knowledge is obtained by performing knowledge retrieval on the knowledge vector library using retrieval enhancement technology; wherein, the knowledge vector library is constructed based on the vectorization results obtained by vectorizing the industry data text.
[0055] Industry knowledge can include application white papers, test cases, and test specifications. Industry knowledge is used to assist the test case generation model in extracting test requirements from test requirements.
[0056] Industry knowledge can be injected into the test case generation model to inject domain knowledge, enabling it to master professional concepts and effectively resolve the problem of logical conflicts between the test cases generated by the test case generation model and the test requirements or objective facts. Industry knowledge is obtained by using retrieval-augmented generation (RAG) technology to perform knowledge retrieval on the knowledge vector library. The knowledge vector library stores industry data text vectors. Optionally, the industry data text is semantically segmented to obtain text blocks, and then the text blocks are vectorized, and the obtained industry data text vectors are stored in the vector knowledge library.
[0057] Search enhancement technology is used to search the industry data text vectors in the knowledge vector library, and a first number of text blocks retrieved are used as industry knowledge. The first number is determined based on actual conditions and is not limited here. For example, the first number is 10.
[0058] This technical solution, in AI-driven test case generation scenarios, incorporates industry knowledge into the use case generation guidance, enabling the conversion of industry data into valuable insights and effectively addressing the illusion problem in test case generation models. This helps improve the test case generation model's ability to better understand the test requirements of the application under test, thereby increasing the accuracy of test requirement points and test verification points, and ultimately, the accuracy of test case generation.
[0059] Example 2
[0060] Figure 2 This is a flow chart of the test case generation method provided in Example 2. This embodiment is further optimized based on the above embodiment.
[0061] like Figure 2 As shown, the method includes:
[0062] S210: Obtain a use case generation guide constructed for the application to be tested, and extract test requirement points from the test requirements of the application to be tested according to the test design process in the use case generation guide.
[0063] S220: Determine a test verification point based on the test requirement point, and determine a target test method from the candidate test methods in the use case generation guide based on the verification type to which the test verification point belongs.
[0064] S230: Generate an intermediate test document corresponding to the verification type for the test verification point according to the use case generation logic associated with the target test method.
[0065] The target test method is associated with use case generation logic, which is used to establish the mapping rules between the test design method and test case generation. The test design method is determined based on the verification type of the test verification point. Verification types can optionally include functional verification and logical verification. Accordingly, the use case generation logic of the test design algorithm is also based on two dimensions: business scenario analysis and code logic coverage.
[0066] The intermediate test documents required to generate test cases vary depending on the verification type corresponding to the test design method. Intermediate test documents are used to achieve traceable transformation of test requirements and structured expression of test designs, serving as a bridge between test requirements and test cases.
[0067] S240: Generate a document confirmation request based on the document content of the intermediate test document.
[0068] The document confirmation request is generated by the test case generation model based on the document content of the intermediate test document. The document confirmation request is used to request the tester to intervene and verify the document content of the intermediate test document.
[0069] Intermediate test documents are the direct basis for test case generation. Their essence is a structured and concrete embodiment of test thinking. By analyzing intermediate test documents, we can reveal the underlying logic of test case generation from the use case test model.
[0070] S250: Obtain document confirmation feedback corresponding to the document confirmation request.
[0071] Document Verification Feedback corresponds to a Document Verification Request and is provided by the tester. Document Verification Feedback is used to clarify whether the document content of the intermediate test document is incorrect.
[0072] S260: When the document confirmation feedback indicates that the content is correct, generate a test case for the application to be tested based on the intermediate test document.
[0073] Optionally, the document confirmation feedback includes content errors and content correctness. If the document confirmation feedback is that the content is correct, the test case generation model generates test cases for the application to be tested based on the intermediate test document.
[0074] In the case where the document confirmation feedback indicates that the content is incorrect, the document content of the intermediate test document is modified according to the modification suggestions in the document confirmation feedback, and a test case is generated based on the modified intermediate test document.
[0075] The technical solution of the present application generates an intermediate test document corresponding to the verification type for the test verification point through the test case generation model according to the use case generation logic associated with the target test method. The test personnel are requested to intervene to check the document content of the intermediate test document and provide document confirmation feedback. When the document confirmation feedback is that the content is correct, a test case is generated for the application to be tested based on the intermediate test document. The embodiment of the present application realizes the precise integration of machine efficiency and human experience by exposing the underlying logic of test case generation to the test personnel, and can intercept errors in intermediate test documents before use case generation, which is conducive to improving the accuracy of test cases. In addition, the intermediate test document serves as the decision-making basis for the test case model to generate test cases, and generates intermediate test documents between test requirements and test cases, which increases the interpretability of test cases.
[0076] In an optional embodiment, the use case generation logic associated with the target test method is used to generate an intermediate test document corresponding to the verification type for the test verification point, including: if the target test method is an equivalence class and / or orthogonal method, then the test elements corresponding to the test verification point are determined based on the use case generation logic associated with the target test method; a test design form is generated based on the test elements, and an intermediate test document of the test case is generated for the test requirement point based on the test design form.
[0077] The target test method is equivalence class and / or orthogonal method, which corresponds to the functional verification test verification point. The focus of the intermediate test document is on data design.
[0078] Test elements are the basic units for generating test design spreadsheets. Test elements can correspond to fields in a test design spreadsheet, and a test design spreadsheet is generated based on these test elements. Optionally, the test design spreadsheet can be optimized for case descriptions to generate an intermediate test document.
[0079] The above technical solution proposes a feasible intermediate test document generation solution for the case where the test design method is equivalence class and / or orthogonal method, providing technical support for revealing the data design ideas of the test case generation model to testers.
[0080] In an optional embodiment, the generating logic of the use case associated with the target test method generates an intermediate test document corresponding to the verification type for the test verification point, and further includes: if the target test method is the scenario method and / or the path method, determining the test process corresponding to the test verification point based on the use case generation logic associated with the target test method; generating a chart generation script based on the test process, and generating a visual chart based on the chart generation script; and generating an intermediate test document of the test case for the test requirement point based on the visual chart.
[0081] The target testing method is scenario-based and / or path-based, corresponding to scenario-based verification points. The intermediate test documentation focuses on process design. The test process is the basic unit for generating business processes. Optionally, the test process includes basic flows and alternative flows.
[0082] The test case generation model generates a chart generation script based on the test process. The chart generation script is used to generate a visual chart. Optionally, the visual chart is optimized for case descriptions to produce an intermediate test document.
[0083] The above technical solution proposes a feasible intermediate test document generation solution for the case where the test design method is the scenario method and / or the path method, and provides technical support for revealing the process design ideas of the test case generation model to testers.
[0084] Example 3
[0085] Figure 3 This is a structural diagram of the test case generation device provided in Example 3 of the present application. This embodiment can be applied to the situation of automatically generating test cases. The device can be configured in the test case generation model, implemented by software and / or hardware, and can be integrated into electronic devices such as smart terminals.
[0086] like Figure 3 As shown, the test case generation device 300 is configured in the test case generation model and may include:
[0087] The requirement point determination module 310 is used to obtain a use case generation guide constructed for the application to be tested, and extract test requirement points from the test requirements of the application to be tested according to the test design process in the use case generation guide;
[0088] A test method determination module 320 is configured to determine a test verification point based on the test requirement point, and determine a target test method from the candidate test methods in the use case generation guide based on the verification type to which the test verification point belongs;
[0089] The test case generation module 330 is configured to generate a test case for the application to be tested based on the target test method and the test verification points.
[0090] The technical solution of the present application, by integrating the test design process and test design method into the use case generation guidance provided for the test case generation model, builds a thinking framework for the test case generation model, and prompts the test case generation model to simulate the thinking process of professional testers. At the same time, it provides a methodological anchor for the test case generation model, and constrains the solution space of the test case generation model through methodology. Under the guidance of the use case generation guidance, the test case generation model extracts test requirement points from the test requirements of the application to be tested. Based on the test requirement points, the test verification points are determined, and based on the verification type to which the test verification points belong, the target test method is determined from the candidate test methods in the use case generation guidance. Based on the target test method and the test verification points, a test case is generated for the application to be tested. While improving the efficiency of test case generation, the quality of test case generation is improved in terms of use case description standardization, test case scenarios and data completeness, ensuring the coverage of test verification points.
[0091] Optionally, the test method determination module 320 includes: a first test method determination sub-module, which is used to determine the equivalence class and / or orthogonal method in the use case generation guidance as the target test method if the verification type to which the test verification point belongs is functional verification; and a second test method determination sub-module, which is used to determine the scenario method and / or path method in the use case generation guidance as the target test method if the verification type to which the test verification point belongs is logical verification.
[0092] Optionally, the test case generation module 330 includes: a test document generation sub-module, which is used to generate an intermediate test document corresponding to the verification type for the test verification point according to the use case generation logic associated with the target test method; a confirmation request generation sub-module, which is used to generate a document confirmation request based on the document content of the intermediate test document; a confirmation feedback acquisition sub-module, which is used to obtain document confirmation feedback corresponding to the document confirmation request; and a first test case generation sub-module, which is used to generate a test case for the application to be tested based on the intermediate test document when the document confirmation feedback indicates that the content is correct.
[0093] Optionally, the test document generation submodule includes: a test element determination unit, which is used to determine the test elements corresponding to the test verification points based on the use case generation logic associated with the target test method if the target test method is an equivalence class and / or orthogonal method; a first test document generation unit, which is used to generate a test design form based on the test elements, and generate an intermediate test document of the test case for the test requirement point based on the test design form.
[0094] Optionally, the test document generation submodule also includes: a test process determination unit, which is used to determine the test process corresponding to the test verification point based on the use case generation logic associated with the target test method if the target test method is the scenario method and / or the path method; a visual chart determination unit, which is used to generate a chart generation script based on the test process, and generate a visual chart based on the chart generation script; a second test document generation unit, which is used to generate an intermediate test document of the test case for the test requirement point based on the visual chart.
[0095] Optionally, the test case generation module 330 includes: a semantic matching sub-module, used to semantically match the test verification point with the test verification point associated with the existing test case to obtain a semantic matching result; a reference case determination sub-module, used to determine a reference test case in the existing test case based on the semantic matching result; and a second test case generation sub-module, used to generate a test case for the application to be tested based on the reference test case and the target test method.
[0096] Optionally, the use case generation guidance also includes industry knowledge, which is used to assist the test case generation model in extracting the test requirement points from the test requirements; the industry knowledge is obtained by performing knowledge retrieval on the knowledge vector library using retrieval enhancement technology; wherein, the knowledge vector library is constructed based on the vectorization results obtained by vectorizing the industry data text.
[0097] The test case generation device provided in the embodiment of the invention can execute the test case generation method provided in any embodiment of the present application, and has the corresponding performance modules and beneficial effects of executing the test case generation method.
[0098] In the technical solution of this application, the user data such as document confirmation feedback involved are information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0099] Example 4
[0100] According to embodiments of the present application, the present application also provides an electronic device, a readable storage medium, and a computer program product.
[0101] Figure 4 The structure diagram of the electronic device 410 that can be used to implement the embodiment is shown. The electronic device 410 includes at least one processor 411, and a memory connected to the at least one processor 411 in communication, such as a read-only memory (ROM) 412, a random access memory (RAM) 413, etc., wherein the memory stores a computer program that can be executed by the at least one processor, and the processor 411 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 412 or the computer program loaded from the storage unit 418 into the random access memory (RAM) 413. Various programs and data required for the operation of the electronic device 410 can also be stored in the RAM 413. The processor 411, ROM 412 and RAM 413 are connected to each other via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.
[0102] Multiple components in electronic device 410 are connected to I / O interface 415, including an input unit 416, such as a keyboard, mouse, etc.; an output unit 417, such as various types of displays, speakers, etc.; a storage unit 418, such as a magnetic disk, optical disk, etc.; and a communication unit 419, such as a network card, modem, wireless communication transceiver, etc. The communication unit 419 allows electronic device 410 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0103] Processor 411 can be various general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. Processor 411 executes the various methods and processes described above, such as the test case generation method.
[0104] In some embodiments, the test case generation method can be implemented as a computer program that is tangibly contained in a computer-readable storage medium, such as storage unit 418. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 410 via ROM 412 and / or communication unit 419. When the computer program is loaded into RAM 413 and executed by processor 411, one or more steps of the test case generation method described above can be performed. Alternatively, in other embodiments, processor 411 can be configured to perform the test case generation method in any other appropriate manner (e.g., by means of firmware).
[0105] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0106] Computer programs for implementing the methods of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable test case generation device, so that when executed by the processor, the computer programs implement the functions / operations specified in the flowcharts and / or block diagrams. The computer programs can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0107] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0108] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0109] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a test case generation server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0110] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.
[0111] The present application also discloses a computer program product, comprising a computer program that, when executed by a processor, implements the test case generation method provided in any of the embodiments of the present application. This program product and the test case generation method disclosed in each embodiment of the present application embody the same inventive concept and are therefore not described in detail here.
[0112] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this application can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of this application can be achieved. This is not limited herein.
[0113] The above specific embodiments do not constitute a limitation on the scope of protection of this application. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application shall be included within the scope of protection of this application.
Claims
1. A test case generation method, characterized in that: Executed by a test case generation model, the method includes: Obtaining a use case generation guide constructed for the application to be tested, and extracting test requirement points from the test requirements of the application to be tested according to the test design process in the use case generation guide; Determining a test verification point based on the test requirement point, and determining a target test method from a candidate test method in the use case generation guide based on the verification type to which the test verification point belongs; Based on the target test method and the test verification points, a test case is generated for the application to be tested.
2. The method according to claim 1, characterized in that The determining of the target test method from the candidate test methods in the use case generation guide based on the verification type to which the test verification point belongs includes: If the verification type to which the test verification point belongs is functional verification, the equivalence class and / or orthogonal method in the use case generation guide is determined as the target test method; If the verification type to which the test verification point belongs is logic verification, the scenario method and / or path method in the use case generation guide is determined as the target test method.
3. The method according to claim 1, characterized in that Generating a test case for the application to be tested based on the target test method and the test verification point includes: generating an intermediate test document corresponding to the verification type for the test verification point according to the use case generation logic associated with the target test method; generating a document confirmation request based on the document content of the intermediate test document; Obtaining document confirmation feedback corresponding to the document confirmation request; When the document confirmation feedback indicates that the content is correct, a test case is generated for the application to be tested based on the intermediate test document.
4. The method according to claim 3, characterized in that The generating logic of the use case associated with the target test method, generating an intermediate test document corresponding to the verification type for the test verification point, includes: If the target test method is an equivalence class and / or orthogonal method, determining the test elements corresponding to the test verification points based on the use case generation logic associated with the target test method; A test design form is generated based on the test elements, and an intermediate test document of a test case is generated for the test requirement point based on the test design form.
5. The method according to claim 3, characterized in that The generating logic of the use case associated with the target test method, generating an intermediate test document corresponding to the verification type for the test verification point, further includes: If the target test method is a scenario method and / or a path method, determining the test process corresponding to the test verification point based on the use case generation logic associated with the target test method; Generate a chart generation script based on the test process, and generate a visual chart based on the chart generation script; Based on the visual chart, an intermediate test document of the test case is generated for the test requirement point.
6. The method according to claim 1, wherein Generating a test case for the application to be tested based on the target test method and the test verification point includes: Performing semantic matching on the test verification point and the test verification point associated with the existing test case to obtain a semantic matching result; Determining a reference test case from the existing test cases based on the semantic matching result; Based on the reference test case and the target test method, a test case is generated for the application to be tested.
7. The method according to claim 1, characterized in that The use case generation guidance also includes industry knowledge, which is used to assist the test case generation model in extracting the test requirement points from the test requirements; the industry knowledge is obtained by using retrieval enhancement technology to perform knowledge retrieval on the knowledge vector library; wherein, the knowledge vector library is constructed based on the vectorization results obtained by vectorizing the industry data text.
8. A test case generating device, characterized in that: Configured in a test case generation model, the device includes: A requirement point determination module is used to obtain a use case generation guide constructed for the application to be tested, and extract test requirement points from the test requirements of the application to be tested according to the test design process in the use case generation guide; A test method determination module is used to determine a test verification point based on the test requirement point, and determine a target test method from the candidate test methods in the use case generation guide based on the verification type to which the test verification point belongs; A test case generation module is used to generate a test case for the application to be tested based on the target test method and the test verification point.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the test case generation method according to any one of claims 1 to 7 is implemented.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein: When the processor executes the computer program, the test case generating method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Test case generation method and device, electronic equipment and storage medium
CN121277838A