Case generation method and device, equipment and storage medium
By introducing a matching algorithm in the use case generation method, the matching function description and use case number of functional modules are obtained, and the problem of inaccurate use case number specification in the prior art is solved, and more accurate and comprehensive use case generation is achieved.
Patent Information
- Application Number
- CN202411815876.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-12-11
AI Technical Summary
In the prior art, the number of use cases specified by the tester is insufficient or too many, resulting in the generated test cases being unable to fully or accurately evaluate the testing process of the functional module.
The matching algorithm matches the functional modules and the functional modules stored in the knowledge base, obtains the matching function description and recommended number of use cases, and generates test cases based on this information.
Accurate control of the number of test cases is achieved, ensuring that the generated test cases can comprehensively and accurately evaluate the testing process of functional modules, and improve the comprehensiveness and accuracy of use case generation.
Smart Images

Figure CN119645871A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a use case generation method, apparatus, device and storage medium. Background Art
[0002] A use case is a description of how a system responds to external requests in software engineering or system engineering, including a functional description of the software engineering or system engineering, a process description of responding to external requests, and a result description of responding to external requests.
[0003] In the related art, for a product, it is necessary to generate test cases for each functional module of the product to show the test process of each functional module. It is necessary to first obtain the functional description of the functional module, and generate input information in combination with the number of use cases specified by the tester, and then generate test cases of the number of use cases corresponding to the functional module based on the input information through the large language model.
[0004] However, since the number of use cases is specified by the tester, if the specified number of use cases is small, the generated test cases will not be able to fully evaluate the test process of the functional module. If the specified number of use cases is large, the generated test cases will be too redundant and cannot accurately evaluate the test process of the functional module. Summary of the invention
[0005] The embodiment of the present application provides a use case generation method, apparatus, device and storage medium. The technical solution provided by the embodiment of the present application is as follows:
[0006] According to one aspect of an embodiment of the present application, a use case generation method is provided, the method comprising:
[0007] Obtaining a functional description of a first functional module, where the first functional module is a functional module of a first product;
[0008] According to the function descriptions corresponding to the function modules of the first product and the number of recommended use cases corresponding to the function modules stored in the knowledge base, obtaining the function description and the number of use cases corresponding to at least one function module matching the first function module;
[0009] At least one test case is generated through a first generative language model according to a function description of the first function module, a function description corresponding to each of the at least one function module, and the number of use cases, wherein the at least one test case includes test cases corresponding to each of the at least one function module.
[0010] According to one aspect of an embodiment of the present application, a use case generation device is provided, the device comprising:
[0011] A description acquisition module, used to acquire a functional description of a first functional module, where the first functional module is a functional module of a first product;
[0012] a function matching module, configured to obtain, according to the function descriptions corresponding to the function modules of the first product and the number of recommended use cases corresponding to the function modules stored in the knowledge base, a function description and the number of use cases corresponding to at least one function module that matches the first function module;
[0013] A use case generation module is used to generate at least one test case through a first generative language model according to the function description of the first function module, the function description corresponding to the at least one function module respectively, and the number of use cases, wherein the at least one test case includes the test cases corresponding to the at least one function module respectively.
[0014] According to one aspect of an embodiment of the present application, a computer device is provided, the computer device comprising a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the above-mentioned use case generation method.
[0015] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned use case generation method.
[0016] According to one aspect of an embodiment of the present application, a computer program product is provided, wherein the computer program product includes a computer program, and the computer program is loaded and executed by a processor to implement the above-mentioned use case generation method.
[0017] The technical solution provided in the embodiments of the present application can bring the following beneficial effects:
[0018] The first functional module is matched with each functional module of the first product stored in the knowledge base through a matching algorithm to obtain functional descriptions and the number of recommended use cases corresponding to at least one functional module matching the first functional module, and the number of use cases corresponding to at least one functional module is determined according to the number of recommended use cases corresponding to at least one functional module. Compared with the related art of generating test cases using the number of use cases specified by the tester, the present application generates test cases by using the functional description and the number of use cases corresponding to at least one functional module obtained by the above-mentioned matching algorithm, which can provide more accurate functional description reference and use case number reference for use case generation, thereby controlling the number of use cases of test cases corresponding to each functional module, achieving the effect of controlling the granularity of use case generation, so that the generated at least one test case can comprehensively and accurately evaluate the test process of the first functional module, thereby improving the comprehensiveness and accuracy of use case generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application;
[0020] Figure 2 is a flowchart of a use case generation method provided by an embodiment of the present application;
[0021] Figure 3 It is a schematic diagram of a process for determining the number of use cases corresponding to at least one functional module provided in an embodiment of the present application;
[0022] Figure 4 It is a schematic diagram of an implementation method of the number of use cases corresponding to the functional modules provided in one embodiment of the present application;
[0023] Figure 5 is a flowchart of a use case generation method provided by another embodiment of the present application;
[0024] Figure 6 is a block diagram of a use case generation device provided by an embodiment of the present application;
[0025] Figure 7 It is a structural block diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0027] Please refer to Figure 1 , which shows a schematic diagram of a solution implementation environment provided by an embodiment of the present application. The solution implementation environment can be implemented as a use case generation system. The solution implementation environment may include: a terminal device 10 and a server 20.
[0028] The number of terminal devices 10 can be one or more. The terminal device 10 can be an electronic device such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, a game console, an e-book reader, a multimedia player, a wearable device, an intelligent voice interaction device, a smart home appliance, a vehicle terminal, an aircraft, etc.
[0029] A client of a target application may be installed in the terminal device 10. The target application has the function of generating test cases based on the functional description of the functional module input by the user. Optionally, the target application may be an application that needs to be downloaded and installed, or it may be a click-to-use application. This application does not limit this.
[0030] The server 20 is used to provide background services for the client of the target application installed and running in the terminal device 10. For example, the server 20 can be the background server of the above-mentioned target application. The server 20 can be an independent physical server, or a server cluster composed of multiple servers, or a cloud computing service center. Optionally, the server 20 provides background services for the target applications in multiple terminal devices 10 at the same time. The terminal device 10 and the server 20 can communicate with each other through the network.
[0031] In an embodiment of the present application, the target application is an application that implements a use case generation function based on a generative language model and a knowledge base. The use case generation method provided by the present application can be implemented on the terminal device side or on the server side, without limitation. The user enters the functional description of the first functional module in the target application, and the computer device (the client of the target application or the server that provides background services for the client of the target application) obtains the functional description and the number of use cases corresponding to at least one functional module that matches the first functional module based on the functional descriptions corresponding to each functional module of the first product stored in the knowledge base and the number of recommended use cases corresponding to each functional module. Then, at least one test case is generated based on the functional description of the first functional module, the functional description and the number of use cases corresponding to at least one functional module through the first generative language model, and the at least one test case is used to guide the modification of the functional description of the first functional module in the knowledge base.
[0032] Please refer to Figure 2 , which shows a flow chart of a use case generation method provided by an embodiment of the present application. The execution subject of each step of the method may be a computer device. The method may include at least one of the following steps 210 to 230:
[0033] Step 210, obtaining a functional description of a first functional module, where the first functional module is a functional module of a first product.
[0034] Optionally, if the execution subject of the use case generation method provided in the present application is a terminal device, the user enters a functional description of the first functional module in the target application, and the client of the target application obtains the functional description of the first functional module.
[0035] Optionally, if the executor of the use case generation method provided in the present application is a server, after the user enters the functional description of the first functional module in the target application, the client of the target application sends the functional description of the first functional module to the server, and the server receives the functional description of the first functional module.
[0036] The first functional module is the functional module of the first product. The first product can be a physical product, such as a vehicle, an air conditioner, a television, a sweeping robot, etc. The first product can also be a virtual product, such as a coding program, a music program, a video program, a tool program, etc. This application does not limit this.
[0037] Optionally, the target application may be an application corresponding to the first product, and the application corresponding to the first product has the function of generating a test case corresponding to a functional description of the first product according to the functional description of the first product. For example, if the first product is a vehicle, the target application may be a vehicle control program. For another example, if the first product is a music program, the target application may be an application corresponding to the music program. Optionally, the target application may also be other applications unrelated to the first product, and the target application may be a functional application, which has the function of generating a test case according to a functional description input by a user.
[0038] The first product has at least one functional module, and the first functional module is any one of the at least one functional module of the first product. Exemplarily, if the first product is a vehicle, the functional modules of the first product include but are not limited to a starting functional module, a parking functional module, a vehicle speed control module, a lighting functional module, an air conditioning functional module, etc., and the first functional module may be any one of the at least one functional module of the vehicle. Exemplarily, if the first product is a music program, the functional modules of the first product include but are not limited to a song playing module, a song collection module, a song comment module, a song sharing module, etc., and the first functional module may be any one of the at least one functional module of the music program.
[0039] The first functional module has at least one function, and the functional description of the first functional module is used to comprehensively describe at least one function of the first functional module. For example, if the first product is a music program, and the first functional module is a song playing module of the music program, then the at least one function of the first functional module includes but is not limited to a progress bar dragging function, a song start playing function, a song playing to the climax part, a song playing to the end part, a song automatically switching function after the song ends, etc. The functional description of the song playing module is used to comprehensively describe the various functions of the song playing module mentioned above.
[0040] It should be noted that, since the functional description of the first functional module is a user-defined functional description, the functional description of the first functional module obtained in step 210 may not be able to comprehensively describe all functions of the first functional module.
[0041] Step 220, based on the functional descriptions corresponding to the functional modules of the first product and the number of recommended use cases corresponding to the functional modules stored in the knowledge base, obtain the functional descriptions and the number of use cases corresponding to at least one functional module matching the first functional module.
[0042] Each functional module can be implemented as one or more use cases. Each use case corresponding to a functional module is used to describe the implementation process of a function of the functional module. Each use case specifically includes a description of the function of the functional module, a description of the implementation process of the function of the functional module, and a description of the implementation result of the function of the functional module. For example, for the progress bar dragging function of the song playing module, the use case corresponding to the progress bar dragging function is used to describe the implementation process of the progress bar dragging function. The use case includes a description of the progress bar dragging function, a description of the implementation process of the progress bar dragging function, and a description of the implementation result of the progress bar dragging function.
[0043] The number of use cases corresponding to a functional module is determined by the functions of the functional module, that is, the more functions a functional module has, the more use cases the functional module corresponds to. The number of recommended use cases corresponding to each functional module of the first product stored in the knowledge base is the number of use cases determined in advance based on the functions of each functional module of the first product, and the number of recommended use cases corresponding to the functional module is used to indicate the number of functions of the functional module.
[0044] The functional descriptions corresponding to the functional modules of the first product stored in the knowledge base are functional descriptions obtained in advance based on the functions of the functional modules of the first product. Therefore, the functional descriptions of the functional modules stored in the knowledge base can describe all functions of the functional modules more comprehensively.
[0045] Optionally, the knowledge base can be a knowledge base for the first product, which stores the function descriptions corresponding to each function module of the first product and the number of recommended use cases corresponding to each function module, or it can be a knowledge base for multiple products, which stores the function descriptions corresponding to each function module of multiple products and the number of recommended use cases corresponding to each function module.
[0046] The functional descriptions corresponding to the functional modules of the first product and the number of recommended use cases corresponding to the functional modules stored in the knowledge base are used to provide determination conditions for obtaining the functional descriptions and the number of use cases corresponding to at least one functional module matching the first functional module. The at least one functional module matching the first functional module is determined based on the functional descriptions corresponding to the functional modules of the first product stored in the knowledge base, the functional descriptions corresponding to the at least one functional module are obtained from the knowledge base after determining the at least one functional module, and the number of recommended use cases corresponding to the at least one functional module is determined based on the number of recommended use cases corresponding to the functional modules of the first product stored in the knowledge base.
[0047] Step 230, generating at least one test case through a first generative language model according to the functional description of the first functional module, the functional description corresponding to at least one functional module, and the number of use cases, wherein the at least one test case includes a test case corresponding to at least one functional module.
[0048] The first generative language model is a model obtained by fine-tuning the large language model according to the first training sample. The large language model here can be any publicly available large language model, such as a natural language model based on a transformer structure obtained by training with a large amount of data, such as a sample level of more than 100 million, which is not limited in this application.
[0049] The training process of the first generative language model is as follows: obtain at least one first training sample of the first generative language model, each first training sample includes a functional description of a sample functional module and at least one first sample test case, and the sample functional module is a functional module of the first product. According to the functional descriptions corresponding to the functional modules of the first product stored in the knowledge base and the number of recommended use cases corresponding to the functional modules, obtain the functional description and the number of use cases corresponding to at least one functional module matching the sample functional module. Generate at least one predictive test case through the first generative language model according to the functional description of the sample functional module, the functional description and the number of use cases corresponding to at least one functional module matching the sample functional module. With the training goal of reducing the difference between at least one first sample test case and at least one predictive test case, adjust the parameters of the large language model to obtain the first generative language model.
[0050] According to the function description of the first function module, the function description and the number of use cases corresponding to at least one function module, prompt information is obtained, and the prompt information is used to instruct the first generative language model to generate at least one test case according to the function description of the first function module, the function description and the number of use cases corresponding to at least one function module. The function description of the first function module, the function description and the number of use cases corresponding to at least one function module, and the prompt information are input into the first generative language model, and at least one test case is output.
[0051] The functional description corresponding to at least one functional module is used to instruct the first generative language model to generate a test case corresponding to at least one functional module. The functional description of the first functional module is used to assist the first generative language model to generate a test case corresponding to at least one functional module. The number of test cases corresponding to at least one functional module is used to guide the number of test cases generated by the first generative language model for at least one functional module.
[0052] At least one test case includes test cases corresponding to at least one functional module. The number of test cases corresponding to each functional module is determined by the number of use cases corresponding to the functional module. However, the number of test cases corresponding to each functional module is not necessarily the same as the number of use cases corresponding to the functional module. The number of test cases corresponding to the functional module may be greater than the number of use cases corresponding to the functional module, or less than the number of use cases corresponding to the functional module, or equal to the number of use cases corresponding to the functional module.
[0053] Optionally, the number of test cases corresponding to the functional modules may be greater than the number of use cases corresponding to the functional modules. For example, the functional description of the first functional module may contain functional description content that is not included in the functional description of a certain functional module, and the test cases corresponding to the functional module generated by the first generative language model may include test cases corresponding to the functional description content, so that the number of test cases corresponding to the functional module is greater than the number of use cases corresponding to the functional modules.
[0054] Optionally, the number of test cases corresponding to a functional module may be smaller than the number of use cases corresponding to the functional module. For example, the number of functions described in the functional description of a functional module may be smaller than the number of use cases corresponding to the functional module. In this case, the test cases corresponding to the functional module generated by the first generative language model can only include the test cases corresponding to the functional description of the functional module, so that the number of test cases corresponding to the functional module is smaller than the number of use cases corresponding to the functional module.
[0055] Optionally, the number of test cases corresponding to a functional module may be equal to the number of use cases corresponding to the functional module. For example, if the functional description of the first functional module does not contain functional description content that is not included in the functional description of a certain functional module, and the number of functions described in the functional description of each functional module is equal to the number of use cases corresponding to the functional module, then the number of test cases corresponding to each functional module generated by the first generative language model is equal to the number of use cases corresponding to the functional module.
[0056] Exemplarily, the functional descriptions corresponding to at least one functional module include functional descriptions corresponding to functional module a and functional descriptions corresponding to functional module b, the number of use cases corresponding to functional module a is 10, and the number of use cases corresponding to functional module b is 15. Then, at least one test case generated by the first generative language model includes test cases corresponding to functional module a and test cases corresponding to functional module b, the number of use cases of the test cases corresponding to functional module a may be less than 10, greater than 10, or equal to 10, and the number of use cases of the test cases corresponding to functional module b may be less than 15, greater than 15, or equal to 15.
[0057] The technical solution provided in the embodiment of the present application matches the first functional module with the various functional modules of the first product stored in the knowledge base through a matching algorithm, obtains the functional description and the number of recommended use cases corresponding to at least one functional module matching the first functional module, and determines the number of use cases corresponding to at least one functional module according to the number of recommended use cases corresponding to at least one functional module. Compared with the related art of generating test cases using the number of use cases specified by the tester, the present application generates test cases by using the functional description and the number of use cases corresponding to at least one functional module obtained by the above-mentioned matching algorithm, which can provide more accurate functional description reference and use case number reference for use case generation, thereby controlling the number of use cases of the test cases corresponding to each functional module, achieving the effect of controlling the granularity of use case generation, so that the generated at least one test case can comprehensively and accurately evaluate the test process of the first functional module, thereby improving the comprehensiveness and accuracy of use case generation.
[0058] In some embodiments, step 220 includes at least one of sub-steps 221 - 223 .
[0059] Sub-step 221, obtaining at least one functional module matching the first functional module according to the functional descriptions corresponding to the functional modules stored in the knowledge base and the functional description of the first functional module.
[0060] By using a matching algorithm, each functional module contained in the knowledge base is matched with the first functional module according to the functional descriptions corresponding to each functional module stored in the knowledge base and the functional description of the first functional module, so as to obtain at least one functional module matching the first functional module. A matching algorithm is exemplified in detail below.
[0061] In some embodiments, sub-step 221 includes at least one of sub-steps 2211 - 2214 .
[0062] Sub-step 2211, performing text vectorization on the function description of the first function module to obtain a function description vector corresponding to the first function module.
[0063] Text vectorization is the process of converting text into numerical vectors, and is a basic technology in natural language processing. Through text vectorization, text can be represented in a form that can be processed by computer devices, which facilitates subsequent analysis and mining. In this process, word segmentation is generally performed first to divide the text into individual words or tokens, and then a vocabulary is built to collect all the words or tokens that appear in the text and assign a unique index to each word or token. Next, each text sample is represented as a numerical vector, usually with the word frequency of each word as the feature value to form a vector. Finally, the feature vector can also be standardized to eliminate differences between different text lengths and feature scales.
[0064] Commonly used text vectorization methods include the Bag of Words model, TF-IDF (Term Frequency-Inverse Document Frequency), Word2vec, Doc2vec, etc. The Bag of Words model is the earliest text vectorization method that uses words as the basic processing unit. It regards text as a collection of words, ignoring word order and grammatical structure. TF-IDF is a statistical method based on word frequency, which is used to evaluate the importance of a word to a document set or one of the documents in a corpus. Word2vec can obtain the similarity relationship between words by training a large number of corpora.
[0065] The quality of text vectorization directly affects the performance of the entire natural language processing system. Therefore, when performing text vectorization, it is necessary to select appropriate methods and parameters, and perform necessary optimization and adjustments to obtain better results.
[0066] Text vectorization is performed on the function description of the first function module to obtain a function description vector corresponding to the first function module, and the function description vector corresponding to the first function module is used to represent the function description of the first function module in the form of a numerical vector.
[0067] Sub-step 2212, obtaining the function description vector corresponding to each function module.
[0068] The function description vectors corresponding to each function module can be obtained by performing text vectorization on the function descriptions corresponding to each function module stored in the knowledge base in advance. The function description vectors corresponding to each function module are used to represent the function descriptions of each function module in the form of a numerical vector.
[0069] Sub-step 2213, calculating the similarity between the function description vector corresponding to the first function module and the function description vectors corresponding to each function module, to obtain the similarity corresponding to each function module.
[0070] A similarity calculation method is used to calculate the similarity between the function description vector corresponding to the first function module and the function description vectors corresponding to each function module, so as to obtain the similarity corresponding to each function module. The similarity calculation method includes but is not limited to cosine similarity, Euclidean distance, Manhattan distance, Hamming distance and other calculation methods.
[0071] The similarity corresponding to each functional module refers to the similarity between the function description vector corresponding to the functional module and the function description vector corresponding to the first functional module.
[0072] Sub-step 2214: among the similarities corresponding to the functional modules, the functional modules whose similarities are greater than or equal to the first threshold are determined as at least one functional module.
[0073] The specific value of the first threshold is set by the tester according to the use case generation requirements and is not limited in this application.
[0074] At least one functional module is determined based on the similarity between the functional description vector corresponding to the first functional module and the functional description vectors corresponding to each functional module, so that the function of the at least one determined functional module is the same as or similar to the function of the first functional module, thereby subsequently generating at least one test case based on the functional description and the number of use cases corresponding to the at least one functional module. The generated at least one test case can more comprehensively and accurately evaluate the test process of the first functional module, which helps to improve the comprehensiveness and accuracy of use case generation.
[0075] In some embodiments, feature extraction is performed on the function description of the first function module to obtain function description features corresponding to the first function module; function description features corresponding to each function module are obtained; similarities between the function description features corresponding to the first function module and the function description features corresponding to each function module are calculated to obtain second similarities corresponding to each function module; and among the second similarities corresponding to each function module, a function module whose second similarity is greater than or equal to a second threshold is determined as at least one function module.
[0076] Sub-step 222, obtaining from the knowledge base a function description corresponding to at least one function module and a number of recommended use cases corresponding to at least one function module.
[0077] After obtaining at least one functional module matching the first functional module, a functional description respectively corresponding to the at least one functional module and a number of recommended use cases respectively corresponding to the at least one functional module are obtained from a knowledge base according to the at least one functional module.
[0078] Sub-step 223, obtaining the number of use cases corresponding to at least one functional module according to the number of recommended use cases corresponding to at least one functional module.
[0079] The number of use cases corresponding to at least one functional module is determined by the number of recommended use cases corresponding to at least one functional module. The specific determination method can refer to the following embodiment.
[0080] By first determining at least one functional module that matches the first functional module, then obtaining the functional description corresponding to the at least one functional module, and obtaining the number of use cases corresponding to the at least one functional module based on the number of recommended use cases corresponding to the at least one functional module, the number of use cases corresponding to the at least one functional module is determined by an algorithm rather than being specified by the tester in the related technology, so that the number of use cases can realize the control of the number of test cases corresponding to each functional module, avoiding the generation of too many or too few test cases, which affects the comprehensiveness and accuracy of the use case generation.
[0081] The number of use cases corresponding to the at least one functional module may be determined in the following two ways.
[0082] Method 1: Determine the number of recommended use cases corresponding to at least one functional module as the number of use cases corresponding to at least one functional module.
[0083] The first method is to directly determine the number of recommended use cases corresponding to at least one functional module obtained in sub-step 222 as the number of use cases corresponding to at least one functional module, that is, the number of use cases corresponding to each functional module is equal to the number of recommended use cases corresponding to the functional module.
[0084] Method 2: According to the number of recommended use cases corresponding to at least one functional module and the number of historical use cases corresponding to at least one functional module, the number of use cases corresponding to at least one functional module is obtained. The number of historical use cases corresponding to the functional module is used to indicate the number of test cases generated by executing use cases for the functional module within a historical time period.
[0085] The second method is to determine the number of use cases corresponding to at least one functional module in combination with the number of recommended use cases corresponding to at least one functional module and the number of historical use cases corresponding to at least one functional module. By making the number of use cases corresponding to at least one functional module consider not only the number of recommended use cases pre-set in the knowledge base, but also the number of test cases generated by executing use cases for each functional module in the historical time period, the number of use cases corresponding to at least one functional module determined can be more consistent with the actual generation situation, avoiding the large difference between the number of test cases actually generated and the number of recommended use cases, which leads to inaccurate use case generation.
[0086] Figure 3 The process of determining the number of use cases corresponding to at least one functional module is shown. First, a knowledge base is obtained, in which the functional descriptions corresponding to the functional modules of the first product and the number of recommended use cases corresponding to the functional modules of the first product are stored. According to the functional descriptions corresponding to the functional modules and the functional description of the first functional module, at least one functional module matching the first functional module is obtained, and then the functional description corresponding to the at least one functional module and the number of recommended use cases corresponding to the at least one functional module are obtained from the knowledge base. The number of recommended use cases corresponding to the at least one functional module and the number of historical use cases corresponding to the at least one functional module are combined to obtain the number of use cases corresponding to the at least one functional module.
[0087] The number of historical use cases corresponding to a functional module is determined by the number of test cases generated by executing use cases for the functional module within a historical time period.
[0088] In some embodiments, at least one use case generation is performed on the function module within a historical time period, and the average value of the number of test cases corresponding to the at least one use case generation is determined as the number of historical use cases corresponding to the function module.
[0089] The setting of the historical time period is set by the tester according to the use case generation requirements, and this application does not limit it. There is at least one use case generation for the execution of the function module within the historical time period. Optionally, the historical time period can be set to obtain at least one use case generation for the execution of the function module within the historical time period. Optionally, the historical time period can also be obtained by setting the number of at least one use case generation. Exemplarily, the historical time period can be set to one week, then according to the historical time period, at least one use case generation for the execution of the function module within one week is obtained, and the number of at least one use case generation is determined by the length of the historical time period. Exemplarily, the number of at least one use case generation can also be set to 5 times, then according to the number of at least one use case generation, the historical time period corresponding to the five most recent use case generation is obtained, and the historical time period is determined by the number of at least one use case generation.
[0090] Obtain the number of test cases obtained from at least one use case generation executed on the functional module within a historical time period, calculate the average number of test cases corresponding to at least one use case generation, and determine the average number of test cases corresponding to at least one use case generation as the number of historical use cases corresponding to the functional module.
[0091] In some embodiments, the maximum value among the numbers of test cases corresponding to at least one use case generation is determined as the number of historical use cases corresponding to the functional module.
[0092] By taking the average value of the number of test cases obtained from at least one use case generation executed on the functional module within the historical time period, or taking the maximum value as the number of historical use cases corresponding to the functional module, the number of historical use cases corresponding to the functional module can fully represent the use case generation situation within the historical time period, thereby ensuring the accuracy of determining the number of use cases corresponding to at least one of the above-mentioned functional modules.
[0093] For the specific implementation of the above method 2, the following two methods can be used.
[0094] Method 1: For each functional module in at least one functional module, when the number of historical use cases corresponding to the functional module is greater than or equal to the number of recommended use cases corresponding to the functional module, the number of historical use cases corresponding to the functional module is determined as the number of use cases corresponding to the functional module; when the number of historical use cases corresponding to the functional module is less than the number of recommended use cases corresponding to the functional module, the number of recommended use cases corresponding to the functional module is determined as the number of use cases corresponding to the functional module.
[0095] The implementation process of method 1 can refer to Figure 4As shown, for each functional module in at least one functional module, obtain the number of recommended use cases corresponding to the functional module and the number of historical use cases corresponding to the functional module. Judge the numerical values of the number of recommended use cases corresponding to the functional module and the number of historical use cases corresponding to the functional module to determine whether the number of historical use cases corresponding to the functional module is greater than or equal to the number of recommended use cases corresponding to the functional module. If the number of historical use cases corresponding to the functional module is greater than or equal to the number of recommended use cases corresponding to the functional module, select the number of historical use cases corresponding to the functional module, and determine the number of historical use cases corresponding to the functional module as the number of use cases corresponding to the functional module. If the number of historical use cases corresponding to the functional module is less than the number of recommended use cases corresponding to the functional module, select the number of recommended use cases corresponding to the functional module, and determine the number of recommended use cases corresponding to the functional module as the number of use cases corresponding to the functional module.
[0096] By selecting the larger value between the recommended number of use cases and the historical number of use cases as the number of use cases corresponding to the functional module, it is avoided that selecting a smaller value will result in the generated test cases being insufficient to fully evaluate the testing process of the first functional module, thereby causing inaccurate use case generation.
[0097] Method 2: For each functional module in at least one functional module, the average of the number of recommended use cases corresponding to the functional module and the number of historical use cases corresponding to the functional module is determined as the number of use cases corresponding to the functional module.
[0098] The implementation process of the implementation method of method 2 is: for each functional module in at least one functional module, obtain the number of recommended use cases corresponding to the functional module and the number of historical use cases corresponding to the functional module, calculate the average number of recommended use cases corresponding to the functional module and the number of historical use cases corresponding to the functional module, and determine the average number of recommended use cases corresponding to the functional module and the number of historical use cases corresponding to the functional module as the number of use cases corresponding to the functional module.
[0099] By taking the average of the number of recommended use cases and the number of historical use cases as the number of use cases corresponding to the functional module, the determined number of use cases takes both the number of recommended use cases and the number of historical use cases into consideration. This can avoid the situation where the generated test cases are insufficient to comprehensively evaluate the testing process of the first functional module due to a small number of use cases, and can also avoid the situation where the generated test cases are too redundant due to a large number of use cases, thereby improving the comprehensiveness and accuracy of use case generation.
[0100] In some embodiments, step 230 includes at least one of sub-steps 231 - 232 .
[0101] Sub-step 231, for each functional module in at least one functional module, a comprehensive functional description of the functional module is obtained according to the test case corresponding to the functional module, where the comprehensive functional description is used to summarize at least one function of the functional module.
[0102] At least one test case includes test cases corresponding to at least one functional module. For each functional module in the at least one functional module, a test case corresponding to each functional module is obtained from the at least one test case. The number of test cases for each functional module can be one or more. Each test case is used to indicate the test process of a function of the functional module corresponding to the test case, and the test case corresponding to each functional module is used to indicate the test process of each function of the functional module.
[0103] The language understanding model is used to obtain a comprehensive functional description of the functional module according to the test cases corresponding to the functional module. The comprehensive functional description of the functional module is obtained by integrating the test cases corresponding to the functional module, and is used to summarize at least one function of the functional module. In addition, if the number of test cases for the functional module is one, the comprehensive functional description of the functional module is the test case of the functional module.
[0104] Exemplarily, for the song playing module of the music program, the test cases corresponding to the song playing module include test cases for the progress bar dragging function, test cases for the song starting playing function, test cases for the song playing to the climax part, test cases for the song playing to the end part, and test cases for the function of automatically switching songs after the song is played. The comprehensive functional description corresponding to the song playing module obtained according to the test cases corresponding to the song playing module is used to summarize the various functions of the song playing module, that is, the comprehensive functional description corresponding to the song playing module is used to summarize the progress bar dragging function, the song starting playing function, the song playing to the climax part, the song playing to the end part, and the function of automatically switching songs after the song is played.
[0105] Sub-step 232, updating the functional description of the functional module stored in the knowledge base according to the comprehensive functional description of the functional module, to obtain an updated functional description of the functional module.
[0106] After obtaining the comprehensive functional description of the functional module, the functional description of the functional module stored in the knowledge base is updated to obtain the updated functional description of the functional module.
[0107] In some embodiments, the functional description of the functional module stored in the knowledge base is replaced with the comprehensive functional description of the functional module, and the functional description of the functional module updated in the knowledge base is the comprehensive functional description of the functional module.
[0108] In some embodiments, the language understanding model is used to obtain an updated functional description of the functional module based on the comprehensive functional description of the functional module and the functional description of the functional module stored in the knowledge base. The updated functional description of the functional module is a functional description obtained by semantically fusing the comprehensive functional description of the functional module and the functional description of the functional module stored in the knowledge base.
[0109] After obtaining the test case corresponding to the functional module, the functional description of the functional module stored in the knowledge base is modified and updated, so that the functional description of the updated functional module can more accurately represent at least one function of the functional module, thereby improving the accuracy of use case generation when the use case generation of the first functional module is subsequently executed again.
[0110] Please refer to Figure 5 , which shows a flow chart of a use case generation method provided by another embodiment of the present application. The execution subject of each step of the method may be a computer device. The method may include at least one of the following steps 510 to 530:
[0111] Step 510, obtaining a functional description of a first functional module, where the first functional module is a functional module of a first product.
[0112] Step 520, based on the functional descriptions corresponding to each functional module of the first product stored in the knowledge base and the number of recommended use cases corresponding to each functional module, obtain the number of use cases corresponding to the second functional module that matches the first functional module, where the second functional module is the functional module corresponding to the maximum similarity value.
[0113] The maximum value of the similarity refers to the maximum value of the similarities between the function description corresponding to the first function module and the function descriptions corresponding to each function module.
[0114] In some embodiments, text vectorization is performed on the function description of the first function module to obtain the function description vector corresponding to the first function module; the function description vectors corresponding to each function module are obtained; the similarity between the function description vector corresponding to the first function module and the function description vectors corresponding to each function module are calculated to obtain the similarity corresponding to each function module; the function module corresponding to the maximum value of the similarity among the similarities corresponding to each function module is determined as the second function module. The maximum value of the similarity refers to the maximum value of the similarity between the function description vector corresponding to the first function module and the function description vector corresponding to each function module.
[0115] In some embodiments, feature extraction is performed on the function description of the first function module to obtain the function description features corresponding to the first function module; the function description features corresponding to each function module are obtained; the similarity between the function description features corresponding to the first function module and the function description features corresponding to each function module is calculated to obtain the second similarity corresponding to each function module; the function module corresponding to the maximum value of the second similarity among the second similarities corresponding to each function module is determined as the second function module. The maximum value of similarity refers to the maximum value of the similarity between the function description features corresponding to the first function module and the function description features corresponding to each function module.
[0116] Optionally, the second functional module may be the same functional module as the first functional module. Optionally, the second functional module may also be the functional module whose functional description is most similar to that of the first functional module.
[0117] After obtaining the second functional module, the functional description corresponding to the second functional module and the number of recommended use cases corresponding to the second functional module are obtained from the knowledge base, and the number of use cases corresponding to the second functional module is obtained according to the number of recommended use cases corresponding to the second functional module.
[0118] In some embodiments, the number of recommended use cases corresponding to the second functional module is determined as the number of use cases corresponding to the second functional module.
[0119] In some embodiments, when the number of historical use cases corresponding to the second functional module is greater than or equal to the number of recommended use cases corresponding to the second functional module, the number of historical use cases corresponding to the second functional module is determined as the number of use cases corresponding to the second functional module. When the number of historical use cases corresponding to the second functional module is less than the number of recommended use cases corresponding to the second functional module, the number of recommended use cases corresponding to the second functional module is determined as the number of use cases corresponding to the second functional module.
[0120] In some embodiments, the average of the number of recommended use cases corresponding to the second functional module and the number of historical use cases corresponding to the functional module is determined as the number of use cases corresponding to the second functional module.
[0121] Step 530 , generating a test case corresponding to the first functional module according to the functional description of the first functional module and the number of use cases corresponding to the second functional module through a second generative language model.
[0122] The second generative language model is a model obtained by fine-tuning the large language model according to the second training sample. The training process of the second generative language model is as follows: obtain at least one second training sample of the second generative language model, each second training sample includes a functional description of a sample functional module and a second sample test case, and the sample functional module is a functional module of the first product. According to the functional descriptions corresponding to each functional module of the first product stored in the knowledge base and the number of recommended use cases corresponding to each functional module, the number of use cases corresponding to the second functional module matching the sample functional module is obtained. The second generative language model generates a prediction test case corresponding to the sample functional module according to the functional description of the sample functional module and the number of use cases corresponding to the second functional module matching the sample functional module. With the training goal of reducing the difference between the second sample test case and the prediction test case corresponding to the sample functional module, the parameters of the large language model are adjusted to obtain the second generative language model.
[0123] According to the function description of the first function module and the number of use cases corresponding to the second function module, prompt information is obtained, and the prompt information is used to instruct the second generative language model to generate a test case corresponding to the first function module according to the function description of the first function module and the number of use cases corresponding to the second function module. The function description of the first function module, the number of use cases corresponding to the second function module and the prompt information are input into the second generative language model, and the test case corresponding to the first function module is output.
[0124] The number of test cases corresponding to the first functional module is determined by the number of use cases corresponding to the second functional module. However, the number of test cases corresponding to the second functional module is not necessarily the same as the number of use cases corresponding to the second functional module. The number of test cases corresponding to the second functional module may be greater than the number of use cases corresponding to the second functional module, or less than the number of use cases corresponding to the second functional module, or equal to the number of use cases corresponding to the second functional module.
[0125] In some embodiments, a comprehensive functional description of the second functional module is obtained according to the test case corresponding to the second functional module, and the functional description of the second functional module stored in the knowledge base is updated according to the comprehensive functional description of the second functional module to obtain an updated functional description of the second functional module. Optionally, the updated functional description of the second functional module may be the comprehensive functional description of the second functional module, or may be a functional description obtained by semantically fusing the comprehensive functional description of the second functional module with the functional description of the second functional module stored in the knowledge base.
[0126] It should be noted that the input data of the second generative language model may not include the functional description of the second functional module stored in the knowledge base, and only generate test cases corresponding to the first functional module based on the functional description of the first functional module and the number of use cases corresponding to the second functional module.
[0127] In some embodiments, a test case corresponding to the first functional module is generated by a second generative language model according to a functional description of the first functional module, a functional description corresponding to the second functional module, and the number of use cases corresponding to the second functional module.
[0128] The second functional module that best matches the first functional module is determined through a matching algorithm, and the functional description and number of use cases corresponding to the second functional module are obtained, so that the test cases corresponding to the first functional module are generated according to the functional description of the first functional module and the number of use cases corresponding to the second functional module through a second generative language model, so that the test cases corresponding to the generated first functional module can more accurately represent the testing process of the second functional module, thereby improving the accuracy of use case generation.
[0129] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0130] Please refer to Figure 6 , which shows a block diagram of a use case generation device provided by an embodiment of the present application. The device has the function of implementing the above-mentioned use case generation method, and the function can be implemented by hardware, or by hardware executing corresponding software. The device can be the computer device introduced above, or it can be set in a computer device. Figure 6 As shown, the apparatus 600 may include: a description acquisition module 610 , a function matching module 620 and a use case generation module 630 .
[0131] The description acquisition module 610 is used to acquire a functional description of a first functional module, where the first functional module is a functional module of a first product.
[0132] The function matching module 620 is used to obtain the function description and the number of use cases corresponding to at least one function module matching the first function module according to the function descriptions corresponding to the various function modules of the first product and the number of recommended use cases corresponding to the various function modules stored in the knowledge base.
[0133] The use case generation module 630 is used to generate at least one test case through a first generative language model according to the function description of the first function module, the function description corresponding to the at least one function module respectively, and the number of use cases, wherein the at least one test case includes the test cases corresponding to the at least one function module respectively.
[0134] In some embodiments, the function matching module 620 is used to:
[0135] Obtaining the at least one functional module matching the first functional module according to the functional descriptions respectively corresponding to the functional modules stored in the knowledge base and the functional description of the first functional module;
[0136] Acquire, from the knowledge base, a function description respectively corresponding to the at least one function module and a number of recommended use cases respectively corresponding to the at least one function module;
[0137] According to the number of recommended use cases respectively corresponding to the at least one functional module, the number of use cases respectively corresponding to the at least one functional module is obtained.
[0138] In some embodiments, the function matching module 620 is used to:
[0139] Performing text vectorization on the function description of the first function module to obtain a function description vector corresponding to the first function module;
[0140] Obtaining function description vectors corresponding to each of the function modules;
[0141] Calculating the similarity between the function description vector corresponding to the first function module and the function description vectors corresponding to each of the function modules, to obtain the similarity corresponding to each of the function modules;
[0142] Among the similarities respectively corresponding to the functional modules, the functional module whose similarity is greater than or equal to the first threshold is determined as the at least one functional module.
[0143] In some embodiments, the apparatus 600 further includes a second generating module, wherein the second generating module is configured to:
[0144] According to the functional descriptions corresponding to the functional modules and the number of recommended use cases corresponding to the functional modules stored in the knowledge base, the number of use cases corresponding to the second functional module matching the first functional module is obtained, wherein the second functional module is the functional module corresponding to the maximum value of the similarity;
[0145] Generate test cases corresponding to the first functional module according to the functional description of the first functional module and the number of use cases corresponding to the second functional module through the second generative language model.
[0146] In some embodiments, the function matching module 620 is used to:
[0147] Determine the number of recommended use cases respectively corresponding to the at least one functional module as the number of use cases respectively corresponding to the at least one functional module;
[0148] or,
[0149] The number of use cases corresponding to the at least one functional module is obtained based on the number of recommended use cases corresponding to the at least one functional module and the number of historical use cases corresponding to the at least one functional module. The number of historical use cases corresponding to the functional module is used to indicate the number of test cases generated by executing use cases on the functional module within a historical time period.
[0150] In some embodiments, the function matching module 620 is used to:
[0151] For each functional module in the at least one functional module, when the number of historical use cases corresponding to the functional module is greater than or equal to the number of recommended use cases corresponding to the functional module, the number of historical use cases corresponding to the functional module is determined as the number of use cases corresponding to the functional module; and when the number of historical use cases corresponding to the functional module is less than the number of recommended use cases corresponding to the functional module, the number of recommended use cases corresponding to the functional module is determined as the number of use cases corresponding to the functional module;
[0152] or,
[0153] For each functional module of the at least one functional module, an average value of the number of recommended use cases corresponding to the functional module and the number of historical use cases corresponding to the functional module is determined as the number of use cases corresponding to the functional module.
[0154] In some embodiments, at least one use case is generated for the function module in the historical time period, and the function matching module 620 is used to:
[0155] Determine the average value of the number of test cases corresponding to the at least one use case generation as the number of historical use cases corresponding to the functional module;
[0156] or,
[0157] The maximum value among the numbers of test cases corresponding to the at least one use case generation is determined as the number of historical use cases corresponding to the functional module.
[0158] In some embodiments, the apparatus 600 further includes a description updating module, wherein the description updating module is configured to:
[0159] For each functional module of the at least one functional module, obtaining a comprehensive functional description of the functional module according to a test case corresponding to the functional module, wherein the comprehensive functional description is used to summarize at least one function of the functional module;
[0160] According to the comprehensive functional description of the functional module, the functional description of the functional module stored in the knowledge base is updated to obtain an updated functional description of the functional module.
[0161] The first functional module is matched with each functional module of the first product stored in the knowledge base through a matching algorithm to obtain functional descriptions and the number of recommended use cases corresponding to at least one functional module matching the first functional module, and the number of use cases corresponding to at least one functional module is determined according to the number of recommended use cases corresponding to at least one functional module. Compared with the related art of generating test cases using the number of use cases specified by the tester, the present application generates test cases by using the functional description and the number of use cases corresponding to at least one functional module obtained by the above-mentioned matching algorithm, which can provide more accurate functional description reference and use case number reference for use case generation, thereby controlling the number of use cases of test cases corresponding to each functional module, achieving the effect of controlling the granularity of use case generation, so that the generated at least one test case can comprehensively and accurately evaluate the test process of the first functional module, thereby improving the comprehensiveness and accuracy of use case generation.
[0162] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the content structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0163] Please refer to Figure 7 , which shows a block diagram of a computer device 700 provided in one embodiment of the present application. The computer device 700 may be any electronic device with data computing, processing and storage functions. The computer device 700 may be used to implement the use case generation method provided in the above embodiment.
[0164] Typically, the computer device 700 includes a processor 701 and a memory 702 .
[0165] The processor 701 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 701 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). The processor 701 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 701 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 701 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0166] The memory 702 may include one or more computer-readable storage media, which may be non-transitory. The memory 702 may also include a high-speed random access memory and a non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 702 is used to store a computer program, which is configured to be executed by one or more processors to implement the above-mentioned use case generation method.
[0167] Those skilled in the art will understand that Figure 7 The structure shown in the figure does not constitute a limitation on the computer device 700, and the computer device 700 may include more or less components than shown in the figure, or combine some components, or adopt a different arrangement of components.
[0168] In an illustrative embodiment, a computer-readable storage medium is also provided, wherein a computer program is stored in the storage medium, and the computer program implements the above-mentioned use case generation method when executed by a processor of a computer device. Optionally, the above-mentioned computer-readable storage medium may be a ROM (Read-Only Memory), a RAM (Random Access Memory), a CD-ROM (Compact Disc Read-Only Memory), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0169] In an exemplary embodiment, a computer program product is also provided, the computer program product includes a computer program, the computer program is stored in a computer-readable storage medium, a processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned use case generation method.
[0170] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.
[0171] The above description is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A use case generation method, characterized in that: The method comprises: Obtaining a functional description of a first functional module, where the first functional module is a functional module of a first product; According to the function descriptions corresponding to the function modules of the first product and the number of recommended use cases corresponding to the function modules stored in the knowledge base, obtaining the function description and the number of use cases corresponding to at least one function module matching the first function module; At least one test case is generated through a first generative language model according to a function description of the first function module, a function description corresponding to each of the at least one function module, and the number of use cases, wherein the at least one test case includes test cases corresponding to each of the at least one function module.
2. The method according to claim 1, characterized in that The obtaining, according to the function descriptions corresponding to the function modules of the first product and the number of recommended use cases corresponding to the function modules stored in the knowledge base, the function descriptions and the number of use cases corresponding to at least one function module matching the first function module respectively, comprises: Obtaining the at least one functional module matching the first functional module according to the functional descriptions respectively corresponding to the functional modules stored in the knowledge base and the functional description of the first functional module; Acquire, from the knowledge base, a function description respectively corresponding to the at least one function module and a number of recommended use cases respectively corresponding to the at least one function module; According to the number of recommended use cases respectively corresponding to the at least one functional module, the number of use cases respectively corresponding to the at least one functional module is obtained.
3. The method according to claim 2, characterized in that The obtaining, according to the functional descriptions respectively corresponding to the functional modules stored in the knowledge base and the functional description of the first functional module, the at least one functional module matching the first functional module comprises: Performing text vectorization on the function description of the first function module to obtain a function description vector corresponding to the first function module; Obtaining function description vectors corresponding to each of the function modules; Calculating the similarity between the function description vector corresponding to the first function module and the function description vectors corresponding to each of the function modules, to obtain the similarity corresponding to each of the function modules; Among the similarities respectively corresponding to the functional modules, the functional module whose similarity is greater than or equal to the first threshold is determined as the at least one functional module.
4. The method according to claim 3, characterized in that The method further comprises: According to the functional descriptions corresponding to the functional modules and the number of recommended use cases corresponding to the functional modules stored in the knowledge base, the number of use cases corresponding to the second functional module matching the first functional module is obtained, wherein the second functional module is the functional module corresponding to the maximum value of the similarity; Generate test cases corresponding to the first functional module according to the functional description of the first functional module and the number of use cases corresponding to the second functional module through the second generative language model.
5. The method according to claim 2, characterized in that: The obtaining, according to the number of recommended use cases respectively corresponding to the at least one function module, the number of use cases respectively corresponding to the at least one function module comprises: Determine the number of recommended use cases respectively corresponding to the at least one functional module as the number of use cases respectively corresponding to the at least one functional module; or, The number of use cases corresponding to the at least one functional module is obtained based on the number of recommended use cases corresponding to the at least one functional module and the number of historical use cases corresponding to the at least one functional module. The number of historical use cases corresponding to the functional module is used to indicate the number of test cases generated by executing use cases on the functional module within a historical time period.
6. The method according to claim 5, characterized in that The obtaining the number of use cases corresponding to the at least one functional module respectively according to the number of recommended use cases corresponding to the at least one functional module respectively and the number of historical use cases corresponding to the at least one functional module respectively comprises: For each functional module in the at least one functional module, when the number of historical use cases corresponding to the functional module is greater than or equal to the number of recommended use cases corresponding to the functional module, the number of historical use cases corresponding to the functional module is determined as the number of use cases corresponding to the functional module; and when the number of historical use cases corresponding to the functional module is less than the number of recommended use cases corresponding to the functional module, the number of recommended use cases corresponding to the functional module is determined as the number of use cases corresponding to the functional module; or, For each functional module of the at least one functional module, an average value of the number of recommended use cases corresponding to the functional module and the number of historical use cases corresponding to the functional module is determined as the number of use cases corresponding to the functional module.
7. The method according to claim 5, characterized in that There is at least one use case generation performed on the functional module within the historical time period, and the method further includes: Determine the average value of the number of test cases corresponding to the at least one use case generation as the number of historical use cases corresponding to the functional module; or, The maximum value among the numbers of test cases corresponding to the at least one use case generation is determined as the number of historical use cases corresponding to the functional module.
8. The method according to claim 1, characterized in that The method further comprises: For each functional module of the at least one functional module, obtaining a comprehensive functional description of the functional module according to a test case corresponding to the functional module, wherein the comprehensive functional description is used to summarize at least one function of the functional module; According to the comprehensive functional description of the functional module, the functional description of the functional module stored in the knowledge base is updated to obtain an updated functional description of the functional module.
9. A use case generation device, characterized in that: The device comprises: A description acquisition module, used to acquire a functional description of a first functional module, where the first functional module is a functional module of a first product; a function matching module, configured to obtain, according to the function descriptions corresponding to the function modules of the first product and the number of recommended use cases corresponding to the function modules stored in the knowledge base, a function description and the number of use cases corresponding to at least one function module that matches the first function module; A use case generation module is used to generate at least one test case through a first generative language model according to the function description of the first function module, the function description corresponding to the at least one function module respectively, and the number of use cases, wherein the at least one test case includes the test cases corresponding to the at least one function module respectively.
10. A computer device, characterized in that: The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the use case generation method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the use case generation method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product comprises a computer program, which is loaded and executed by a processor to implement the use case generation method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Test case processing method and system and storage medium
CN116737597A
Natural language training model training method and device, computer equipment and medium
CN116933865A
Test case generation system based on large language model
CN117520148A
Test case construction method and system based on knowledge base and storage medium
CN118672920A
Machine-learning based software testing technique
US20230267073A1