Test case generation method and device, equipment, storage medium and program product

By generating prompt statements and entering a generative language model, the problem of long acquisition time and low coverage in the prior art test cases is solved, and the quality and efficiency of test cases are improved, ensuring that they cover the latest functions and fix defects of the application.

CN119537243APending Publication Date: 2025-02-28GUANGZHOU KUGOU COMP TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411717494.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In the prior art, the acquisition of test cases takes a long time, and it is easy to cause the test cases to fail to cover product requirements, resulting in poor quality and efficiency.

Method used

By obtaining the application's test requirements documentation and object code, generating prompt statements, and entering them into a generative language model, to generate test cases that match the test requirements documentation and object code.

Benefits of technology

Improve the quality and efficiency of test case generation, ensure that test cases can cover the latest features or fixed defects of the application, and combine actual application knowledge and historical testing experience to improve the practicality and reliability of test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119537243A_ABST
    Figure CN119537243A_ABST
Patent Text Reader

Abstract

The invention relates to a test case generation method and device, equipment, a storage medium and a program product, and relates to the technical field of artificial intelligence. The method comprises the steps of obtaining a test requirement document and a target code of an application program; the test demand document is used for indicating the test demand of a tester for the application program; the target code comprises at least one of a newly added code and a modified code; obtaining a prompt statement based on the test requirement document of the application program and the target code; the prompt statement is used for indicating to generate a test case matched with the test requirement document and the target code by taking a specified database as background knowledge; the specified database is a database composed of knowledge related to the test of the application program; and inputting the prompt statement into the generative language model to obtain a test case output by the generative language model. According to the scheme, the generation quality of the test case can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of AI (Artificial Intelligence) technology, and in particular to a test case generation method, apparatus, device, storage medium and program product. Background Art

[0002] Software testing can test Internet products before they go online to ensure their quality. In the field of software testing, test cases are used to verify whether the software works as expected. Therefore, the generation of test cases is particularly important.

[0003] In related technologies, testers can write different test cases according to different business types. For example, after the testers obtain the modified product code, they can select the test case corresponding to the modified code according to the modified content of the code to implement the testing of the software product.

[0004] However, in the solutions shown in the above-mentioned related technologies, since test cases need to be manually organized by testers, it takes a long time to obtain test cases, and it is easy to cause the test cases to fail to cover product requirements, resulting in poor quality and efficiency of test case acquisition. Summary of the invention

[0005] The embodiments of the present application provide a test case generation method, apparatus, device, storage medium, and program product, which can improve the quality and efficiency of test case generation. The technical solution is as follows:

[0006] In one aspect, a test case generation method is provided, the method comprising:

[0007] The test requirement document and the target code of the application are obtained; the test requirement document is used to indicate the test requirements of the tester for the application; the target code includes at least one of a newly added code and a modified code;

[0008] Based on the test requirement document of the application and the target code, a prompt statement is obtained; the prompt statement is used to indicate that a test case matching the test requirement document and the target code is generated with a designated database as background knowledge; the designated database is a database composed of knowledge related to the test of the application;

[0009] The prompt sentence is input into a generative language model to obtain the test case output by the generative language model.

[0010] On the other hand, a test case generation device is provided, the device comprising:

[0011] A test requirement document and target code acquisition module, used to acquire a test requirement document and target code of an application; the test requirement document is used to indicate the test requirements of the tester for the application; the target code includes at least one of a newly added code and a modified code;

[0012] A prompt statement acquisition module is used to obtain a prompt statement based on the test requirement document of the application and the target code; the prompt statement is used to indicate that a test case matching the test requirement document and the target code is generated with a designated database as background knowledge; the designated database is a database composed of knowledge related to the test of the application;

[0013] The test case acquisition module is used to input the prompt sentence into the generative language model to obtain the test case output by the generative language model.

[0014] In some embodiments, the prompt statement acquisition module is used to determine the test function points corresponding to the test requirement document and the target code respectively; based on the test function points corresponding to the test requirement document and the target code respectively and a business knowledge base, a prompt statement is obtained; the business knowledge base is used to store business knowledge corresponding to different test function points; the business knowledge includes at least one of a function point description document, test experience, preset test cases, use case design methods, and business terminology explanations.

[0015] In some embodiments, the prompt statement acquisition module is used to obtain the target test function point according to the test requirement document and the test function points corresponding to the target code respectively; search the business knowledge base to obtain the business knowledge corresponding to the target test function point in the business knowledge base; and obtain the prompt statement based on the business knowledge.

[0016] In some embodiments, the prompt statement obtaining module is used to obtain a union of the test function points corresponding to the test requirement document and the test function points corresponding to the target code as the target test function points.

[0017] In some embodiments, the prompt statement acquisition module is used to obtain relevant function points of the test function point corresponding to the test requirement document, and relevant function points of the test function point corresponding to the target code; obtain the union of the test function point corresponding to the test requirement document, the relevant function points of the test function point corresponding to the test requirement document, the test function point corresponding to the target code, and the relevant function points of the test function point corresponding to the target code as the target test function point.

[0018] In some embodiments, the prompt statement acquisition module is used to query the function point relationship table through the test function points corresponding to the test requirement document to obtain the relevant function points of the test function points corresponding to the test requirement document; the function point relationship table stores the correlation between the various function points of the application; the function point relationship table is queried through the test function points corresponding to the target code to obtain the relevant function points of the test function points corresponding to the target code.

[0019] In some embodiments, the prompt statement acquisition module is further used to obtain a prompt statement template and a historical test case corresponding to the target test function point;

[0020] The prompt statement obtaining module is used to combine the target test function point, the historical test case and the business knowledge according to the prompt statement template to obtain a prompt statement.

[0021] In some embodiments, the apparatus further comprises:

[0022] A test type information acquisition module, used to combine the target test function point, the historical test case and the business knowledge according to the prompt statement template, and obtain test type information before obtaining the prompt statement, wherein the test type information is used to indicate that the type of the test performed on the application is at least one of a front-end test and a back-end test;

[0023] The prompt statement obtaining module is used to combine the test type information, the target test function point, the historical test case and the business knowledge according to the prompt statement template to obtain the prompt statement.

