A method, apparatus, storage medium and electronic device for determining test cases
By obtaining the iterative requirements document and code difference analysis results, and using large model agents to filter and generate test cases from the test case library, the problem of incomplete test cases in the existing technology is solved, and more accurate product testing requirements and improved testing efficiency are achieved.
Patent Information
- Application Number
- CN202510207331.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2045-02-25
AI Technical Summary
When determining test cases, the existing technology only relies on the mounting relationship between the manually marked test case library and the engineering code, resulting in incomplete functions of the target test case and inaccurately realizing product testing requirements, which affects testing efficiency.
By obtaining the iterative requirements document and code difference analysis results of the target product, the first large model agent is used to retrieve candidate test cases from the test case library, and the first test case is generated in the second large model agent, and the second test case that meets similar conditions in the candidate test case is combined to form the target test case.
It improves the comprehensive understanding of target product requirements, reduces the process of manually maintaining test cases and code mapping relationships, and the generated test cases can more accurately realize product testing requirements and improve product testing efficiency.
Smart Images

Figure CN119690858B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to a method, apparatus, storage medium, and electronic device for determining test cases. Background Art
[0002] Test cases for a product are key tools to ensure that the software or system operates correctly according to the expected functions. They not only help verify the quality of the developed code but also confirm whether the product requirements are accurately implemented.
[0003] Currently, in the process of determining test cases for a product to be tested, it is necessary to determine the engineering code of the product to be tested, and then, based on the mapping relationship between the manually labeled test case library and the engineering code, select the test cases in the test case library for testing the product to be tested, and then determine the selected test cases as the target test cases corresponding to the product to be tested.
[0004] However, using this method of determining test cases, only selecting test cases based on the mapping relationship between the manually labeled test case library and the engineering code may result in incomplete functions of the selected target test cases. During the process of using the selected target test cases to test the product to be tested, there may also be a situation where the product test requirements cannot be accurately implemented, thus affecting the test efficiency of the product to be tested. Summary of the Invention
[0005] In view of this, this application provides a method, apparatus, storage medium, and electronic device for determining test cases, mainly aiming to improve the technical problem that the existing technology only selects test cases based on the mapping relationship between the manually labeled test case library and the engineering code, which may result in incomplete functions of the selected target test cases, and there may also be a situation where the product test requirements cannot be accurately implemented during the process of using the selected target test cases to test the product to be tested, thus affecting the test efficiency of the product to be tested.
[0006] In a first aspect, this application provides a method for determining test cases, including:
[0007] Obtain the iterative requirements document and the code difference analysis result corresponding to the target product, where the code difference analysis result is obtained by performing a difference analysis on the engineering code corresponding to the target product;
[0008] In the first large model agent, based on the iterative requirements document and the code difference analysis result, retrieve candidate test cases that meet the first similarity condition from the test case library;
[0009] In the second largest model agent, based on the target code difference analysis result in the code difference analysis result, the iterative requirement document, and the predetermined prompt information, a first test case is generated, where the target code difference analysis result is the code difference analysis result corresponding to the test cases in the candidate test cases that do not meet the second similarity condition;
[0010] The first test case and the second test cases in the candidate test cases that meet the second similarity condition are combined to form the target test case corresponding to the target product.
[0011] In a second aspect, the present application provides a device for determining a test case, including:
[0012] An acquisition module configured to acquire an iterative requirement document and a code difference analysis result corresponding to a target product, where the code difference analysis result is obtained by performing a difference analysis on the engineering code corresponding to the target product;
[0013] A retrieval module configured to retrieve candidate test cases that meet the first similarity condition from a test case library in the first largest model agent based on the iterative requirement document and the code difference analysis result;
[0014] A generation module configured to generate a first test case in the second largest model agent based on the target code difference analysis result in the code difference analysis result, the iterative requirement document, and the predetermined prompt information, where the target code difference analysis result is the code difference analysis result corresponding to the test cases in the candidate test cases that do not meet the second similarity condition;
[0015] A composition module configured to combine the first test case and the second test cases in the candidate test cases that meet the second similarity condition to form the target test case corresponding to the target product.
[0016] In a third aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method for determining a test case described in the first aspect is implemented.
[0017] In a fourth aspect, the present application provides an electronic device, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, and when the processor executes the computer program, the method for determining a test case described in the first aspect is implemented.
[0018] The first test case generated by the second largest model agent in the present application can be a test case that meets the requirements of the target product and is screened out from the test cases generated by the second largest model agent.
[0019] With the above technical solution, a method, apparatus, storage medium, and electronic device for determining test cases provided by this application, compared with the current existing technologies, can, by obtaining the iterative requirement document corresponding to the target product and the code difference analysis result, screen in combination with the iterative requirement document of the product and the code difference analysis result, and further enable the first large model agent and the second large model agent to have a more comprehensive understanding of the requirements of the target product; based on the iterative requirement document and the code difference analysis result in the first large model agent, candidate test cases can be screened from the test case library, and the test case library can be used for screening, thereby reducing the process of manually maintaining the mapping relationship between test cases and code; in the second large model agent, the test cases that do not meet the second similarity condition in the candidate test cases are regenerated, and the regenerated first test cases and the second test cases that meet the second similarity condition are combined into the target test cases corresponding to the target product, and more test cases that meet the requirements of the target product can be generated through the second large model agent, accurately realizing the test requirements of the target product and improving the product test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with this application, and are used together with the specification to explain the principles of this application.
[0021] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.
[0022] Figure 1 It shows a schematic flowchart of a method for determining test cases provided by an embodiment of this application;
[0023] Figure 2 It shows a schematic flowchart of a method for determining test cases provided by an embodiment of this application;
[0024] Figure 3 It shows a schematic flowchart of a method for determining test cases provided by an embodiment of this application;
[0025] Figure 4 It shows a schematic flowchart of a method for determining test cases provided by an embodiment of this application;
[0026] Figure 5 It shows a schematic flowchart of an example provided by an embodiment of this application;
[0027] Figure 6 It shows a schematic flowchart of an example provided by an embodiment of this application;
[0028] Figure 7 shows a schematic flowchart of an example provided by an embodiment of the present application;
[0029] Figure 8 shows a schematic flowchart of an example provided by an embodiment of the present application;
[0030] Figure 9 shows a schematic structural diagram of a determination device for a test case provided by an embodiment of the present application;
[0031] Figure 10 shows a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0032] Embodiments of the present application will be described in more detail below with reference to the accompanying drawings. It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other.
[0033] In order to improve the technical problem that the existing technology selects test cases only based on the mounting relationship between the manually labeled test case library and the engineering code, which may lead to incomplete functions of the selected target test cases, and during the process of using the selected target test cases to test the product to be tested, there may also be a situation where the test requirements of the product cannot be accurately realized, thus affecting the test efficiency of the product to be tested. This embodiment provides a method for determining test cases, as Figure 1 shown, the method includes:
[0034] Step 101, obtain the iteration requirements document and the code difference analysis result corresponding to the target product.
[0035] The code difference analysis result is obtained by performing a difference analysis on the engineering code corresponding to the target product.
[0036] In the embodiments of the present application, the target product may be a product that needs to be tested. Correspondingly, test cases are required to test the product, and the present application needs to obtain test cases that can fully realize the test requirements of the target product.
[0037] In some examples, the iteration requirements document (IRD) corresponding to the product is a very important document in the software development process. It details the functions to be implemented, improvements, and problems to be fixed during a specific iteration cycle. The IRD not only guides the work of the development team but also provides a clear basis for testing, deployment, and other related activities.
[0038] For this embodiment, the code difference analysis result can be obtained by performing a difference analysis on the engineering code of the target product. Specifically, by performing a difference analysis on the engineering code of the target product, the changes between different versions can be identified, the impacts of these changes can be evaluated, and guidance can be provided for subsequent test case generation.
[0039] Optionally, the code difference analysis result may include a code difference function module, annotations, and descriptions, and can specifically identify and record the specific changes in the code between different versions, which include changes in functional modules, newly added or modified annotations.
[0040] Step 102: In the first large model agent, based on the iterative requirement document and the code difference analysis result, retrieve candidate test cases that meet the first similarity condition from the test case library.
[0041] In the embodiments of the present application, a large model agent (Large Model Agent, LMA) refers to an intelligent system built based on a large-scale pre-trained language model or other deep learning models. These systems possess extensive knowledge and powerful natural language processing capabilities, and can perform complex tasks, answer questions, provide suggestions, etc.
[0042] In some examples, the first large model agent can select eligible candidate test cases from the test case library based on the iterative requirement document and the code difference analysis result.
[0043] It should be noted that the first large model agent used in the embodiments of the present application includes two large models with different functions, and the screening of candidate test cases is jointly completed by these two large models with different functions.
[0044] Optionally, the candidate test cases in the embodiments of the present application are screened from the test case library. The test case library can be preset or selected based on the target product. The specific source of the test case library is not limited in the embodiments of the present application.
[0045] Correspondingly, the first similarity condition can be preset or determined by the target product, and is not limited herein.
[0046] Step 103: In the second large model agent, generate the first test case based on the target code difference analysis result in the code difference analysis result, the iterative requirement document, and the predetermined prompt information.
[0047] Among them, the target code difference analysis result is the code difference analysis result corresponding to the test cases that do not meet the second similarity condition among the candidate test cases.
[0048] In an embodiment of the present application, the second large model agent may include a large model, which can be used to generate test cases.
[0049] In some examples, the predetermined prompt information can be pre-set or determined for the target product. The specific content of the predetermined prompt information is not limited in the present application. Exemplarily, the predetermined prompt information can be "You are a senior test engineer. Please deeply understand the requirements and code modules, analyze step by step, without excessive divergence, and generate test cases. Ensure that each test case includes complete test steps and expected results when writing test cases."
[0050] For this embodiment, the target code difference analysis result can be the code difference analysis result corresponding to the test cases that do not meet the second similarity condition among the candidate test cases. Specifically, in the process of screening candidate test cases, it is necessary to retrieve the candidate test cases that meet the first similarity condition. Further, it is necessary to judge the candidate test cases again to select the test cases that do not meet the second similarity condition, and based on the project code corresponding to the selected test cases, determine the target code difference analysis result from the code difference analysis results.
[0051] Optionally, the first test case can be a test case generated by the second large model agent.
[0052] It should be noted that the test cases generated by the second large model agent in the present application can include test cases that meet the requirements of the target product and test cases that still do not meet the requirements of the target product. The first test case in the present application can be a test case that meets the requirements of the target product. The process of screening the first test case from the test cases generated by the second large model agent can be to judge whether the generated test cases meet the predetermined requirement conditions, and use the test cases that meet the predetermined requirement conditions as the first test cases. Among them, the predetermined requirement conditions can be that the similarity between the test case and the product requirements reaches a similarity threshold, or the adaptability between the test case and the product requirements reaches a threshold, and so on. By analogy, it is not specifically limited here.
[0053] Step 104: Combine the first test case and the second test cases that meet the second similarity condition among the candidate test cases to form the target test cases corresponding to the target product.
[0054] In the test cases of the present application, the test cases that do not meet the second similarity condition among the candidate test cases cannot be used to test the target product. Therefore, it is necessary to combine the test cases that meet the second similarity condition among the candidate test cases and the test cases generated by the second large model agent to obtain the test cases for testing the target product.
[0055] Compared with the current existing technologies, in this embodiment, by obtaining the iterative requirement document corresponding to the target product and the code difference analysis result, screening can be carried out in combination with the iterative requirement document of the product and the code difference analysis result, and thus the first large model agent and the second large model agent can more comprehensively understand the requirements of the target product; based on the iterative requirement document and the code difference analysis result in the first large model agent, candidate test cases can be screened from the test case library, and the test case library can be used for screening, thus reducing the process of manually maintaining the mapping relationship between test cases and codes; in the second large model agent, the test cases that do not meet the second similarity condition in the candidate test cases are regenerated, and the regenerated first test cases and the second test cases that meet the second similarity condition are combined into the target test cases corresponding to the target product, and more test cases that meet the requirements of the target product can be generated through the second large model agent, accurately realizing the test requirements of the target product and improving the product test efficiency.
[0056] As a refinement and extension of the above embodiment, before retrieving candidate test cases that meet the first similarity condition from the test case library based on the iterative requirement document and the code difference analysis result, the following methods can be adopted but are not limited to, such as Figure 2 As shown, this method includes:
[0057] Step 201: Determine the function description information corresponding to each test case in the test case library.
[0058] In the embodiment of the present application, determining the function description information corresponding to each test case in the test case library is a key step to ensure the effectiveness and traceability of the test activity. Specifically, the function description information corresponding to the test case refers to a detailed description of the specific function or behavior verified by each test case. It not only clarifies the purpose of the test but also provides clear operation guidelines for the development, test, and maintenance teams.
[0059] Exemplarily, if the test case library A contains 10,000 test cases, then the function description information corresponding to each test case needs to be determined; correspondingly, if the test case library B contains 20,000 test cases, then the function description information corresponding to each test case needs to be determined.
[0060] Step 202: Input the function description information into the first large model in the first large model agent for vectorization processing to obtain the test case vectors corresponding to each test case in the test case library.
[0061] In an embodiment of the present application, the first large model can perform vectorization processing on the input information to obtain a vector corresponding to the information. Exemplarily, in an embodiment of the present application, the functional description information is input into the first large model for vectorization processing, and a test case vector corresponding to each test case can be obtained. The test case vector can be used to represent the functional description information of the test case.
[0062] Exemplarily, each functional description in the test case library can be input into a large language model (LLM) to output a vector. For example, Tongyi Qianwen large language model can generate a 1024-dimensional vector for a text description. Correspondingly, if there are M test cases in the test case library, M 1024-dimensional vectors will be output.
[0063] Step 203: Input the test case vector into a pre-defined vector retrieval engine to construct a test case retrieval index, and obtain a target vector retrieval engine containing the test case retrieval index.
[0064] In some examples, the pre-defined vector retrieval engine can be a pre-set vector retrieval engine or a vector retrieval engine determined according to the target product, which is not limited herein. Specifically, a Vector Search Engine (VSE) is a system specifically designed to process and query high-dimensional vector data, and it can efficiently find vectors that meet the pre-defined similarity conditions.
[0065] Exemplarily, the vector retrieval engine used in an embodiment of the present application can be Faiss (Facebook AI Similarity Search). Specifically, Faiss is an efficient and easy-to-use library dedicated to performing large-scale similarity searches, especially in high-dimensional vector spaces.
[0066] In an embodiment of the present application, a test case retrieval index can be established in advance based on the test case vector to obtain a target vector retrieval engine containing the test case retrieval index. In the subsequent retrieval process, direct retrieval can be performed through the target vector retrieval engine to improve the retrieval efficiency. Exemplarily, since the test cases in the use case library are very large, the test case vectors can be input into a vector retrieval engine (such as Faiss) to establish an index, which can speed up the subsequent vector retrieval.
[0067] Furthermore, when retrieving candidate test cases that meet the first similarity condition from the test case library based on the iterative requirements document and the code difference analysis results, the following steps can be adopted but are not limited to, such as Figure 3 as shown, including:
[0068] Step 301: Input the iterative requirements document and the code difference analysis result into the second large model in the first large model intelligent agent to extract function point information, obtaining the first function point information corresponding to the iterative requirements document and the second function point information corresponding to the code difference analysis result.
[0069] In the embodiment of the present application, the second large model can extract function points from the input information. Exemplarily, the second large model can be a large language model (LLM). Specifically, there are detailed descriptions of function points in the iterative requirements document, including the requirement background, value, implementation process, and display effect. When inputting the iterative requirements document into the second large model, the second large model can be used to summarize multiple function points of the requirements, obtaining the first function point information in the embodiment of the present application.
[0070] Correspondingly, the second large model has the ability to understand the code difference analysis result. The function code modules, corresponding annotation information, and description information included in the code difference analysis result can be input into the second large model to understand and summarize the function points, obtaining the second function point information in the embodiment of the present application.
[0071] It should be noted that the first function point information in the embodiment of the present application can represent the requirements of the target product, and the second function point information can represent the code implementation function requirements.
[0072] Step 302: Input the first function point information and the second function point information into the first large model for vectorization processing, obtaining the first function point vector corresponding to the first function point information and the second function point vector corresponding to the second function point information.
[0073] Furthermore, based on Step 301, after obtaining the first function point vector and the second function point vector through the second large model, the first function point information and the second function point information need to be converted into the first function point vector and the second function point vector through the first large model. Specifically, when inputting the iterative requirements document into the second large model, the second large model can be used to summarize multiple function points of the requirements, that is, the first function point information in the present application. Inputting the first function point information into the first large model to convert it into a text vector, that is, the first function point vector in the embodiment of the present application, which can be denoted as X_p. Such processing can make the large model understand the product requirements more accurately compared to directly inputting the original product requirements document into the second large model to convert it into a vector.
[0074] Correspondingly, the function code modules, corresponding annotation information, and description information included in the code difference analysis result are input into the second large model to understand and summarize the function points, obtaining the second function point information in the embodiment of the present application. Then, the second function point information is input into the first large model for vectorization processing, obtaining the second function point vector in the embodiment of the present application, which can be denoted as X_q.
[0075] It should be noted that in the embodiments of the present application, the first function point vector can represent the requirements of the target product, and the second function point vector can represent the functional requirements implemented by the code.
[0076] Step 303: Retrieve in the target vector retrieval engine based on the first function point vector and the second function point vector to obtain candidate test cases whose similarity with the first function point vector and the second function point vector is greater than or equal to the first similarity threshold.
[0077] In the embodiments of the present application, it is necessary to retrieve in the vector retrieval engine based on the first function point vector and the second function point vector. Specifically, it is to retrieve the similarity between the test case vector and the first function point vector and the second function point vector, and retrieve the candidate test cases whose similarity is greater than or equal to the first similarity threshold.
[0078] Exemplarily, if the similarity between test case vector 1 and the first function point vector and the second function point vector is 30%, the similarity between test case vector 2 and the first function point vector and the second function point vector is 50%, and the similarity between test case vector 3 and the first function point vector and the second function point vector is 70%, and if the first similarity threshold is 40%, then the test cases corresponding to test case vector 2 and test case vector 3 can be screened as candidate test cases.
[0079] Optionally, after performing the retrieval in the target vector retrieval engine based on the first function point vector and the second function point vector to obtain the candidate test cases whose similarity with the first function point vector and the second function point vector is greater than or equal to the first similarity threshold, the following methods can be adopted but are not limited to, such as Figure 4 As shown, this method includes:
[0080] Step 401: Screen out the test cases from the candidate test cases whose similarity with the first function point vector and the second function point vector is less than the second similarity threshold.
[0081] Exemplarily, based on step 303, if the similarity between test case vector 2 and the first function point vector and the second function point vector is 50%, and the similarity between test case vector 3 and the first function point vector and the second function point vector is 70%, and if the second similarity threshold is 60%, then test case vector 2 is the test case whose similarity is less than the second similarity threshold that needs to be selected in the embodiments of the present application.
[0082] Step 402: Determine the target code difference analysis result from the code difference analysis results based on the selected test cases.
[0083] For this embodiment, the target code difference analysis result can be the code difference analysis result corresponding to the test cases that do not meet the second similarity condition among the candidate test cases. Specifically, during the process of screening candidate test cases, it is necessary to retrieve the candidate test cases that meet the first similarity condition. Further, it is necessary to judge the candidate test cases again and select the test cases that do not meet the second similarity condition. Based on the project code corresponding to the selected test cases, the target code difference analysis result is determined from the code difference analysis results.
[0084] Exemplarily, based on step 401, if test case vector 2 is the test case whose similarity is less than the second similarity threshold to be selected in the embodiment of the present application, it is necessary to determine the part corresponding to test case 2 in the code difference analysis result, and determine the part corresponding to test case 2 as the target code difference analysis result.
[0085] Exemplarily, as Figure 5 shown is the execution process in the first large model agent, which may specifically include the following steps, but is not limited thereto:
[0086] The first step: Use the large language model LLM to vectorize the test cases and input them into the vector retrieval engine (such as Faiss) to retrieve the index;
[0087] Specifically, input each function description in the test case library into the large language model LLM, and output a vector. For example, Tongyi Qianwen large language model can generate a 1024-dimensional vector for a text description. If there are M test cases in the test case library, then M 1024-dimensional vectors will be output. Because the test cases in the use case library are very large, we input these vectors into the vector retrieval engine (such as Faiss) to build an index, which can speed up the subsequent vector retrieval.
[0088] The second step: Use the large language model LLM to understand the product requirements and the function points implemented by the code module, and vectorize them;
[0089] Specifically, the product requirement document has a detailed description of the function points, including the requirement background, value, implementation process, and display effect. We use LLM to summarize multiple function points of the requirements and then convert them into text vectors, denoted as X_p. Compared with directly inputting the original product requirement document into LLM to convert it into a vector, we can understand the product requirements more accurately in this way.
[0090] The large model has the ability to understand and read the implemented code. We input the function code module, the corresponding annotation information, and the description information into the LLM, understand and summarize the function points. Similar to the above approach, the summarized function points are input into the LLM to be converted into vectors, denoted as X_q.
[0091] The third step: The vector retrieval engine retrieves and calculates the vector similarity;
[0092] Specifically, the product requirement function vector X_p and the code implementation function vector X_q are respectively input into the vector retrieval engine for retrieval, and similar test cases are output. Those with high similarity can directly generate a recommended test case set; those with low similarity will output the corresponding function code module, annotation, and description information for the next step of test case generation.
[0093] Furthermore, when generating the first test case based on the target code difference analysis result, iterative requirement document, and predetermined prompt information in the code difference analysis result, the following steps can be adopted but are not limited to:
[0094] Step 11: Input the target code difference analysis result, iterative requirement document, and predetermined prompt information into the large model in the second large model agent to generate test cases for the target product, and obtain the first test case corresponding to the target product.
[0095] In the embodiment of the present application, the iterative requirement document and the code blocks with low similarity (including function code modules, annotations, and description information), that is, the target code difference analysis result in the present application, are input into the large model in the second large model agent, and at the same time, prompt words are input into the large model, such as: You are a senior test engineer. Please deeply understand the requirements and code modules, analyze step by step, without excessive divergence, and generate test cases. Ensure that each test case contains complete test steps and expected results when writing test cases.
[0096] In some examples, the first test case can be the test case generated by the large model.
[0097] Furthermore, when executing the combination of the first test case and the second test case that meets the second similarity condition in the candidate test cases to form the target test case corresponding to the target product, the following steps can be adopted but are not limited to:
[0098] Step 21: Combine the second test cases in the first test case and the candidate test cases whose similarity between the first function point vector and the second function point vector is greater than or equal to the second similarity threshold to form the target test case corresponding to the target product.
[0099] Exemplarily, based on step 402, if test case vector 3 is the test case in the candidate test cases whose similarity between the first function point vector and the second function point vector is greater than or equal to the second similarity threshold, that is, the second test case, then combine test case 3 and the test case generated by the large model in the second large model agent to obtain the target test case for the target product.
[0100] In some examples, such as Figure 6The execution process of the second largest model agent is shown as follows, which may include, but is not limited to, the following content:
[0101] Input the product requirement addition / change document and code blocks with low similarity (including function code modules, annotations, and description information) into the large model, and at the same time input the prompt words to the large model: You are a senior test engineer. Please deeply understand the requirements and code modules, analyze step by step, without excessive divergence, and generate test cases. Ensure that each test case contains complete test steps and expected results when writing test cases. The large model can generate new test cases according to the above prompt words.
[0102] Furthermore, when executing to obtain the iterative requirement document and code difference analysis result corresponding to the target product, the following steps may be adopted but are not limited to, including:
[0103] Step 31: Obtain the iterative requirement document and engineering code corresponding to the target product.
[0104] In the embodiment of the present application, the engineering code of the product refers to the collection of all source codes, configuration files, scripts, and other related resources that make up the software product or system. It not only includes the functional modules that implement the business logic but also covers the auxiliary tools and documents in aspects such as construction, deployment, and testing.
[0105] Step 32: Conduct a difference analysis based on the change class information and call relationship corresponding to the engineering code to obtain the code difference analysis result.
[0106] As Figure 7 shown, the specific process of conducting the difference analysis may include the following content, but is not limited to:
[0107] The first step: Obtain the baseline code branch and modified code branch in the code repository, and analyze the differences between the baseline code and the modified code through tools such as JGit and the Abstract Syntax Tree (ASM) of the project; the second step: Parse the multi-layer call relationship between functions and recursively find all affected classes; the third step: Output all affected code blocks.
[0108] Furthermore, the method of this embodiment also includes: supplementing the first test case in the test case library.
[0109] It should be noted that by supplementing the first test case in the test case library, the present application can cyclically generate more test cases that meet the product requirements. Furthermore, in the process of screening test cases through the first large model agent next time, more test cases that meet the second similarity condition can be screened out, and the second model agent can also cyclically generate test cases that do not meet the product requirements, thereby improving the accuracy and efficiency of the generated test cases.
[0110] Compared with the current existing technologies, in this embodiment, by obtaining the iterative requirement document and the code difference analysis result corresponding to the target product, screening can be performed in combination with the iterative requirement document of the product and the code difference analysis result, so that the first large model agent and the second large model agent can understand the requirements of the target product more comprehensively; based on the iterative requirement document and the code difference analysis result in the first large model agent, candidate test cases can be screened from the test case library, and the test case library can be used for screening, thereby reducing the process of manually maintaining the mapping relationship between test cases and code; in the second large model agent, the test cases that do not meet the second similarity condition in the candidate test cases are regenerated, and the regenerated first test cases and the second test cases that meet the second similarity condition are combined to form the target test cases corresponding to the target product, so that more test cases that meet the requirements of the target product can be generated by the second large model agent, accurately realizing the test requirements of the target product and improving the product test efficiency.
[0111] To illustrate the specific implementation process of this embodiment, the following specific application examples are given, such as Figure 8 shown, but not limited thereto:
[0112] The first step: The code parsing module outputs the code difference function module, annotations, and descriptions.
[0113] The second step: The current product iterative requirement document and the code difference module (including the difference code, annotations, and descriptions), together with the test case library, are input into the recommended large model agent (Agent) to obtain the recommended test cases retrieved from the test case library, and the corresponding relevance is given.
[0114] The third step: The test cases with high relevance are directly put into the current version test case set; for the test cases with low relevance, the use case generation Agent is used to generate test cases again; the regenerated test cases can be continuously supplemented to the test case library for future iterations.
[0115] The fourth step: The test cases with high relevance and the regenerated test cases are used as a set to obtain the current version test case set.
[0116] Compared with the current existing technologies, in this embodiment, by obtaining the iterative requirement document and the code difference analysis result corresponding to the target product, screening can be performed in combination with the iterative requirement document of the product and the code difference analysis result, so that the first large model agent and the second large model agent can understand the requirements of the target product more comprehensively; in the first large model agent, candidate test cases can be screened from the test case library based on the iterative requirement document and the code difference analysis result, and the test case library can be used for screening, thereby reducing the process of manually maintaining the mapping relationship between test cases and code; in the second large model agent, the test cases that do not meet the second similarity condition in the candidate test cases are regenerated, and the regenerated first test cases and the second test cases that meet the second similarity condition are combined into the target test cases corresponding to the target product, so that more test cases that meet the requirements of the target product can be generated by the second large model agent, accurately realizing the test requirements of the target product and improving the product test efficiency.
[0117] Further, as Figures 1 to 4 a specific implementation of the method shown, this embodiment provides a device for determining test cases, as Figure 9 shown, the device includes: an acquisition module 51, a retrieval module 52, a generation module 53, and a composition module 54.
[0118] The acquisition module 51 is configured to acquire the iterative requirement document and the code difference analysis result corresponding to the target product, and the code difference analysis result is obtained by performing a difference analysis on the engineering code corresponding to the target product;
[0119] The retrieval module 52 is configured to retrieve candidate test cases that meet the first similarity condition from the test case library in the first large model agent based on the iterative requirement document and the code difference analysis result;
[0120] The generation module 53 is configured to generate first test cases in the second large model agent based on the target code difference analysis result in the code difference analysis result, the iterative requirement document, and the predetermined prompt information, and the target code difference analysis result is the code difference analysis result corresponding to the test cases that do not meet the second similarity condition in the candidate test cases;
[0121] The composition module 54 is configured to combine the first test cases and the second test cases that meet the second similarity condition in the candidate test cases into the target test cases corresponding to the target product.
[0122] In some examples of this embodiment, the retrieval module 52 is further configured to determine the function description information corresponding to each test case in the test case library; input the function description information into the first large model in the first large model agent for vectorization processing to obtain the test case vectors corresponding to each test case in the test case library; input the test case vectors into a pre - defined vector retrieval engine to construct a test case retrieval index, and obtain a target vector retrieval engine containing the test case retrieval index.
[0123] In some examples of this embodiment, the retrieval module 52 is specifically configured to input the iterative requirement document and the code difference analysis result into the second large model in the first large model agent for function point information extraction, to obtain the first function point information corresponding to the iterative requirement document and the second function point information corresponding to the code difference analysis result; input the first function point information and the second function point information into the first large model for vectorization processing, to obtain the first function point vector corresponding to the first function point information and the second function point vector corresponding to the second function point information; perform retrieval in the target vector retrieval engine based on the first function point vector and the second function point vector, and obtain the candidate test cases whose similarity with the first function point vector and the second function point vector is greater than or equal to the first similarity threshold.
[0124] In some examples of this embodiment, the retrieval module 52 is further specifically configured to screen out the test cases from the candidate test cases whose similarity with the first function point vector and the second function point vector is less than the second similarity threshold; determine the target code difference analysis result from the code difference analysis result based on the selected test cases.
[0125] In some examples of this embodiment, the generation module 53 is specifically configured to input the target code difference analysis result, the iterative requirement document, and the predetermined prompt information into the large model in the second large model agent for test case generation, to obtain the first test case corresponding to the target product; correspondingly, the composition module 54 is specifically configured to compose the first test case and the second test cases in the candidate test cases whose similarity with the first function point vector and the second function point vector is greater than or equal to the second similarity threshold into the target test case corresponding to the target product.
[0126] In some examples of this embodiment, the acquisition module 51 is specifically configured to acquire the iterative requirement document and the engineering code corresponding to the target product; perform difference analysis based on the change class information and call relationship corresponding to the engineering code, and obtain the code difference analysis result.
[0127] In some examples of this embodiment, the component module 54 is further specifically configured to supplement the first test case in the test case library.
[0128] It should be noted that for other corresponding descriptions of each functional unit involved in the test case determination device provided in this embodiment, reference can be made to Figures 1 to 4 the corresponding descriptions in, which will not be elaborated here.
[0129] Based on the above method as Figures 1 to 4 shown, correspondingly, this embodiment further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the above method as Figures 1 to 4 shown is implemented.
[0130] Based on such an understanding, the technical solution of this application can be embodied in the form of a software product. The software product can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of various implementation scenarios of this application.
[0131] As Figure 10 shown, the following is a schematic hardware structure diagram of an electronic device of the present invention, including:
[0132] At least one processor 601; and,
[0133] A memory 602 communicatively connected to at least one of the processors 601; wherein,
[0134] The memory 602 stores instructions executable by at least one of the processors. The instructions are executed by at least one of the processors so that at least one of the processors can execute the test case determination method as described above.
[0135] Figure 10 Taking one processor 601 as an example in
[0136] The electronic device may further include: an input device 603 and a display device 604.
[0137] The processor 601, the memory 602, the input device 603, and the display device 604 may be connected through a bus or other means, Figure 10 taking the connection through a bus as an example in
[0138] The memory 602, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the test case determination method in the embodiments of this application. For example,Figures 1 to 4 The method flow shown. The processor 601 executes various functional applications and data processing by running the non-volatile software programs, instructions, and modules stored in the memory 602, that is, implements the method for determining test cases in the above embodiments.
[0139] The memory 602 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created according to the use of the method for determining test cases, etc. In addition, the memory 602 may include high-speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 602 may optionally include a memory remotely provided with respect to the processor 601, and these remote memories may be connected to the device for executing the method for determining test cases through a network. Examples of the above network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0140] The input device 603 can receive input user clicks and generate signal inputs related to user settings and function controls of the method for determining test cases. The display device 604 may include a display screen and other display devices.
[0141] When the one or more modules are stored in the memory 602 and run by the one or more processors 601, they execute the method for determining test cases in any of the above method embodiments.
[0142] Optionally, the above physical device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, sensors, an audio circuit, a WI-FI module, and so on. The user interface may include a display screen (Display) and an input unit such as a keyboard (Keyboard), etc. Optionally, the user interface may further include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.
[0143] Those skilled in the art can understand that the above physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or combine certain components, or have different component arrangements.
[0144] The storage medium may further include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the above-mentioned entity device, and supports the operation of information processing programs and other software and / or programs. The network communication module is used to implement communication between components inside the storage medium, as well as communication between other hardware and software in the information processing entity device.
[0145] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or can also be implemented by hardware. By applying the solution of this embodiment, compared with the current existing technologies, in this embodiment, by obtaining the iterative requirement document corresponding to the target product and the code difference analysis result, it is possible to screen in combination with the iterative requirement document of the product and the code difference analysis result, and then the first large model agent and the second large model agent can understand the requirements of the target product more comprehensively; in the first large model agent, candidate test cases can be screened from the test case library based on the iterative requirement document and the code difference analysis result, and the test case library can be used for screening, thereby reducing the process of manually maintaining the mapping relationship between test cases and code; in the second large model agent, the test cases that do not meet the second similarity condition in the candidate test cases are regenerated, and the regenerated first test cases and the second test cases that meet the second similarity condition are combined to form the target test cases corresponding to the target product, and more test cases that meet the requirements of the target product can be generated through the second large model agent, accurately realizing the test requirements of the target product and improving the product test efficiency.
[0146] It should be noted that in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.
[0147] The above are only specific embodiments of the present application, enabling those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments described herein, but rather will be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for determining a test case, characterized in that: include: Obtaining an iterative requirement document and a code difference analysis result corresponding to a target product, wherein the code difference analysis result is obtained by performing a difference analysis on the engineering code corresponding to the target product; In the first large model agent, based on the iterative requirement document and the code difference analysis result, candidate test cases meeting the first similarity condition are retrieved from the test case library; In the second large model agent, a first test case is generated based on a target code difference analysis result in the code difference analysis result, the iteration requirement document and predetermined prompt information, wherein the target code difference analysis result is a code difference analysis result corresponding to a test case in the candidate test case that does not meet the second similarity condition; The first test case and a second test case among the candidate test cases that meets a second similarity condition are combined into a target test case corresponding to the target product.
2. The method according to claim 1, characterized in that Before retrieving candidate test cases that meet the first similarity condition from a test case library based on the iteration requirement document and the code difference analysis result, the method further includes: Determine the functional description information corresponding to each test case in the test case library; Inputting the function description information into the first large model in the first large model agent for vectorization processing to obtain a test case vector corresponding to each test case in the test case library; The test case vector is input into a predetermined vector search engine to construct a test case search index, and a target vector search engine including the test case search index is obtained.
3. The method according to claim 2, characterized in that Based on the iteration requirement document and the code difference analysis result, retrieving candidate test cases that meet the first similarity condition from a test case library includes: Inputting the iterative requirement document and the code difference analysis result into the second large model in the first large model agent to extract function point information, and obtaining first function point information corresponding to the iterative requirement document and second function point information corresponding to the code difference analysis result; Inputting the first function point information and the second function point information into the first large model for vectorization processing to obtain a first function point vector corresponding to the first function point information and a second function point vector corresponding to the second function point information; Based on the first function point vector and the second function point vector, a search is performed in the target vector search engine to obtain the candidate test cases whose similarity with the first function point vector and the second function point vector is greater than or equal to a first similarity threshold.
4. The method according to claim 3, characterized in that After searching in the target vector search engine based on the first function point vector and the second function point vector to obtain the candidate test case whose similarity with the first function point vector and the second function point vector is greater than or equal to a first similarity threshold, the method further includes: Filtering out test cases from the candidate test cases, the test cases having a similarity with the first function point vector and the second function point vector being less than a second similarity threshold; The target code difference analysis result is determined from the code difference analysis result based on the selected test case.
5. The method according to claim 4, characterized in that The generating a first test case based on the target code difference analysis result in the code difference analysis result, the iteration requirement document and the predetermined prompt information includes: Inputting the target code difference analysis result, the iteration requirement document and the predetermined prompt information into the large model in the second large model agent to generate test cases, and obtaining the first test case corresponding to the target product; The step of combining the first test case and a second test case among the candidate test cases that meets a second similarity condition into a target test case corresponding to the target product includes: The first test case and the second test cases in the candidate test cases whose similarity with the first function point vector and the second function point vector is greater than or equal to a second similarity threshold form a target test case corresponding to the target product.
6. The method according to any one of claims 1 to 5, characterized in that The obtaining of the iterative requirement document and code difference analysis results corresponding to the target product includes: Obtaining the iterative requirement documents and engineering codes corresponding to the target product; A difference analysis is performed based on the change type information and the call relationship corresponding to the engineering code to obtain the code difference analysis result.
7. The method according to claim 1, characterized in that The method further comprises: The first test case is supplemented in the test case library.
8. A device for determining a test case, characterized in that: include: An acquisition module is configured to acquire an iteration requirement document and a code difference analysis result corresponding to a target product, wherein the code difference analysis result is obtained by performing a difference analysis on the engineering code corresponding to the target product; A retrieval module is configured to retrieve, in the first large model agent, candidate test cases that meet the first similarity condition from a test case library based on the iterative requirement document and the code difference analysis result; A generating module is configured to generate a first test case in the second large model agent based on a target code difference analysis result in the code difference analysis result, the iteration requirement document and predetermined prompt information, wherein the target code difference analysis result is a code difference analysis result corresponding to a test case in the candidate test case that does not meet the second similarity condition; The composition module is configured to combine the first test case and a second test case among the candidate test cases that meets a second similarity condition into a target test case corresponding to the target product.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Software development method
CN117539438A
Web application fuzzy testing method based on multi-modal large model assisted web crawler
CN119377079A