An interface test case generation system
Patent Information
- Application Number
- CN202610856482.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-12
- Publication Date
- 2026-10-09
AI Technical Summary
[0004]本发明提供了一种接口测试用例生成系统,以解决基于静态文档生成测试用例方式,无法适应接口测试用例的动态测试场景的问题
本发明公开了一种接口测试用例生成系统,涉及测试用例生成技术领域,系统包括:知识生成模块,用于根据目标接口的历史输入文档和当前输入文档,生成目标动态知识库;向量检索模块,用于基于目标测试文档,生成目标测试向量,并根据目标测试向量从动态知识库中检索目标测试特征;用例生成模块,用于根据目标测试特征,利用预先训练而成的测试用例生成模型,生成目标测试用例。本发明由于知识生成模块可以生成目标动态知识库,因此,向量检索模块结合目标动态知识库,可以实现动态生成目标测试用例,便于适应接口测试用例的动态测试场景。
Smart Images

Figure CN122884820A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of test case generation technology, and more specifically to an interface test case generation system. Background Technology
[0002] As software systems become increasingly complex, interface testing is playing an increasingly important role in ensuring system functionality and performance stability.
[0003] In related technologies, interface testing usually relies on manually writing test cases and scripts, which is inefficient and prone to missing key information. In order to solve the problem of low efficiency in manually generating test cases, static documents are generally used to generate test cases in recent years. However, the static document generation method cannot adapt to the dynamic testing scenarios of interface test cases. Summary of the Invention
[0004] This invention provides an interface test case generation system to solve the problem that static document-based test case generation methods cannot adapt to dynamic testing scenarios of interface test cases.
[0005] In a first aspect, the present invention provides an interface test case generation system, the system comprising: The knowledge generation module is used to generate a dynamic knowledge base for the target based on the historical and current input documents of the target interface. The vector retrieval module is used to generate target test vectors based on the target test document, and retrieve target test features from the dynamic knowledge base based on the target test vectors; The test case generation module is used to generate target test cases based on the target test characteristics using a pre-trained test case generation model.
[0006] In some specific implementations, the interface test case generation system in this application embodiment further includes: The interface access module is used to access historical input documents, current input documents, and target test documents.
[0007] In some specific implementations, the interface test case generation system in this application embodiment further includes: The report generation module is used to generate target test reports based on target test cases.
[0008] In some specific implementations, the interface test case generation system in this application embodiment further includes: The user interaction module is used for users to input historical input documents, the current input document, the target test document, and to display the target test report.
[0009] In some specific implementations, the interface test case generation system and knowledge generation module in this application embodiment include: The document parsing unit is used to parse the interface path, request parameters, and response parameters based on historical input documents and the current input document, using various interface modes.
[0010] In some specific implementations, the interface test case generation system and knowledge generation module in this application embodiment include: The interface settings unit is used to set the interface authentication method, test scenario template, and test script instructions.
[0011] In some specific implementations, the interface test case generation system and knowledge generation module in this application embodiment include: The dynamic library generation unit is used to generate a target dynamic knowledge base based on the interface path, request parameters, response parameters, interface authentication method, test scenario template, and test script instructions.
[0012] In some specific implementations, the interface test case generation system and report generation module in this application embodiment include: The test case verification unit is used to verify the target test cases based on the target test template and obtain the target verification results.
[0013] In some specific implementations, the interface test case generation system and report generation module in this application embodiment include: The test case correction unit is used to obtain historical version information of the target interface from the interface vector database when the target verification result is that the target test case verification fails; and to generate regression test cases by inputting the historical version information into the test case generation model.
[0014] In some specific implementations, the interface test case generation system and report generation module in this application embodiment include: The test case storage unit is used to store the target test case when the target verification result is that the target test case has been successfully verified. The test report generation unit is used to generate a target test report based on regression test cases and target test cases.
[0015] The technical solution of this invention has the following advantages: This invention discloses an interface test case generation system, belonging to the field of test case generation technology. The system includes: a knowledge generation module, used to generate a target dynamic knowledge base based on the historical input documents and current input documents of the target interface; a vector retrieval module, used to generate target test vectors based on the target test documents and retrieve target test features from the dynamic knowledge base based on the target test vectors; and a test case generation module, used to generate target test cases based on the target test features using a pre-trained test case generation model. Because the knowledge generation module can generate a target dynamic knowledge base, the vector retrieval module, combined with the target dynamic knowledge base, can dynamically generate target test cases, facilitating adaptation to dynamic testing scenarios of interface test cases. Attached Figure Description
[0016] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0017] Figure 1 This is a structural block diagram of an interface test case generation system according to an embodiment of the present invention; Figure 2 This is a structural block diagram of another interface test case generation system according to an embodiment of the present invention; Figure 3 This is a structural block diagram of another interface test case generation system according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.
[0020] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0021] As software systems become increasingly complex, interface testing is playing an increasingly important role in ensuring system functionality and performance stability.
[0022] In related technologies, interface testing usually relies on manually writing test cases and scripts, which is inefficient and prone to missing key information. In order to solve the problem of low efficiency in manually generating test cases, static documents are generally used to generate test cases in recent years. However, the static document generation method cannot adapt to the dynamic testing scenarios of interface test cases.
[0023] This application provides an interface test case generation system, such as... Figure 1 As shown, the system includes: a knowledge generation module 11, a vector retrieval module 12, and a use case generation module 13.
[0024] exist Figure 1 In the middle, the knowledge generation module is used to generate a dynamic knowledge base for the target based on the historical input documents and the current input documents of the target interface.
[0025] Specifically, historical input documents are the interface documents related to the target interface in historical periods. Current input documents are the interface documents injected into the target interface in real time. The formats of historical and current input documents include, but are not limited to, OpenAPI interfaces, Swagger interfaces, and Postman Collection interfaces. A dynamic target knowledge base facilitates the accurate generation of target test cases in dynamic testing scenarios involving interface test cases.
[0026] exist Figure 1 In the middle, the vector retrieval module is used to generate target test vectors based on the target test document, and retrieve target test features from the dynamic knowledge base according to the target test vectors.
[0027] Specifically, the target test document consists of test requirement documents for the target user, including but not limited to test priorities, functional requirements, and test environment requirements. Target test vectors can be sourced from vector databases for easy similarity retrieval.
[0028] The vector retrieval module is essentially vectorizing the target test document, that is, using some interface descriptions as input information.
[0029] exist Figure 1 In the test case generation module, the test case generation module is used to generate target test cases based on the target test characteristics and using a pre-trained test case generation model.
[0030] exist Figure 1 In the test case generation module, the test case generation module is used to generate target test cases based on the target test characteristics and using a pre-trained test case generation model.
[0031] Specifically, the test case generation model is a large language model, and the test case generation module combines the target test characteristics to generate target test cases.
[0032] In some specific implementations, the interface test case generation system, such as Figure 2 As shown, the system also includes an interface access module 10, used to access historical input documents, current input documents, and target test documents.
[0033] Specifically, the interface input module is equivalent to the data input port of the interface test case generation system, used to receive data information.
[0034] In some specific implementation methods, in Figure 2 The interface test case generation system also includes a report generation module 14, which is used to generate a target test report based on the target test cases.
[0035] Specifically, the report generation module generates a target test report, allowing users to access relevant information about the target test cases. This target test report typically includes information such as interface coverage, performance metrics (e.g., response time, throughput), and error analysis.
[0036] In a specific example, such as Figure 3 As shown, the report generation module 14 includes: a test case verification unit 141, a test case correction unit 142, a test case storage unit 143, and a test report generation unit 144.
[0037] Among them, Figure 3 In the test case verification unit 141, the test case verification unit is used to verify the target test cases according to the target test template and obtain the target verification result.
[0038] By verifying the test cases, we can ensure that the target test cases are qualified and further confirm whether they meet the user's requirements.
[0039] Among them, Figure 3 In the middle, the test case correction unit 142 is used to obtain the historical version information of the target interface through the interface vector database when the target verification result is that the target test case verification fails; and to generate regression test cases by inputting the historical version information into the test case generation large model.
[0040] The accuracy of the target test cases is ensured by using the test case correction unit.
[0041] Among them, Figure 3 In the middle, the test case storage unit 143 is used to store the target test case when the target verification result is that the target test case verification is successful.
[0042] The test case storage unit prevents the loss of target test cases.
[0043] Among them, Figure 3 In the middle, the test report generation unit 144 is used to generate a target test report based on the regression test cases and the target test cases.
[0044] The target test report allows users to obtain timely test information related to the target interface.
[0045] In some specific implementations, the interface test case generation system in this application embodiment, the system, in Figure 2 It also includes a user interaction module 15, which is used for users to input historical input documents, current input documents, target test documents, and display target test reports.
[0046] Specifically, the user interaction module is equivalent to an interactive display interface, which facilitates users to input relevant historical input documents, current input documents, and target test documents, and facilitates the display of the target test report through this user interaction module.
[0047] In some specific implementations, the interface test case generation system and knowledge generation module 11 in this application embodiment, Figure 3 The document parsing unit 111 is used to parse the interface path, request parameters and response parameters according to the historical input documents and the current input documents through various interface formats.
[0048] Specifically, the various interface formats include OpenAPI, Swagger, and Postman Collection.
[0049] In some specific implementations, the interface test case generation system and knowledge generation module in this application embodiment, Figure 3 The system includes: an interface setting unit 112, used to set the interface authentication method, test scenario template, and test script instructions.
[0050] The interface settings unit facilitates the configuration of interface test cases and related interface setting parameters for the system.
[0051] In some specific implementations, the interface test case generation system in this application embodiment, Figure 3In the knowledge generation module 11, Figure 3 The system includes a dynamic library generation unit 113, which generates a target dynamic knowledge base based on the interface path, request parameters, response parameters, interface authentication method, test scenario template, and test script instructions.
[0052] The dynamic library generation unit facilitates the generation of a target dynamic knowledge base in dynamic testing scenarios of interface test cases.
[0053] This application includes the following embodiments: a knowledge generation module for generating a target dynamic knowledge base based on historical and current input documents of the target interface; a vector retrieval module for generating target test vectors based on target test documents and retrieving target test features from the dynamic knowledge base based on the target test vectors; and a test case generation module for generating target test cases based on the target test features using a pre-trained test case generation model. Since the knowledge generation module of this application can generate a target dynamic knowledge base, the vector retrieval module, combined with the target dynamic knowledge base, can dynamically generate target test cases, facilitating adaptation to dynamic testing scenarios of interface test cases.
[0054] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0055] The following is a detailed reference. Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0056] The following is a detailed reference. Figure 4 This diagram illustrates a suitable structural schematic for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 401, which can perform various appropriate actions and processes based on a program stored in read-only memory (ROM) 402 or a program loaded from memory 408 into random access random access memory (RAM) 403. The RAM 403 also stores various programs and data required for the operation of the electronic device. The processor 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0057] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0058] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 409, or installed from a memory 408, or installed from a ROM 402. When the computer program is executed by the processor 401, it performs the functions defined in the interface test case generation system of the embodiments of the present invention.
[0059] Figure 4 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
[0060] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, it implements some of the corresponding functions of the interface test case generation system shown in the above embodiments.
[0061] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0062] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. An interface test case generation system, characterized in that, The system includes: The knowledge generation module is used to generate a dynamic knowledge base for the target based on the historical and current input documents of the target interface. The vector retrieval module is used to generate target test vectors based on the target test document, and retrieve target test features from the dynamic knowledge base according to the target test vectors; The test case generation module is used to generate target test cases based on the target test characteristics using a pre-trained test case generation model.
2. The interface test case generation system according to claim 1, characterized in that, The system also includes: The interface access module is used to access the historical input document, the current input document, and the target test document.
3. The interface test case generation system according to claim 1, characterized in that, The system also includes: The report generation module is used to generate a target test report based on the target test cases.
4. The interface test case generation system according to claim 3, characterized in that, The system also includes: The user interaction module is used for users to input the historical input documents, the current input documents, the target test documents, and to display the target test report.
5. The interface test case generation system according to claim 1, characterized in that, The knowledge generation module includes: The document parsing unit is used to parse the interface path, request parameters, and response parameters based on the historical input documents and the current input documents, using multiple interface modes.
6. The interface test case generation system according to claim 5, characterized in that, The knowledge generation module includes: The interface settings unit is used to set the interface authentication method, test scenario template, and test script instructions.
7. The interface test case generation system according to claim 6, characterized in that, The knowledge generation module includes: The dynamic library generation unit is used to generate the target dynamic knowledge base based on the interface path, the request parameters, the response parameters, the interface authentication method, the test scenario template, and the test script instructions.
8. The interface test case generation system according to claim 3, characterized in that, The report generation module includes: The test case verification unit is used to verify the target test cases according to the target test template and obtain the target verification result.
9. The interface test case generation system according to claim 8, characterized in that, The report generation module includes: The test case correction unit is used to obtain the historical version information of the target interface through the interface vector database when the target verification result is that the target test case verification fails; and to generate regression test cases by inputting the historical version information into the test case generation model.
10. The interface test case generation system according to claim 9, characterized in that, The report generation module includes: A test case storage unit is used to store the target test case when the target verification result indicates that the target test case has been successfully verified. The test report generation unit is used to generate a target test report based on the regression test cases and the target test cases.