[0024] In some embodiments, a prompt statement acquisition module is used to input the test requirement document into a first model to obtain the test function points corresponding to the requirement document; the first model is a machine learning model trained by testing the test requirement document sample and the annotated test function points; according to the class code in the target code, the test function points corresponding to the target code are determined; the class code is used to indicate the function managed by the target code.

[0025] In some embodiments, the prompt statement includes at least one of a prompt statement based on a test method and a prompt statement based on a business type; the prompt statement based on the test method is used to indicate the generation of a test case related to a specified test method; the prompt statement based on the business type is used to indicate the generation of a test case related to a specified business type.

[0026] On the other hand, a computer device is provided, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the test case generation method as described above.

[0027] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, a code set or an instruction set is stored in the storage medium, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the test case generation method as described above.

[0028] In another aspect, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the test case generation method provided in the above-mentioned various optional implementations.

[0029] The technical solution provided by this application may have the following beneficial effects:

[0030] The computer device obtains a prompt statement based on the test requirement document and target code of the application, and obtains a generated test case by inputting the prompt statement into a generative language model. Among them, the test requirement document clarifies the test objectives and scenarios corresponding to the application, and the new code / modified code in the target code clarifies the new / modified parts corresponding to the application, so that the content indicated by the prompt statement obtained based on the test requirement document and the target code can cover the latest functions or repaired defects of the application while meeting the test objectives and scenarios. The prompt statement also specifies a database composed of application test-related knowledge as background knowledge, so that the generative language model can refer to the background knowledge when generating test cases based on the prompt statement, and generate more accurate and comprehensive test cases. Combined with actual application knowledge and historical testing experience, the practicality and reliability of the test cases generated by the computer device are further improved, the accuracy of test case generation is effectively guaranteed, and the quality and efficiency of test case generation are improved.

[0031] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0033] Figure 1 is a system configuration diagram of a test case generation method involved in one embodiment of the present application;

[0034] Figure 2 is a flow chart of a test case generation method provided by an embodiment of the present application;

[0035] Figure 3 is a flow chart of a test case generation method provided by an embodiment of the present application;

[0036] Figure 4 is a flow chart of a test case generation method provided by an embodiment of the present application;

[0037] Figure 5 It is a system flow chart of a test case generation method provided by an embodiment of the present application;

[0038] Figure 6 It is a technical architecture diagram of a test case generation method provided by an embodiment of the present application;

[0039] Figure 7 This is a schematic diagram of an interface of a test case generation method provided by an embodiment of the present application;

[0040] Figure 8 is a block diagram of a test case generating device provided by an exemplary embodiment of the present application;

[0041] Fig. 9 It is a structural diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0042] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application.

[0043] Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as recited in the appended claims.

[0044] This application proposes a test case generation scheme, which can effectively combine actual application business knowledge and historical testing experience, improve the practicality and reliability of the generated test cases, effectively ensure the accuracy of test case generation, and improve the quality of test case generation. For ease of understanding, some concepts involved in this application are explained below.

[0045] 1) A test case is a set of input data, execution steps, expected results and other related information designed during the software testing process to verify whether the software system meets its functional requirements, performance requirements and other specifications. Each test case corresponds to an independent test purpose, which aims to ensure that a specific function or feature of the software can run correctly as expected.

[0046] 2) AIGC (Artificial Intelligence Generated Content) refers to various types of content automatically created by artificial intelligence technology, such as text, images, audio, video, etc. The creation process of these contents is usually generated by AI models by learning a large amount of data and imitating the style and pattern of human creation to generate corresponding results.

[0047] 3) Automated test cases refer to a set of test cases that use automated test scripts to verify whether the functions and performance of a system or application meet expectations. The core purpose of automated test cases is to improve test efficiency, stability, and coverage, reduce the repetitive work of manual testing, and be able to be automatically executed during continuous integration and continuous delivery, thereby discovering defects in the software more quickly.

[0048] 4) LLM (Large Language Model) is a language model based on deep learning and natural language processing technology with a very large training scale. LLM uses a large amount of text data for training, can understand and generate natural language, and solve a variety of language tasks.

[0049] Figure 1 1 is a system configuration diagram of a test case generation method according to an embodiment of the present application. Figure 1 As shown, the system includes a requesting device 120 and a serving device 130 for test case generation.

[0050] The requester device 120 may be a personal computer device such as a desktop computer, a laptop computer, a personal workstation, or the like.

[0051] The service device 130 may be a server, or a plurality of servers, or a virtualization platform, or a cloud computing service center.

[0052] The requesting device 120 and the serving device 130 may be connected via a communication network. Optionally, the communication network is a wired network or a wireless network.

[0053] Optionally, the above-mentioned wireless network or wired network uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any network, including but not limited to any combination of local area network (LAN), metropolitan area network (MAN), wide area network (WAN), mobile, wired or wireless network, private network or virtual private network. In some embodiments, the data exchanged through the network is represented by technology and / or format including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technology can also be used to replace or supplement the above-mentioned data communication technology.

[0054] The user can upload a test requirement document for indicating the test personnel's test requirements for the application and a target code through the requesting device 120 generated by the test case, where the target code is at least one of a newly added code and a modified code. Based on the test requirement document and the target code, the target test function point is obtained, the business knowledge base is searched, and the business knowledge corresponding to the target test function point in the business knowledge base is obtained. Based on the business knowledge, a prompt statement is obtained to indicate that a test case matching the test requirement document and the target code is generated with a specified database as background knowledge. The computer device inputs the prompt statement into a generative language model to obtain a test case output by the generative language model as a test case corresponding to the application.

[0055] It should be noted that, in the embodiments of the present application, the above solution is implemented by a single-sided device as an example. Optionally, the above solution can also be implemented by the interaction of two-sided devices.

[0056] Figure 2 1 is a flow chart of a test case generation method provided by an embodiment of the present application. The test case generation method can be executed by a computer device, for example, the computer device can be the above-mentioned Figure 1The service device 130 shown, or the computer device mentioned above may also be other computer devices, such as a server, or a personal computer, etc. The video generation method mentioned above may include steps 210, 220 and 230, which are specifically implemented as follows:

[0057] Step 210: Obtain a test requirement document and a target code of the application; the test requirement document is used to indicate the test requirements of the tester for the application; the target code includes at least one of a newly added code and a modified code.

[0058] The above application is a set of computer instructions or data files designed to complete a specific task. In the embodiment of the present application, the above application is an application that is waiting for performance testing after development.

