Test case determination method and device, storage medium and electronic equipment
By obtaining the iterative requirements documents and code differences analysis results of the target product, and using the agent model 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 higher testing efficiency are achieved.
Patent Information
- Application Number
- CN202510207331.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2045-02-25
AI Technical Summary
When determining test cases, the existing technology only relies on the mounting relationship between manual annotation test case library and engineering code, resulting in the incomplete function of the selected target test cases, which cannot accurately realize product testing requirements, affecting 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 CN119690858A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, storage medium and electronic device for determining a test case. Background Art
[0002] Product test cases are a key tool to ensure that software or systems function correctly as expected. They not only help verify the quality of the developed code, but also confirm whether product requirements are accurately implemented.
[0003] At present, in the process of determining the test cases for the product to be tested, it is necessary to determine the engineering code of the product to be tested, and then select the test cases used to test the product to be tested from the test case library based on the mounting relationship between the manually marked test case library and the engineering code, 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, selecting test cases based only on the mounting relationship between the manually labeled test case library and the engineering code will result in incomplete functions of the selected target test cases. In the process of using the selected target test cases to test the product to be tested, there may be a situation where the product testing requirements cannot be accurately achieved, thereby affecting the testing efficiency of the product to be tested. Summary of the invention
[0005] In view of this, the present application provides a method, device, storage medium and electronic device for determining a test case. The main purpose is to improve the current existing technology that selects test cases based only on the mounting relationship between the manually marked test case library and the engineering code, which will result in the selected target test cases having incomplete functions. In the process of using the selected target test cases to test the product to be tested, there will also be a situation where the product testing requirements cannot be accurately achieved, thereby affecting the technical problem of the testing efficiency of the product to be tested.
[0006] In a first aspect, the present application provides a method for determining a test case, comprising: 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.
[0007] In a second aspect, the present application provides a device for determining a test case, comprising: 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.
[0008] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for determining the test case described in the first aspect is implemented.
[0009] In a fourth aspect, the present application provides an electronic device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the method for determining the test case described in the first aspect when executing the computer program.
[0010] In the present application, the first test case generated by the second largest model agent may be a test case selected from the test cases generated by the second largest model agent and meeting the requirements of the target product.
[0011] By means of the above-mentioned technical scheme, the present application provides a method, device, storage medium and electronic device for determining a test case. Compared with the current existing technology, the present application can obtain the iterative requirement document and code difference analysis results corresponding to the target product, and can combine the iterative requirement document and code difference analysis results of the product for screening, so that the first large model intelligent agent and the second large model intelligent agent can have a more comprehensive understanding of the requirements of the target product; in the first large model intelligent agent, candidate test cases are screened from the test case library based on the iterative requirement document and the code difference analysis results, and the test case library can be used for screening, thereby reducing the process of manually maintaining the mapping relationship between test cases and codes; in the second large model intelligent agent, the test cases in the candidate test cases that do not meet the second similarity condition 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. More test cases that meet the requirements of the target product can be generated through the second large model intelligent agent, accurately realizing the test requirements of the target product and improving product testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] 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.
[0013] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0014] Figure 1 A schematic diagram of a flow chart of a method for determining a test case provided in an embodiment of the present application is shown; Figure 2 A schematic diagram of a flow chart of a method for determining a test case provided in an embodiment of the present application is shown; Figure 3 A schematic diagram of a flow chart of a method for determining a test case provided in an embodiment of the present application is shown; Figure 4 A schematic diagram of a flow chart of a method for determining a test case provided in an embodiment of the present application is shown; Figure 5 A schematic diagram of an example process provided by an embodiment of the present application is shown; Figure 6 A schematic diagram of an example process provided by an embodiment of the present application is shown; Figure 7 A schematic diagram of an example process provided by an embodiment of the present application is shown; Figure 8 A schematic diagram of an example process provided by an embodiment of the present application is shown; Fig. 9 A schematic diagram of the structure of a device for determining a test case provided in an embodiment of the present application is shown; Fig.10 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0015] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0016] In order to improve the existing technology, test cases are selected based only on the mounting relationship between the manually annotated test case library and the engineering code, which will result in the selected target test cases having incomplete functions. In the process of using the selected target test cases to test the product to be tested, there will also be a situation where the product testing requirements cannot be accurately met, thereby affecting the test efficiency of the product to be tested. This embodiment provides a method for determining test cases, such as Figure 1 As shown, the method includes: Step 101: Obtain the iterative requirement document and code difference analysis results corresponding to the target product.
[0017] The code difference analysis result is obtained by performing a difference analysis on the engineering code corresponding to the target product.
[0018] In an embodiment of the present application, the target product may be a product that needs to be tested. Accordingly, testing the product requires corresponding test cases. The present application needs to obtain test cases that can fully realize the testing requirements of the target product.
[0019] In some examples, the Iteration Requirements Document (IRD) corresponding to the product is a very important document in the software development process. It describes in detail the functions, improvements and fixes to be implemented in a specific iteration cycle. IRD not only guides the work of the development team, but also provides a clear basis for testing, deployment and other related activities.
[0020] 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, performing a difference analysis on the engineering code of the target product can identify the changes between different versions, evaluate the impact of these changes, and provide guidance for the subsequent generation of test cases.
[0021] Optionally, the code difference analysis results may include code difference function modules, annotations, and descriptions, which can specifically identify and record specific changes in the code between different versions, including changes in function modules, and newly added or modified annotations.
[0022] Step 102: In the first large model agent, based on the iteration requirement document and the code difference analysis results, candidate test cases that meet the first similarity condition are retrieved from the test case library.
[0023] In the embodiments of the present application, Large Model Agent (LMA) refers to an intelligent system built based on a large-scale pre-trained language model or other deep learning model. These systems have extensive knowledge and powerful natural language processing capabilities, and can perform complex tasks, answer questions, provide suggestions, etc.
[0024] In some examples, the first large model agent can select qualified candidate test cases from a test case library based on the iterative requirement document and code difference analysis results.
[0025] It should be noted that the first large model agent used in the embodiment of the present application includes two large models with different functions, and the screening of candidate test cases is completed by these two large models with different functions.
[0026] Optionally, the candidate test cases in the embodiments of the present application are screened from a test case library. The test case library can be pre-set 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.
[0027] Correspondingly, the first similarity condition may be pre-set or determined for the target product, which is not limited here.
[0028] Step 103: In the second large model agent, a first test case is generated based on the target code difference analysis results, the iteration requirement document and the predetermined prompt information in the code difference analysis results.
[0029] 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.
[0030] In an embodiment of the present application, the second large model agent may include a large model that can be used to generate test cases.
[0031] In some examples, the predetermined prompt information can be pre-set or determined for the target product, and the specific content of the predetermined prompt information is not limited in this application. For example, the predetermined prompt information can be "You are a senior test engineer. Please deeply understand the requirements and code modules, analyze them step by step, and generate test cases without too much divergence. When writing test cases, make sure that each case contains complete test steps and expected results."
[0032] For this embodiment, the target code difference analysis result may be the code difference analysis result corresponding to the test case in the candidate test case that does not meet the second similarity condition. Specifically, in the process of screening the candidate test cases, it is necessary to retrieve the candidate test cases that meet the first similarity condition. Furthermore, 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 engineering code corresponding to the selected test case, the target code difference analysis result is determined from the code difference analysis result.
[0033] Optionally, the first test case may be a test case generated by the second large model agent.
[0034] It should be noted that the test cases generated by the second largest model agent in the present application may 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 may be a test case that meets the requirements of the target product. The process of screening out the first test case from the test cases generated by the second largest model agent can be to determine whether the generated test case meets the predetermined requirement conditions, and take the test case that meets the predetermined requirement conditions as the first test case, wherein the predetermined requirement conditions can be a similarity threshold between the test case and the product requirement, or a compatibility threshold between the test case and the product requirement, and so on, and no specific limitation is made here.
[0035] Step 104: Combine the first test case and the second test case in the candidate test case that meets the second similarity condition into a target test case corresponding to the target product.
[0036] In the test cases of the present application, the test cases in the candidate test cases that do not meet the second similarity condition cannot be used to test the target product. Therefore, it is necessary to combine the test cases in the candidate test cases that meet the second similarity condition and the test cases generated by the second large model agent to obtain test cases for testing the target product.
[0037] Compared with the current existing technology, this embodiment can obtain the iterative requirement document and code difference analysis results corresponding to the target product, and can combine the iterative requirement document and code difference analysis results of the product for screening, so that the first large model agent and the second large model agent can have a more comprehensive understanding of the requirements of the target product; in the first large model agent, candidate test cases are screened from the test case library based on the iterative requirement document and the code difference analysis results, and the test case library can be used for screening, thereby 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 to form the target test cases corresponding to the target product. More test cases that meet the requirements of the target product can be generated through the second large model agent, accurately meet the test requirements of the target product, and improve product testing efficiency.
[0038] 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 method may be used but is not limited to: Figure 2 As shown, the method includes: Step 201: Determine the functional description information corresponding to each test case in the test case library.
[0039] In the embodiment of the present application, determining the functional 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 activities. Specifically, the functional description information corresponding to the test case refers to the 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 a clear operating guide for the development, testing and maintenance teams.
[0040] For example, if test case library A contains 10,000 test cases, it is necessary to determine the functional description information corresponding to each test case; correspondingly, if test case library B contains 20,000 test cases, it is necessary to determine the functional description information corresponding to each test case.
[0041] Step 202: Input 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.
[0042] In an embodiment of the present application, the first large model can vectorize the input information to obtain a vector corresponding to the information. By way of example, in an embodiment of the present application, the functional description information is input into the first large model for vectorization processing to obtain a test case vector corresponding to each test case. The test case vector can be used to represent the functional description information of the test case.
[0043] For example, each function description in the test case library can be input into the large language model (LLM) to output a vector. For example, the 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.
[0044] Step 203: Input the test case vector into a predetermined vector search engine to construct a test case search index, and obtain a target vector search engine including the test case search index.
[0045] In some examples, the predetermined vector search engine may be a pre-set vector search engine or a vector search engine determined according to a target product, which is not limited here. Specifically, a vector search engine (VSE) is a system specifically used for processing and querying high-dimensional vector data, which can efficiently find vectors that meet predetermined similarity conditions.
[0046] Exemplarily, the vector search engine used in the embodiments of the present application may be Faiss (Facebook AI Similarity Search). Specifically, Faiss is an efficient and easy-to-use library specifically designed to perform large-scale similarity searches, especially in high-dimensional vector spaces.
[0047] In the embodiment of the present application, a test case retrieval index can be pre-established 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 retrieval efficiency. Exemplarily, since the test cases in the case library are very large, the test case vector can be input into a vector retrieval engine (such as Faiss) to establish an index, which can speed up the subsequent vector retrieval.
[0048] Further, when performing the retrieval of candidate test cases that meet the first similarity condition from the test case library based on the iteration requirement document and the code difference analysis result, the following steps may be adopted but are not limited to: Figure 3 As shown, including: Step 301: Input the iterative requirement document and the code difference analysis results into the second large model in the first large model agent to extract function point information, and obtain the first function point information corresponding to the iterative requirement document and the second function point information corresponding to the code difference analysis results.
[0049] In an embodiment of the present application, the second largest model can extract function points from the input information. Exemplarily, the second largest model can be a large language model (LLM); specifically, the iterative requirement document contains a detailed description of the function points, including the requirement background, value, implementation process and display effect. When the iterative requirement document is input into the second largest model, the second largest model can be used to summarize multiple function points of the requirements to obtain the first function point information in the embodiment of the present application.
[0050] Correspondingly, the second largest model has the ability to read and understand the code difference analysis results. The function code modules, corresponding annotation information, and description information contained in the code difference analysis results can be input into the second largest model to understand and summarize the functional points to obtain the second functional point information in the embodiment of the present application.
[0051] It should be noted that the first function point information in the embodiment of the present application may represent the requirements of the target product, and the second function point information may represent the code implementation function requirements.
[0052] Step 302: Input 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.
[0053] Further, 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 the iterative requirement document is input into the second large model, the second large model can be used to summarize multiple function points of the requirement, that is, the first function point information in the present application, and the first function point information is input into the first large model and converted into a text vector, that is, the first function point vector in the embodiment of the present application, which can be recorded as X_p. Compared with directly inputting the original product requirement document into the second large model and converting it into a vector, this processing can make the large model understand the product requirements more accurately.
[0054] Correspondingly, the function code module, corresponding annotation information, and description information contained in the code difference analysis results are input into the second largest model, the function points are understood and summarized, and the second function point information in the embodiment of the present application is obtained. The second function point information is then input into the first largest model for vectorization processing to obtain the second function point vector in the embodiment of the present application, which can be recorded as X_q.
[0055] It should be noted that the first function point vector in the embodiment of the present application may represent the requirements of the target product, and the second function point vector may represent the functional requirements of the code implementation.
[0056] Step 303: Search in a target vector search 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 a first similarity threshold.
[0057] In an embodiment of the present application, it is necessary to search in a vector search engine based on the first function point vector and the second function point vector, specifically to search for the similarity between the test case vector and the first function point vector and the second function point vector, and to retrieve candidate test cases whose similarity is greater than or equal to a first similarity threshold.
[0058] 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%, if the first similarity threshold is 40%, the test cases corresponding to test case vector 2 and test case vector 3 can be screened as candidate test cases.
[0059] Optionally, after performing a search in a target vector search 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 a first similarity threshold, the following method may be used but is not limited to: Figure 4 As shown, the method includes: Step 401: Filter out test cases from candidate test cases whose similarity with the first function point vector and the second function point vector is less than a second similarity threshold.
[0060] 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%, if the second similarity threshold is 60%, then test case vector 2 is the test case that needs to be selected in the embodiment of the present application whose similarity is less than the second similarity threshold.
[0061] Step 402: Determine a target code difference analysis result from the code difference analysis result based on the selected test case.
[0062] For this embodiment, the target code difference analysis result may be the code difference analysis result corresponding to the test case in the candidate test case that does not meet the second similarity condition. Specifically, in the process of screening the candidate test cases, it is necessary to retrieve the candidate test cases that meet the first similarity condition. Furthermore, 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 engineering code corresponding to the selected test case, the target code difference analysis result is determined from the code difference analysis result.
[0063] Exemplarily, based on step 401, if test case vector 2 is a test case whose similarity is less than the second similarity threshold that needs 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.
[0064] For example, Figure 5 The execution process in the first large model agent is shown, which may specifically include the following steps, but is not limited to these: Step 1: Use the large language model (LLM) to vectorize the test cases and input them into the vector search engine (such as Faiss) for search indexing. Specifically, each function description in the test case library is input into the large language model LLM, and a vector is output. For example, the 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, M 1024-dimensional vectors will be output. Because the test cases in the test case library are very large, we input these vectors into a vector search engine (such as Faiss) to create an index, which can speed up the subsequent vector search.
[0065] Step 2: Use the large language model (LLM) to understand product requirements and the functional points implemented by the code module, and vectorize them; Specifically, the product requirement document has a detailed description of the functional points, including the background of the requirements, value, implementation process and display effect. We use LLM to summarize multiple functional points of the requirements and then convert them into text vectors, recorded 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 by doing this.
[0066] The large model has the ability to read and understand the implemented code. We input the function code module, corresponding annotation information, and description information into the LLM to understand and summarize the function points. Similar to the above method, the summarized function points are input into the LLM and converted into a vector, recorded as X_q.
[0067] Step 3: Vector search engine searches and calculates vector similarity; Specifically, the product requirement function vector X_p and the code implementation function vector X_q are input into the vector search engine for retrieval, and similar test cases are output. If the similarity is high, the recommended test case set can be directly generated; if the similarity is not high, the corresponding function code module, annotation, and description information are output for the next step of case generation.
[0068] Further, when generating the first test case based on the target code difference analysis result, the iteration requirement document and the predetermined prompt information in the code difference analysis result, the following steps may be adopted but are not limited to, including: Step 11: Input the target code difference analysis results, the iteration requirement document and the predetermined prompt information into the large model in the second large model agent to generate test cases, and obtain the first test case corresponding to the target product.
[0069] In an embodiment of the present application, the iterative requirement document and the code block with low similarity (including function code module, annotation, 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 a prompt word is input into the large model, for example: You are a senior test engineer. Please deeply understand the requirements and code modules, analyze step by step, without too much divergence, and generate test cases. When writing test cases, make sure that each case contains complete test steps and expected results.
[0070] In some examples, the first test case may be a test case generated by a large model.
[0071] Further, when the first test case and the second test case in the candidate test case that meets the second similarity condition are combined into a target test case corresponding to the target product, the following steps may be adopted but are not limited to, including: Step 21: The first test case and the second test case in 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 second similarity threshold are combined into a target test case corresponding to the target product.
[0072] Exemplarily, based on step 402, if test case vector 3 is a test case among 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, that is, the second test case, then test case 3 is combined with the test case generated based on the large model in the second large model agent to obtain a target test case for the target product.
[0073] In some examples, such as Figure 6 The execution process of the second largest model agent is shown, which may include the following contents, but is not limited to these: Input the new / changed product requirements documents and the code blocks with low similarity (including function code modules, annotations, and description information) into the big model, and input the prompt words to the big model: You are a senior test engineer. Please deeply understand the requirements and code modules, analyze them step by step, and generate test cases without too much divergence. When writing test cases, make sure that each case contains complete test steps and expected results. The big model can generate new test cases based on the above prompt words.
[0074] Further, when obtaining the iteration requirement document and code difference analysis result corresponding to the target product, the following steps may be adopted but are not limited to: Step 31: Obtain the iterative requirement documents and engineering codes corresponding to the target product.
[0075] In the embodiments of the present application, the engineering code of the product refers to the collection of all source code, configuration files, scripts and other related resources that constitute the software product or system. It not only includes functional modules that implement business logic, but also covers auxiliary tools and documents for construction, deployment, testing, etc.
[0076] Step 32: Perform difference analysis based on the change class information and call relationship corresponding to the project code to obtain code difference analysis results.
[0077] like Figure 7 As shown, the specific process of performing the difference analysis may include the following contents, but is not limited to these: Step 1: Get the baseline code branch and modified code branch in the code repository, and use tools such as JGit and engineering abstract syntax tree (ASM) to analyze the differences between the baseline code and the modified code. Step 2: Analyze the multi-layer call relationship between functions and recursively find all affected classes. Step 3: Output all affected code blocks.
[0078] Furthermore, the method of this embodiment also includes: supplementing the first test case in the test case library.
[0079] It should be noted that by supplementing the first test case in the test case library, the present application can cyclically generate test cases that better meet product requirements, and then in the next process of screening test cases through the first large model agent, 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 product requirements, thereby improving the accuracy and efficiency of the generated test cases.
[0080] Compared with the current existing technology, this embodiment can obtain the iterative requirement document and code difference analysis results corresponding to the target product, and can combine the iterative requirement document and code difference analysis results of the product for screening, so that the first large model agent and the second large model agent can have a more comprehensive understanding of the requirements of the target product; in the first large model agent, candidate test cases are screened from the test case library based on the iterative requirement document and the code difference analysis results, and the test case library can be used for screening, thereby 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 to form the target test cases corresponding to the target product. More test cases that meet the requirements of the target product can be generated through the second large model agent, accurately meet the test requirements of the target product, and improve product testing efficiency.
[0081] In order to illustrate the specific implementation process of this embodiment, the following specific application examples are given: Figure 8 As shown, but not limited to: Step 1: The code parsing module outputs code difference function modules, annotations, and descriptions; Step 2: The current product iteration requirement document and code difference module (including difference code, annotations, and description) are input into the recommended large model agent together with the test case library to obtain the recommended test cases retrieved based on the test case library and give the corresponding relevance; Step 3: Use cases with high relevance are directly put into the current version test case set; for use cases with low relevance, use the use case generation agent to regenerate the use cases; the regenerated use cases can continue to be added to the test case library for future iterations.
[0082] Step 4: Collect the highly relevant use cases and the regenerated use cases to get the test case set for the current version.
[0083] Compared with the current existing technology, this embodiment can obtain the iterative requirement document and code difference analysis results corresponding to the target product, and can combine the iterative requirement document and code difference analysis results of the product for screening, so that the first large model agent and the second large model agent can have a more comprehensive understanding of the requirements of the target product; in the first large model agent, candidate test cases are screened from the test case library based on the iterative requirement document and the code difference analysis results, and the test case library can be used for screening, thereby 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 to form the target test cases corresponding to the target product. More test cases that meet the requirements of the target product can be generated through the second large model agent, accurately meet the test requirements of the target product, and improve product testing efficiency.
[0084] Further, as Figures 1 to 4 The specific implementation of the method shown in the embodiment provides a device for determining a test case, such as Fig. 9 As shown, the device includes: an acquisition module 51, a retrieval module 52, a generation module 53, and a composition module 54.
[0085] An acquisition module 51 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 52 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 iteration requirement document and the code difference analysis result; A generating module 53 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 54 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.
[0086] In some examples of this embodiment, the retrieval module 52 is also configured to determine the functional description information corresponding to each test case in the test case library; input the functional description information into the first large model in the first large model intelligent agent for vectorization processing to obtain a test case vector corresponding to each test case in the test case library; input the test case vector into a predetermined vector retrieval engine to construct a test case retrieval index to obtain a target vector retrieval engine containing the test case retrieval index.
[0087] 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 to extract function point information, and obtain first function point information corresponding to the iterative requirement document and 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, and 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; search 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 a first similarity threshold.
[0088] In some examples of this embodiment, the retrieval module 52 is further configured to filter out test cases from the candidate test cases whose similarity with the first function point vector and the second function point vector is less than a second similarity threshold; and determine the target code difference analysis result from the code difference analysis result based on the selected test case.
[0089] In some examples of this embodiment, the generation module 53 is specifically configured to input the target code difference analysis results, the iterative requirement document and the predetermined prompt information into the large model in the second large model agent to generate test cases, and obtain the first test case corresponding to the target product; correspondingly, the composition module 54 is specifically configured to compose the target test case corresponding to the target product by combining the first test case and the second test cases 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 a second similarity threshold.
[0090] In some examples of this embodiment, the acquisition module 51 is specifically configured to obtain the iterative requirement document and engineering code corresponding to the target product; perform a difference analysis based on the change class information and call relationship corresponding to the engineering code to obtain the code difference analysis result.
[0091] In some examples of this embodiment, the component module 54 is further configured to supplement the first test case in the test case library.
[0092] It should be noted that for other corresponding descriptions of the functional units involved in the test case determination device provided in this embodiment, reference can be made to Figures 1 to 4 The corresponding description in will not be repeated here.
[0093] Based on the above Figures 1 to 4 The method shown in the embodiment also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned Figures 1 to 4 The method shown.
[0094] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of the present application.
[0095] like Fig.10 The figure shows a hardware structure diagram of an electronic device of the present invention, including: at least one processor 601; and, A memory 602 is communicatively connected to at least one of the processors 601; wherein, The memory 602 stores instructions that can be executed by at least one of the processors. The instructions are executed by at least one of the processors so that the at least one of the processors can execute the test case determination method as described above.
[0096] Fig.10 A processor 601 is taken as an example.
[0097] The electronic device may further include: an input device 603 and a display device 604 .
[0098] The processor 601, the memory 602, the input device 603 and the display device 604 may be connected via a bus or other means. Fig.10 The example of connecting through bus is taken in the following.
[0099] The memory 602 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the method for determining a test case in the embodiment of the present application, for example, Figures 1 to 4The 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, the method for determining the test case in the above embodiment is implemented.
[0100] The memory 602 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created according to the use of the test case determination method, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 602 may optionally include a memory remotely arranged relative to the processor 601, and these remote memories may be connected to the device for executing the test case determination method via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0101] The input device 603 can receive user clicks and generate signal inputs related to user settings of the test case determination method and function control. The display device 604 can include display devices such as a display screen.
[0102] The one or more modules are stored in the memory 602 and when executed by the one or more processors 601, the method for determining the test case in any of the above method embodiments is executed.
[0103] Optionally, the above-mentioned physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also 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.
[0104] Those skilled in the art will appreciate that the above-mentioned physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different arrangements of components.
[0105] The storage medium may also 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 physical device, and supports the operation of the information processing program and other software and / or programs. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the information processing physical device.
[0106] Through the description of the above implementation methods, the technical personnel in this field can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware. By applying the scheme of this embodiment, compared with the current existing technology, this embodiment can obtain the iteration requirement document and code difference analysis results corresponding to the target product, and can be combined with the iteration requirement document and code difference analysis results of the product for screening, so that the first large model agent and the second large model agent can have a more comprehensive understanding of the requirements of the target product; in the first large model agent, based on the iteration requirement document and the code difference analysis results, the candidate test cases are screened from the test case library, and the test case library can be used for screening, so as to reduce the process of manually maintaining the mapping relationship between the test case and the 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 composed of the target test cases corresponding to the target product. More test cases that meet the requirements of the target product can be generated by the second large model agent, and the test requirements of the target product are accurately realized, and the product testing efficiency is improved.
[0107] 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 such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0108] The above is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent 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 the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features applied for 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
Utilizing machine learning to identify and correct differences in application programming interface (API) specifications
US20210216308A1
Coding method, decoding method, coding apparatus, and decoding apparatus
WO2022116207A1
Cited By
Test case directional execution method and device and storage medium
CN120596391A
Test case generation method and device
CN120973690A
Web end deep learning framework test method based on constraint difference driving
CN121050997A
Test case generation method and device, equipment and computer program product
CN121070344A