[0059] The test requirement document is a document used to specify the test requirements in detail, and the test requirement document includes but is not limited to at least one of the test scope, test objectives, test strategies, test cases and resource requirements.

[0060] The target code mentioned above refers to one of the codes newly added or modified by developers during the software development cycle.

[0061] The newly added code is the code portion corresponding to the application, which is added by the developer in order to implement new functions or improve existing functions in the application.

[0062] The modified code is the code written by the developer in the code corresponding to the application in order to adjust the existing code in the application or fix known problems.

[0063] In an embodiment of the present application, a computer device includes a code module and a use case module. The code module is used to manage code, such as performing code analysis and querying code in a specified line of code; the use case module is used to manage test requirement documents. Optionally, in an embodiment of the present application, the above two modules (code module and use case module) in the computer device can access each other. For example, in an embodiment of the present application, the computer device calls the code manager in the code module through the use case module to locate the target code, and obtains the test requirement document corresponding to the target code in the code module according to the target code.

[0064] Step 220: Based on the test requirement document and target code of the application, a prompt statement is obtained; the prompt statement is used to indicate that a test case matching the test requirement document and target code is generated with a designated database as background knowledge; the designated database is a database composed of knowledge related to the test of the application.

[0065] The above-mentioned knowledge related to the testing of the application refers to information and data related to the testing of the application, which is used to generate high-quality test cases more efficiently.

[0066] In an embodiment of the present application, after obtaining the test requirement document and target code of the application, the computer device can analyze the test requirement document and the target code respectively to obtain information such as keywords corresponding to the test requirement document and the target code, and assemble the analyzed information into a prompt statement.

[0067] In an embodiment of the present application, after obtaining the test requirement document and target code of the application, the computer device can optionally perform natural language processing on the test requirement document and target code of the application to obtain a prompt statement; for example, keywords can be obtained by inputting the test requirement document of the application and the analysis result text of the target code into a machine learning model, and prompt statements can be generated by keyword construction (for example, the keywords are assembled into prompt statements according to preset grammatical rules and templates), wherein the above-mentioned machine learning model is a model that has the ability to obtain keywords based on the test requirement document of the application and the analysis result text of the target code.

[0068] Step 230: Input the prompt statement into the generative language model to obtain a test case output by the generative language model.

[0069] The generative language model is an artificial intelligence model that can generate various forms of content such as natural language text, images, audio, video, etc. through natural language technology. For example, the generative language model can be a large language model.

[0070] In an embodiment of the present application, after obtaining a prompt statement, the computer device inputs the prompt statement into a generative language model, and the generative language model outputs a test case corresponding to the prompt statement, which is used as a test case for performing a test operation on the application.

[0071] In an embodiment of the present application, a computer device obtains a prompt statement based on the test requirement document and target code of an application, and obtains a generated test case by inputting the prompt statement into a generative language model. Among them, the test requirement document clarifies the test objectives and scenarios corresponding to the application, and the new code / modified code in the target code clarifies the new / modified parts corresponding to the application, so that the content indicated by the prompt statement obtained based on the test requirement document and the target code can cover the latest functions or repaired defects of the application while meeting the test objectives and scenarios. The prompt statement also specifies a database composed of application test-related knowledge as background knowledge, so that the generative language model can refer to the background knowledge when generating test cases based on the prompt statement, and generate more accurate and comprehensive test cases. Combined with actual application knowledge and historical testing experience, the practicality and reliability of the test cases generated by the computer device are further improved, the accuracy of test case generation is effectively guaranteed, and the quality and efficiency of test case generation are improved.

[0072] based on Figure 2 , please refer to Figure 3 , Figure 3 This is a flowchart of a video generation method provided by an embodiment of the present application. Figure 2 Step 220 in the embodiment can be implemented as step 220a and step 220b, as follows:

[0073] Step 220a: Determine the test function points corresponding to the test requirement document and the target code respectively.

[0074] The above test function points are functions to be tested in the application.

[0075] In an embodiment of the present application, a test requirement document may correspond to one or more test function points; a target code may correspond to one or more test function points.

[0076] In some embodiments, the computer device can determine the test function points corresponding to the test requirement document from the test requirement document. For example, the test requirement document contains a description of the function to be tested, the computer device reads the function description in the test requirement document, and uses the functions in the function description as the test function points corresponding to the test requirement document; the computer device can determine the test function points corresponding to the target code from the target code. For example, the target code contains a class code for locating the functional module, the computer device reads the class code, and uses the functions corresponding to the class code as the test function points corresponding to the target code.

[0077] In other embodiments, the computer device can determine the test function points corresponding to the test requirement document and the target code respectively by means of machine learning model analysis. For example, after the computer device obtains the test requirement document, the test requirement document can be input into the machine learning model, and the machine learning model analyzes the test requirement document and outputs the test function points corresponding to the test requirement document; for another example, after the computer device obtains the target code, the target code can be analyzed to obtain the analysis result text of the target code, for example, the analysis result text of the target code can include the names of each function involved in the target code, and the analysis result text of the target code is input into the machine learning model, and the machine learning model processes the analysis result text of the target code and outputs the test function points corresponding to the target code.

[0078] Step 220b: Obtain prompt statements based on the test function points and business knowledge base corresponding to the test requirement document and the target code respectively; the business knowledge base is used to store business knowledge corresponding to different test function points; the business knowledge includes at least one of function point description documents, testing experience, preset test cases, case design methods and business terminology explanations.

[0079] Optionally, the business knowledge base is a pre-set database used to store business knowledge corresponding to various test function points.

[0080] The function point description document is a document used to describe in detail the specific implementation method, input and output requirements, interaction logic and other information of the function point.

[0081] Among them, the above-mentioned testing experience refers to the experience and skills accumulated when historical computer equipment performs testing operations.

[0082] Among them, the above preset test cases are a set of test steps and expected results designed in advance according to the requirements of the functional points.

[0083] Among them, the above use case design method is a method used to guide the design of test cases based on functional requirements.

[0084] Among them, the above-mentioned business terminology explanations provide clear definitions and explanations of professional terms, industry terms, specific vocabulary, etc. involved in projects or systems.

[0085] In an embodiment of the present application, by determining the test function points corresponding to the test requirement document and the target code respectively, the specific functions that need to be tested in the application can be accurately obtained. The business knowledge base not only stores the function description documents of different test function points, but also contains rich testing experience and preset test cases, so that the prompt statements obtained based on the test function points and the business knowledge base can effectively cover the test function points corresponding to the application, and effectively ensure the quality of the prompt statements.

[0086] Based on the scheme shown in any one or more of the above-mentioned embodiments, the above-mentioned step 220b can be implemented as obtaining the target test function point according to the test requirement document and the test function points corresponding to the target code respectively; searching the business knowledge base to obtain the business knowledge corresponding to the target test function point in the business knowledge base; and obtaining a prompt statement based on the business knowledge.

[0087] The above prompt statement may be used to instruct to generate a test case matching the test requirement document and the target code using the above business knowledge as background knowledge.

[0088] In an embodiment of the present application, optionally, after obtaining the test function points corresponding to the test requirement document and the target code respectively, the computer device can determine the target test function points by combining the test function points corresponding to the test requirement document and the test function points corresponding to the target code.

[0089] Among them, in the above-mentioned business knowledge base, there is at least one test function point and at least one business knowledge corresponding to the test function point.

[0090] In an embodiment of the present application, after obtaining the target test function point, the computer device traverses the business knowledge base according to the function name of the target test function point, obtains the business knowledge corresponding to the function name of the target test function point, and uses it as the business knowledge corresponding to the target test function point.

[0091] In an embodiment of the present application, a computer device obtains business knowledge corresponding to a target test function point by searching a business knowledge base. The business knowledge includes at least one of function point description documents, testing experience, preset test cases, use case design methods, and business terminology explanations. The business knowledge provides a variety of information corresponding to the test function points from different levels, so that prompt statements obtained based on business knowledge are more accurate and of better quality.

[0092] Based on the solutions shown in any one or more of the above embodiments, the computer device obtains the union of the test function points corresponding to the test requirement document and the test function points corresponding to the target code as the target test function points.

[0093] In an embodiment of the present application, after obtaining at least one test function point corresponding to the test requirement document and at least one test function point corresponding to the target code, the computer device obtains the union of the two as the target test function point.

[0094] Exemplarily, the test requirement document obtained by the computer device corresponds to three test function points "login, register, and logout"; the target code corresponds to two test function points "login, logout"; the computer device takes "login, register, and logout" as the target test function points.

[0095] In an embodiment of the present application, a computer device obtains the union of the test function points corresponding to the test requirement document and the test function points corresponding to the target code as the target test function points, ensuring that the target test function points can completely cover the function points indicated by the test requirement document and the target code, and effectively cover the function points to be tested of the application.

[0096] Based on the scheme shown in any one or more of the above-mentioned embodiments, the computer device obtains the relevant function points of the test function points corresponding to the test requirement document, and the relevant function points of the test function points corresponding to the target code; obtains the test function points corresponding to the test requirement document, the relevant function points of the test function points corresponding to the test requirement document, the test function points corresponding to the target code, and the union of the relevant function points of the test function points corresponding to the target code as the target test function points.

[0097] Among them, the above-mentioned related function points are function points whose function types or function contents are related to the test function points. The related relationships include but are not limited to function type associations (for example, the functions of the related function points and the test function points belong to the same function type), function content associations (for example, the related function points and the test function points have a dependent or mutually influential relationship in terms of function content) and calling relationships.

[0098] In an embodiment of the present application, the test function point corresponding to the test requirement document has one or more related function points; the test function point corresponding to the target code has one or more related function points.

[0099] In an embodiment of the present application, after obtaining the test requirement document and the test function points corresponding to the target code, the computer device obtains the corresponding related function points based on the test function points. Optionally, the computer device can search the related function point database based on the test function points to obtain the related function points corresponding to the test function points.

[0100] The above-mentioned related function point database stores at least one test function point of each of the test requirement document and the target code, and at least one related function point corresponding to the test function point. In the embodiment of the present application, after obtaining the test function point, the computer device traverses the related function point database, finds the test function point, and obtains the related function point corresponding to the test function point.

[0101] Exemplarily, the test function point corresponding to the test requirement document is "login", the related function point of the test function point corresponding to the test requirement document is "face recognition", the test function points corresponding to the target code are "login", "face recognition", and "fingerprint recognition", and the related function points of the test function point corresponding to the target code are "face recognition" and "fingerprint recognition", and the computer device obtains the union of the above function points "login", "face recognition", and "fingerprint recognition" as the target test function point.

[0102] In an embodiment of the present application, the above scheme expands the relevant function points of the test function points corresponding to each of the test requirement document and the target code, and takes the union of the test function points of the test requirement document and the target code and their relevant function points as the target test function points, so that the target test function points can not only comprehensively cover all test function points of the application, but also effectively explore potential related function points, thereby improving the reliability of the target test function points.

[0103] Based on the scheme shown in any one or more of the above-mentioned embodiments, the computer device queries the function point relationship table through the test function points corresponding to the test requirement document to obtain the relevant function points of the test function points corresponding to the test requirement document; the function point relationship table stores the correlation between the various function points of the application; the function point relationship table is queried through the test function points corresponding to the target code to obtain the relevant function points of the test function points corresponding to the target code.

[0104] The function point relationship table is a list for storing the relationship between at least one test function point and its corresponding related function point. The function point relationship table at least includes the test function point corresponding to the test requirement document, the related function points of the test function point corresponding to the test requirement document, the related relationship between the test function point corresponding to the test requirement document and its related function points, the test function point corresponding to the target code, the related function points of the test function point corresponding to the target test code, and the related relationship between the test function point corresponding to the target code and its related function points.

[0105] The correlation between the various functional points of the above application includes but is not limited to at least one of a function type association, a function content association, a call relationship, a dependency relationship and a sequence relationship.

[0106] Optionally, after obtaining the test function points of the test requirement document / target code, the computer device queries the function point relationship table to obtain the relevant function points in the function point relationship table that correspond to the test function points of the test requirement document / target code as the relevant function points of the test requirement document / target code. Further, the computer device can obtain the correlation between each function point according to the test requirement document / target code, and in the case of obtaining multiple relevant function points corresponding to the test function point, based on the correlation between each function point, screen and retain the relevant function points that are closest to the requirements of the test requirement document / target code.

[0107] In an embodiment of the present application, the function point relationship table stores the correlation between the various function points of the application, and provides comprehensive and detailed function point association information. By querying the function point relationship table, the computer device can accurately identify the relevant function points of each function point in the test requirement document and the target code, effectively ensuring the accuracy and comprehensiveness of the acquisition of relevant function points.

[0108] Based on the scheme shown in any one or more of the above-mentioned embodiments, the computer device obtains a prompt statement template and a historical test case corresponding to the target test function point; according to the prompt statement template, the target test function point, the historical test case and the business knowledge are combined to obtain a prompt statement.

[0109] The above prompt statement template is a text structure predefined by the developer and is used to generate a specific prompt statement. The prompt statement template contains placeholders for filling in specific content according to actual test function points and historical test cases.

[0110] The historical test cases corresponding to the target test function points are test cases that have been used by the computer device in the test process of the target test function points before the current test operation. The historical test cases include specific test steps, expected test results and actual test results.

[0111] In the embodiment of the present application, after obtaining the target test function point, historical test case and business knowledge, the computer device can combine these three data in a logical order to obtain a prompt statement. It should be noted that the combination order of the target test function point, historical test case and prompt statement template is not limited to a logical order, and can be in other orders.

[0112] In an embodiment of the present application, the prompt statement template provides a standardized framework to ensure that the obtained prompt statement is standardized in format and structure. The historical test cases corresponding to the target test function points provide actual test experience and data for the test function points. The computer device combines the target test function points, historical test cases and business knowledge according to the prompt statement template to obtain the prompt statement, which can ensure the accuracy and comprehensiveness of the prompt statement.

[0113] Based on the scheme shown in any one or more of the above embodiments, the computer device combines the target test function point, historical test case and business knowledge according to the prompt statement template to obtain the prompt statement, and obtains the test type information, and the test type information is used to indicate that the type of test performed on the application is at least one of a front-end test and a back-end test. In some embodiments, the computer device combines the test type information, the target test function point, the historical test case and business knowledge according to the prompt statement template to obtain the prompt statement.

[0114] Among them, the above-mentioned front-end testing includes but is not limited to at least one of mobile terminal, PC terminal, WEB terminal and H5.

[0115] In an embodiment of the present application, the computer device can determine the test type required for the functional points corresponding to the test requirement document and the target code respectively based on the test requirement document and the target code, and obtain the test type information.

[0116] In some embodiments, the computer device can analyze the test requirement document and determine whether the functions in the test requirement document need to be tested for front-end / back-end testing. For example, if the test requirement document indicates that the responsiveness of the user interface needs to be verified, it means that this function point needs to be tested for front-end testing; if the test requirement document indicates functions such as database operations and API (Application Programming Interface) interface calls, it means that back-end testing is needed.

[0117] In some embodiments, the computer device can analyze the code structure, the libraries used, and the technology stack of the target code to determine whether the functional points corresponding to the target code need to be tested for the front-end / back-end. Optionally, the computer device determines the test type corresponding to the functional points corresponding to the target code by means of static code analysis, for example, by parsing the grammatical structure of the target code, determining the properties and methods of the classes in the target code, and inferring that the functions corresponding to the target code belong to the front-end / back-end, thereby determining the test type corresponding to the target code; Optionally, the computer device determines the test type corresponding to the functional points corresponding to the target code by means of dynamic code analysis, for example, by directly running the target code or simulating the target code running environment, observing the behavior of the classes in the target code under different conditions, and further confirming the test type corresponding to the target code.

[0118] For example, if the target code makes extensive use of JavaScript, HTML (Hypertext Markup Language) and CSS (Cascading Style Sheets), it means that the target code is a front-end code and the corresponding functional points need to be tested on the front-end; if the target code contains database queries, server-side API implementations, etc., it means that the target code is a back-end code and the corresponding functional points need to be tested on the back-end.

[0119] In the embodiment of the present application, after obtaining the test type information, target test function points, and historical test cases, the computer device can combine these data information in a logical order to obtain a prompt statement. It should be noted that the above combination order is not limited to a logical order, and can be in other orders.

[0120] In an embodiment of the present application, the test type information clarifies the angle from which the computer device performs testing on the application, ensuring that the prompt statements obtained by the computer device can cover different test levels in a targeted manner. By combining the test type information with other elements (target test function points, historical test cases, and business knowledge), the prompt statements obtained can more comprehensively indicate the test requirements of the target test function points, effectively improving the quality of the prompt statements.

[0121] Based on the scheme shown in any one or more of the above-mentioned embodiments, the above-mentioned step 220a can be implemented by inputting the test requirement document into the first model to obtain the test function points corresponding to the requirement document; the first model is a machine learning model trained by testing the test requirement document sample and the marked test function points; according to the class code in the target code, the test function points corresponding to the target code are determined; the class code is used to indicate the function managed by the target code.

[0122] In an embodiment of the present application, after obtaining a test requirement document, the computer device can input at least one of the images and texts in the test requirement document into a first model. The first model performs an analysis operation on the input content and outputs a predicted test function point as the test function point corresponding to the test requirement document.

[0123] In an embodiment of the present application, after obtaining the target code, the computer device analyzes the class code in the target code, parses the grammatical structure of the class code, identifies the properties and methods of the class, and determines the function of the class as the test function point corresponding to the target code.

[0124] In an embodiment of the present application, the computer device obtains the test function points corresponding to the requirement document through machine learning model analysis, which can effectively ensure the accuracy of the test function points; the class code in the target code can quickly and accurately determine the test function points corresponding to the target code, effectively ensuring the accuracy of the test function points obtained by the computer device.

[0125] Based on the scheme shown in any one or more of the above-mentioned embodiments, the prompt statement includes at least one of a prompt statement based on a test method and a prompt statement based on a business type; the prompt statement based on the test method is used to indicate the generation of a test case related to a specified test method; the prompt statement based on the business type is used to indicate the generation of a test case related to a specified business type.

[0126] Among them, the above-mentioned testing methods include but are not limited to at least one of boundary value testing, equivalence class testing, data testing and causal testing.

[0127] Among them, the above business types include but are not limited to at least one of membership business, event business, advertising business and live broadcast business.

[0128] In an embodiment of the present application, prompt statements based on the test method can effectively indicate the specific test method, and prompt statements based on the business type can effectively indicate the business scenarios and business processes corresponding to the application. By combining prompt statements based on the test method and prompt statements based on the business type, the obtained prompt statements can more comprehensively cover the testing requirements of the application and effectively ensure the quality of the prompt statements.

[0129] Based on the solutions shown in any one or more of the above embodiments, please refer to Figure 4 , Figure 4 is a flow chart of a test case generation method provided by an embodiment of the present application. The test case generation method shown in this embodiment can be executed by a computer device, which can be Figure 1 The test case generation service device 130 in the embodiment.

[0130] In an embodiment of the present application, a computer device may obtain a test requirement document for instructing a tester on an application to be tested; and obtain at least one of a newly added code and a modified code containing the application to be tested as a target code.

[0131] After the computer device obtains the test requirement document and the target code corresponding to the application program to be tested, the computer device determines the target test function point based on the test requirement document and the target code.

[0132] like Figure 4 As shown in part (a), the computer device inputs the test requirement document into the machine learning model (first model) trained by the test requirement document sample and the annotated test function points, obtains the test function points corresponding to the test requirement document, obtains the test function points corresponding to the target code by analyzing the class code in the target code for indicating the functions managed by the target code, and the computer device obtains the union of the test function points corresponding to the test requirement document and the test function points corresponding to the target code as the target test function points.

[0133] like Figure 4 As shown in part (b), after the computer device obtains the test function points corresponding to the test requirement document and the test function points corresponding to the target code, it queries the function point relationship table storing the correlation between the various function points of the application program according to the test function points, obtains the relevant function points corresponding to the test requirement document and the target code respectively, and obtains the union of the test function points corresponding to the test requirement document, the test function points corresponding to the target code, the relevant function points corresponding to the test requirement document, and the relevant function points corresponding to the target code as the target test function points.

[0134] After obtaining the target test function point corresponding to the application, the computer device queries a knowledge base containing at least one business knowledge to obtain the business knowledge corresponding to the target test function point, including at least one of a function point description document, testing experience, preset test cases, a case design method, and a business term explanation.

[0135] The computer device obtains test type information indicating that the type of test performed on the application is at least one of a front-end test and a back-end test, and combines the target test function points, historical test cases and business knowledge according to a prompt statement template to obtain a prompt statement including at least one of a prompt statement based on a test method and a prompt statement based on a business type. The prompt statement based on the test method is used to indicate the generation of test cases related to the specified test method; the prompt statement based on the business type is used to indicate the generation of test cases related to the specified business type.

[0136] After obtaining the prompt statement, the computer device inputs the prompt statement into the generative language model to obtain a test case output by the generative language model, that is, a test case corresponding to the application program.

[0137] In an embodiment of the present application, the computer device of the above-mentioned scheme extracts test function points from the test requirement document through a machine learning model, analyzes the target code, and directly captures the function points that need to be tested in the application from the code level, ensuring that test requirements that have not been discovered due to insufficient document description are not missed; other function points related to the target test function points are obtained by querying the function point relationship table, thereby improving the coverage and depth of the test cases. The computer device queries a knowledge base containing business knowledge, matches the corresponding business background information for each target test function point, and can ensure that the generated test cases are closer to the actual application scenarios. By combining elements such as test type information, historical test cases, and prompt statement templates, a guiding prompt statement is constructed and input into the generative language model to automatically generate test cases. The test cases generated based on detailed business knowledge and historical data effectively ensure the accuracy and quality of test case generation.

[0138] Based on the above Figure 2 and Figure 3 The steps in the embodiment of the present application illustrate a method based on AIGC capability prediction function and automated use case.

[0139] Please refer to Figure 5 , Figure 5 It is a system flow chart of a test case generation method provided by an embodiment of the present application.

[0140] In the embodiment of the present application, the computer device uses AIGC technology in combination with business needs, through the modified code, business knowledge base and historical use cases, etc., combined with the AI ​​model to automatically predict the needs or modified functions and automated test cases, effectively improving the integrity of the generated test cases. This solution includes three parts, as follows.

[0141] (1) When the requirements are submitted for testing, parse the requirements document content and code modification module.

[0142] In an embodiment of the present application, a computer device splits the content of a requirement document into small functional points or module points through an AI model, and different functional points / module points correspond to different functions / types.

[0143] The AI ​​model can be an existing model on the market, or a model that has been fine-tuned based on an existing model. The AI ​​model input is the content of the requirement (including text and image content). The model training data includes historical requirement documents, historical use cases, historical defects, conventional testing methods, tester settings (such as senior testers), etc. The AI ​​model output is the functional points of the requirement design (for example, the requirement for a song playback page may involve playback, playlist, playback mode, playback background, etc.)

[0144] In the embodiment of the present application, the computer device is divided into different functional points / module points according to the functional points of the product.

[0145] In an embodiment of the present application, the computer device analyzes and records the code files, code directories, and code modules that are required or modified.

[0146] Among them, the above code files are files and code directories corresponding to the modified codes that can be directly found after the developer submits them. The code files and code directories can correspond to the functional points.

[0147] (2) Using the knowledge base, basic functional use cases, and basic automation use cases as the background of the large model, prompts suitable for different businesses are sorted out (the basic use cases and basic automation use cases are associated with the business knowledge base through modules, and the AI ​​model is used for business analysis).

[0148] Please refer to Figure 6 , Figure 6 This is a technical architecture diagram of a test case generation method provided by an embodiment of the present application.

[0149] In the embodiment of the present application, the prompt has a corresponding template, and the computer device can assemble the function points, historical use cases, and knowledge base content together to obtain the prompt.

[0150] (3) Combine the contents of (1) and (2) and input them into the big model in a unified manner. Utilize the intelligent analysis and combination capabilities of the big model to intelligently predict the required test cases and automatically combine the corresponding functional test cases and automation test cases.

[0151] Please refer to Figure 7 , Figure 7 It is a schematic diagram of an interface of a test case generation method provided by an embodiment of the present application.

[0152] In an embodiment of the present application, during the requirement submission stage, the above-mentioned scheme parses the requirements document content and code modification module through the AI ​​model, and breaks down the requirements document into specific function points or module points, thereby ensuring the accuracy and comprehensiveness of the function point division; by constructing background information including a business knowledge base, basic function use cases, and basic automation use cases, prompts are generated customized for specific businesses, which not only considers the function points themselves, but also combines historical data and business scenarios to make the generated test cases more in line with actual application needs. The computer device uniformly inputs the above-mentioned parsed function points and customized prompts into the large model, and automatically generates the required test cases. It can not only understand complex business logic, but also flexibly adjust the test case generation strategy according to different business needs, ensuring that the generated test cases cover all necessary test points and meet the characteristics of specific businesses, effectively improving the quality of test case generation.

[0153] The above is only an embodiment of the present application and should not be regarded as limiting the present application. Professionals should understand that various deformations and modifications can be made to the embodiments to adapt to different application requirements. Therefore, the scope of the present application should be limited by the claims attached to the claims.

[0154] Please refer to Figure 8 , which shows a block diagram of a test case generation device provided by an exemplary embodiment of the present application, the test case generation device can be implemented as all or part of a computer device by hardware or a combination of hardware and software to achieve the above Figures 2 to 3 All or part of the steps in the embodiments shown. Figure 8 As shown, the test case generating device comprises:

[0155] The test requirement document and target code acquisition module 801 is used to acquire the test requirement document and target code of the application; the test requirement document is used to indicate the test requirements of the tester for the application; the target code includes at least one of a newly added code and a modified code;

[0156] The prompt statement acquisition module 802 is used to obtain a prompt statement based on the test requirement document and the target code of the application program; the prompt statement is used to indicate that a test case matching the test requirement document and the target code is generated with the specified database as background knowledge; the specified database is a database composed of knowledge related to the test of the application program;

[0157] The test case acquisition module 803 is used to input the prompt sentence into the generative language model to obtain the test case output by the generative language model.

[0158] In some embodiments, the prompt statement acquisition module 802 is used to determine the test function points corresponding to the test requirement document and the target code respectively; based on the test function points corresponding to the test requirement document and the target code respectively and the business knowledge base, the prompt statement is obtained; the business knowledge base is used to store business knowledge corresponding to different test function points; the business knowledge includes at least one of function point description documents, testing experience, preset test cases, use case design methods and business terminology explanations.

[0159] In some embodiments, the prompt statement acquisition module 802 is used to obtain the target test function point according to the test requirement document and the test function points corresponding to the target code respectively; search the business knowledge base to obtain the business knowledge corresponding to the target test function point in the business knowledge base; and obtain the prompt statement based on the business knowledge.

[0160] In some embodiments, the prompt statement obtaining module 802 is used to obtain the union of the test function points corresponding to the test requirement document and the test function points corresponding to the target code as the target test function points.

[0161] In some embodiments, the prompt statement acquisition module 802 is used to obtain the relevant function points of the test function points corresponding to the test requirement document, and the relevant function points of the test function points corresponding to the target code; obtain the test function points corresponding to the test requirement document, the relevant function points of the test function points corresponding to the test requirement document, the test function points corresponding to the target code, and the union of the relevant function points of the test function points corresponding to the target code as the target test function points.

[0162] In some embodiments, the prompt statement obtaining module 802 is used to query the function point relationship table through the test function points corresponding to the test requirement document to obtain the relevant function points of the test function points corresponding to the test requirement document; the function point relationship table stores the correlation between the various function points of the application; the function point relationship table is queried through the test function points corresponding to the target code to obtain the relevant function points of the test function points corresponding to the target code.

[0163] In some embodiments, the prompt statement acquisition module 802 is further used to obtain a prompt statement template and a historical test case corresponding to the target test function point;

[0164] The prompt statement obtaining module 802 is used to combine the target test function point, the historical test case and the business knowledge according to the prompt statement template to obtain the prompt statement.

[0165] In some embodiments, the apparatus further comprises:

[0166] A test type information acquisition module is used to combine the target test function points, historical test cases and business knowledge according to the prompt statement template, and obtain the test type information before obtaining the prompt statement. The test type information is used to indicate that the type of the test performed on the application is at least one of a front-end test and a back-end test;

[0167] The prompt statement obtaining module 802 is used to combine the test type information, target test function points, historical test cases and business knowledge according to the prompt statement template to obtain the prompt statement.

[0168] In some embodiments, the prompt statement acquisition module 802 is used to input the test requirement document into the first model to obtain the test function points corresponding to the requirement document; the first model is a machine learning model trained by testing the test requirement document sample and the marked test function points; based on obtaining the class code in the target code, the test function points corresponding to the target code are determined; the class code is used to indicate the function managed by the target code.

[0169] In some embodiments, the prompt statement includes at least one of a prompt statement based on a test method and a prompt statement based on a business type; the prompt statement based on the test method is used to indicate the generation of a test case related to the specified test method; the prompt statement based on the business type is used to indicate the generation of a test case related to the specified business type.

[0170] Please refer to Fig. 9 , Fig. 9 9 is a schematic diagram of the structure of a computer device provided by an exemplary embodiment of the present application. The computer device 900 includes a central processing unit (CPU) 901, a system memory 904 including a random access memory (RAM) 902 and a read-only memory (ROM) 903, and a system bus 905 connecting the system memory 904 and the central processing unit 901. The computer device 900 also includes a basic input / output system (I / O system) 906 that helps transmit information between various devices in the computer, and a large-capacity storage device 907 for storing an operating system 913, application programs 914 and other program modules 915.

[0171] The basic input / output system 906 includes a display 908 for displaying information and an input device 909 such as a mouse and a keyboard for user inputting information. The display 908 and the input device 909 are connected to the central processing unit 901 through an input / output controller 910 connected to the system bus 905. The basic input / output system 906 may also include an input / output controller 910 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 910 also provides output to a display screen, a printer, or other types of output devices.

[0172] The mass storage device 907 is connected to the central processing unit 901 through a mass storage controller (not shown) connected to the system bus 905. The mass storage device 907 and its associated computer readable media provide non-volatile storage for the computer device 900. That is, the mass storage device 907 may include a computer readable medium (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory) drive.

[0173] Without loss of generality, computer readable media may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer readable instructions, data structures, program modules or other data. Computer storage media include RAM (Random Access Memory), ROM (Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory or other solid-state storage technologies, CD-ROM, DVD (Digital Video Disc) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that computer storage media are not limited to the above. The above-mentioned system memory 904 and mass storage device 907 can be collectively referred to as memory.

[0174] The computer device 900 can be connected to the Internet or other network devices through a network interface unit 911 connected to the system bus 905 .

[0175] The memory also includes one or more programs, one or more programs are stored in the memory, and the central processing unit 901 implements the one or more programs by executing the one or more programs. Figures 2 to 3 All or part of the steps in the method shown.

[0176] In an exemplary embodiment, a chip is also provided. The chip includes a programmable logic circuit and / or program instructions. When the chip runs on a computer device, it is used to implement all or part of the steps of the method shown in the above embodiments of the present application.

[0177] In an exemplary embodiment, a computer program product is also provided, the computer program product includes computer instructions, the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor reads and executes the computer instructions from the computer-readable storage medium to implement all or part of the steps of the method shown in the above-mentioned various embodiments of the present application.

[0178] In an exemplary embodiment, a computer-readable storage medium is also provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement all or part of the steps of the method shown in the above-mentioned embodiments of the present application.

[0179] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program. The above program may be stored in a computer-readable storage medium. The above storage medium may be a read-only memory, a disk or an optical disk, etc.

[0180] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.

[0181] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A test case generation method, characterized in that: The method comprises: The test requirement document and the target code of the application are obtained; the test requirement document is used to indicate the test requirements of the tester for the application; the target code includes at least one of a newly added code and a modified code; Based on the test requirement document of the application and the target code, a prompt statement is obtained; the prompt statement is used to indicate that a test case matching the test requirement document and the target code is generated with a designated database as background knowledge; the designated database is a database composed of knowledge related to the test of the application; The prompt sentence is input into a generative language model to obtain the test case output by the generative language model.

2. The method according to claim 1, characterized in that The step of obtaining a prompt statement based on the test requirement document of the application program and the target code includes: Determine the test function points corresponding to the test requirement document and the target code respectively; Based on the test function points and the business knowledge base corresponding to the test requirement document and the target code respectively, a prompt statement is obtained; the business knowledge base is used to store the business knowledge corresponding to the different test function points; the business knowledge includes at least one of a function point description document, testing experience, preset test cases, use case design methods and business terminology explanations.

3. The method according to claim 2, characterized in that Based on the test function points and the business knowledge base respectively corresponding to the requirement document and the target code, a prompt statement is obtained, including: Obtain target test function points according to the test requirement document and the test function points corresponding to the target code respectively; Searching a business knowledge base to obtain business knowledge corresponding to the target test function point in the business knowledge base; Based on the business knowledge, a prompt statement is obtained.

4. The method according to claim 3, characterized in that The obtaining target test function points according to the test requirement document and the test function points corresponding to the target code respectively includes: A union of the test function points corresponding to the test requirement document and the test function points corresponding to the target code is obtained as the target test function points.

5. The method according to claim 3, characterized in that: The obtaining target test function points according to the test requirement document and the test function points corresponding to the target code respectively includes: Obtain relevant function points of the test function points corresponding to the test requirement document and relevant function points of the test function points corresponding to the target code; Obtain a union of the test function points corresponding to the test requirement document, the related function points of the test function points corresponding to the test requirement document, the test function points corresponding to the target code, and the related function points of the test function points corresponding to the target code as the target test function point.

6. The method according to claim 5, characterized in that The obtaining of the relevant function points of the test function points corresponding to the test requirement document and the relevant function points of the test function points corresponding to the target code includes: By querying the function point relationship table corresponding to the test function point of the test requirement document, the relevant function points of the test function point corresponding to the test requirement document are obtained; the function point relationship table stores the relevant relationship between the various function points of the application program; The function point relationship table is queried through the test function points corresponding to the target code to obtain the related function points of the test function points corresponding to the target code.

7. The method according to claim 3, characterized in that The method further comprises: Obtain a prompt statement template and a historical test case corresponding to the target test function point; The obtaining of a prompt statement based on the business knowledge includes: According to the prompt statement template, the target test function point, the historical test case and the business knowledge are combined to obtain a prompt statement.

8. The method according to claim 7, characterized in that Before obtaining a prompt statement by combining the target test function point, the historical test case and the business knowledge according to the prompt statement template, the method further includes: Acquire test type information, where the test type information is used to indicate that the type of test performed on the application is at least one of a front-end test and a back-end test; The step of combining the target test function point, the historical test case and the business knowledge according to the prompt statement template to obtain a prompt statement includes: According to the prompt statement template, the test type information, the target test function point, the historical test case and the business knowledge are combined to obtain the prompt statement.

9. The method according to claim 2, characterized in that: The determining the test function points corresponding to the test requirement document and the target code respectively includes: Input the test requirement document into a first model to obtain the test function points corresponding to the requirement document; the first model is a machine learning model trained by the test requirement document sample and the annotated test function points; According to the class code in the target code, the test function point corresponding to the target code is determined; the class code is used to indicate the function managed by the target code.

10. The method according to any one of claims 1 to 9, characterized in that: The prompt statement includes at least one of a prompt statement based on a test method and a prompt statement based on a business type; the prompt statement based on a test method is used to instruct the generation of a test case related to a specified test method; the prompt statement based on a business type is used to instruct the generation of a test case related to a specified business type.

11. A test case generating device, characterized in that: The device comprises: A test requirement document and target code acquisition module, used to acquire a test requirement document and target code of an application; the test requirement document is used to indicate the test requirements of the tester for the application; the target code includes at least one of a newly added code and a modified code; A prompt statement acquisition module is used to obtain a prompt statement based on the test requirement document of the application and the target code; the prompt statement is used to indicate that a test case matching the test requirement document and the target code is generated with a designated database as background knowledge; the designated database is a database composed of knowledge related to the test of the application; The test case acquisition module is used to input the prompt sentence into the generative language model to obtain the test case output by the generative language model.

12. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores instructions, and the instructions are executed by the processor to implement the test case generation method according to any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that: The storage medium stores instructions, and the instructions are executed by a processor of a computer device to implement the test case generation method as described in any one of claims 1 to 10.

14. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium; the computer instructions are read and executed by a processor of a computer device to implement the test case generation method as described in any one of claims 1 to 10.

Citation Information

Cited By

  • Method, device and equipment for generating test case based on large language model

    CN120803950A

  • Methods, apparatus, and devices for generating test cases based on large language models

    CN120803950B

  • Test case generation method and device, equipment and computer program product

    CN121070344A