Test case generation method and device, equipment and storage medium

By automatically generating test cases using an intelligent agent model, the problem of low efficiency in manually writing test cases is solved, and efficient and accurate test case generation is achieved.

CN121029604APending Publication Date: 2025-11-28CHONGQING SOKON POWER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511158473.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-19
Publication Date
2025-11-28

AI Technical Summary

Technical Problem

In existing technologies, test cases mainly rely on test engineers to write them manually, which is inefficient and limited by the experience level of the personnel.

Method used

By acquiring test requirement information, test cases are generated using an intelligent agent model, which includes serial and parallel intelligent agent groups. Test cases are generated through relay intelligent agents and contestant/judge mechanisms, respectively.

Benefits of technology

It enables automatic generation of test cases, saving labor costs, improving generation efficiency, and enhancing the accuracy of test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121029604A_ABST
    Figure CN121029604A_ABST
Patent Text Reader

Abstract

The invention provides a test case generation method and device, equipment and a storage medium, test demand information is obtained, the test demand information comprises task content information of a test task and a knowledge fragment associated with the test task, then the test demand information is input into an agent model comprising a plurality of different agents, and a test case is generated according to the agent model. The target test case of the test task is generated and output, the target test case can be automatically generated according to the test task, the labor cost is saved, the case generation efficiency is improved, in addition, the agent model comprises a plurality of different agents, and compared with test case generation through a single agent, the test case generation efficiency is improved. The quality of the generated target test case can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of testing, in particular to a test case generation method and device, equipment and a storage medium. BACKGROUND

[0002] In a software testing technology system, test cases, as an important technical means for verifying software functions, performance and reliability, have become a core element for ensuring software product quality. A test case is usually composed of basic elements such as input data, execution conditions and expected results, and the behavior characteristics of the object under test are verified through a preset test scenario, so as to find potential defects and evaluate system quality attributes.

[0003] In related technologies, test cases are mainly designed by manual writing of test engineers, which is limited by the experience level of test personnel and has low efficiency. SUMMARY

[0004] Embodiments of the present application aim to provide a test case generation method, device, equipment and storage medium to solve the above technical problems.

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

[0006] obtaining test requirement information; the test requirement information includes task content information of a test task and knowledge fragments associated with the test task;

[0007] inputting the test requirement information into an agent model to generate and output target test cases of the test task; the agent model includes a plurality of different agents.

[0008] In one embodiment, the test requirement information is obtained, comprising:

[0009] obtaining dialogue information;

[0010] determining task content information of a test task according to the dialogue information, and generating keywords according to the dialogue information;

[0011] retrieving knowledge fragments associated with the test task from a knowledge base using the keywords.

[0012] In one embodiment, the agent model includes at least one of a serial agent group and a parallel agent group;

[0013] The serial agent group includes a plurality of relay agents connected in series; a first relay agent is used to generate a first generation test case according to the test requirement information, and an i-th relay agent is used to generate an i-th generation test case according to the test requirement information and a last generation test case; i is an integer greater than 1.

[0014] The parallel agent group includes a plurality of contestant agents connected in parallel and a plurality of judge agents respectively connected with the contestant agents; each of the contestant agents is configured to generate a corresponding test case according to the test requirement information, and each of the judge agents is configured to determine and output a final test case according to the test cases generated by the contestant agents.

[0015] The target test case includes a test case generated and output by the relay agent of the last contestant agent in the serial agent group and / or the final test case.

[0016] In one of the embodiments, when the agent model includes the serial agent group, the inputting the test requirement information into the agent model and generating and outputting a target test case of the test task include:

[0017] inputting the test requirement information into the first relay agent, and determining a jth-generation test case output by the jth relay agent as the target test case when the jth-generation test case meets a case requirement condition corresponding to the test task; j is an integer greater than 0 and less than N, and N is the total number of the relay agents in the serial agent group.

[0018] In one of the embodiments, the agent model includes the serial agent group and the parallel agent group, and the inputting the test requirement information into the agent model and generating and outputting a target test case of the test task include:

[0019] when a preset serial mechanism running condition is met, inputting the test requirement information into the serial agent group, and generating and outputting, by the serial agent group, a target test case of the test task;

[0020] when a preset parallel mechanism running condition is met, inputting the test requirement information into the parallel agent group, and generating and outputting, by the parallel agent group, a target test case of the test task.

[0021] In one of the embodiments, the preset serial mechanism running condition includes at least one of the following conditions:

[0022] a current idle resource amount of an electronic device is greater than or equal to a preset idle resource amount threshold; the electronic device is a device currently executing the test case generation method;

[0023] a requirement duration of a test case generation process is greater than or equal to a preset duration threshold;

[0024] The preset parallel mechanism running condition includes at least one of the following conditions:

[0025] The current idle resource amount of the electronic device is less than the preset idle resource threshold;

[0026] The requirement duration of the test case generation process is less than the preset duration threshold.

[0027] In one of the embodiments, the agent model comprises a plurality of agent groups, at least one of the agent groups is one of the serial agent group and the parallel agent group; the obtaining of the test requirement information comprises:

[0028] Obtaining a total task description;

[0029] Performing task decomposition processing according to the total task description to obtain task content information of a plurality of test tasks and knowledge fragments associated with each of the test tasks;

[0030] The inputting of the test requirement information into the agent model to generate and output the target test cases of the test tasks comprises:

[0031] Inputting the task content information and the knowledge fragments corresponding to each of the test tasks into the corresponding agent group to generate target test cases corresponding to each of the test tasks;

[0032] Summarizing and outputting each of the target test cases.

[0033] In another aspect, a test case generation device is also provided, comprising:

[0034] An obtaining module, configured to obtain test requirement information; the test requirement information comprises task content information of test tasks and knowledge fragments associated with the test tasks;

[0035] A generating module, configured to input the test requirement information into an agent model to generate and output target test cases of the test tasks; the agent model comprises a plurality of different agents.

[0036] In another aspect, an electronic device is also provided, comprising a processor and a memory, the memory stores a computer program, and the processor executes the computer program to implement the method according to any one of the above.

[0037] In another aspect, a computer readable storage medium is also provided, which stores a computer program, and the computer program is executed by at least one processor to implement the method according to any one of the above.

[0038] The test case generation method, device, equipment and storage medium provided by the application, by acquiring test requirement information, wherein the test requirement information includes task content information of a test task and a knowledge fragment associated with the test task, then inputting the test requirement information into an agent model containing multiple different agents, generating and outputting a target test case of the test task, can automatically generate a target test case for a test task, save labor cost, improve test case generation efficiency, and in addition, since the agent model contains multiple different agents, compared with test case generation by a single agent, the accuracy of the generated target test case can be improved.

[0039] Other features and advantages of the present application will be set forth in the following description, and in part will become apparent to those skilled in the art from the description, or can be learned by practice of the present application. The objects and other advantages of the present application will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings. It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to the provided drawings without creative labor.

[0041] Figure 1 The flowchart of the test case generation method provided by the embodiments of the present application;

[0042] Figure 2 The flowchart of acquiring a knowledge fragment provided by the embodiments of the present application;

[0043] Figure 3 The structural diagram of a serial agent group provided by the embodiments of the present application;

[0044] Figure 4 The structural diagram of a parallel agent group provided by the embodiments of the present application;

[0045] Figure 5 The structural diagram of an agent model containing multiple agent groups provided by the embodiments of the present application;

[0046] Figure 6 The test case generation system architecture diagram provided by the embodiments of the present application;

[0047] Figure 7Another flowchart of a test case generation method provided by an embodiment of the present application is shown in FIG. 2.

[0048] Figure 8 A structural diagram of a test case generation device provided by an embodiment of the present application is shown in FIG. 3.

[0049] Figure 9 A structural diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 4. DETAILED DESCRIPTION

[0050] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and should not be used to limit the present application.

[0051] An embodiment of the present application provides a test case generation method, which is shown in FIG. 1 and includes the following steps. Figure 1

[0052] S11: Obtain test requirement information; the test requirement information includes task content information of a test task and knowledge fragments associated with the test task.

[0053] S12: Input the test requirement information into an agent model to generate and output target test cases of the test task; the agent model includes a plurality of different agents.

[0054] The task content information in the embodiment of the present application refers to information describing the content of the test task, and the task content information can include but is not limited to at least one of test scope, test object, test target and test environment.

[0055] The knowledge fragments associated with the test task refer to knowledge and technical support for completing the test task, including but not limited to at least one of test methods, test tools and test case format specifications.

[0056] The test case generation method provided by the embodiment of the present application can be applied to an electronic device, which can be a computer, a mobile phone, a tablet or a terminal device such as a vehicle terminal.

[0057] Next, the above steps will be described in detail.

[0058] In an embodiment, the knowledge fragments associated with the test task can be input by a user, that is, the input information input by the user can include the task content information of the test task and the knowledge fragments associated with the test task at the same time.

[0059] ​In view of the different experiences of different users, to improve the accuracy of the generated target test case and the intelligence of the whole generation process, in an embodiment, the knowledge fragment associated with the test task can be obtained by searching in the preset knowledge base. Please refer to Figure 2 As shown in FIG. 11, for the step S11, the following steps can be included:

[0060] S111: Obtain the dialogue information.

[0061] S112: Determine the task content information of the test task according to the dialogue information, and generate the keywords according to the dialogue information.

[0062] S113: Retrieve the knowledge fragment associated with the test task from the knowledge base by using the keywords.

[0063] In an embodiment, the dialogue information can include the input information input by the user through the electronic device based on the test task. In another embodiment, in addition to the input information, the dialogue information can also include the answer information returned by the electronic device to the user based on the input information of the user, which can prompt the user to describe the test task more accurately.

[0064] In an embodiment, the setting of the knowledge base can be performed in advance. Specifically, the pre-input document can be processed to obtain the preset task content information of each preset test task and the preset knowledge fragment associated with each preset test task.

[0065] For example, the document can include a functional requirement document, a signal parameter description document and a test case specification document. The fields in the functional requirement document include at least one or more of number, name, precondition, input signal, output signal and logic. The fields in the signal parameter description document include at least one or more of number, name, English code, unit and specific meaning. The format of the document in the embodiment, the test case mentioned in the embodiment and the format of the target test case can be any one or more of xlsx format, pdf format, doc format and txt format.

[0066] The document is analyzed and sliced to obtain the preset task content information of each preset test task and the preset knowledge fragment associated with each preset test task. And the preset keywords corresponding to each preset knowledge fragment are summarized according to the preset task content information of each preset test task, and the preset keywords and the preset knowledge fragments are stored in the preset knowledge base.

[0067] In the step S112 and the step S113, the task content information of the test task can be determined according to the dialogue information, the keyword can be generated according to the dialogue information, and then according to the correspondence between the preset keyword and the preset knowledge fragment, the knowledge fragment corresponding to the keyword of the current test task is determined as the knowledge fragment associated with the current test task.

[0068] For example, in the knowledge base setting stage, the agent can slice the document, and then the Embedding model can be used to vectorize the sliced document to obtain each preset knowledge fragment. Meanwhile, the agent can summarize the keywords of the sliced document to obtain the corresponding preset keywords, and each preset knowledge fragment and the corresponding preset keywords can be stored in the preset knowledge base.

[0069] In the actual application stage, the agent can analyze the dialogue information to obtain the keyword, and then input the keyword into the Rerank model. The Rerank model can retrieve the knowledge fragment associated with the current test task from the preset knowledge base according to the keyword.

[0070] For example, the agent mentioned in the embodiments of the present application can be any one of the GPT (Generative Pre-trained Transformer), Claude, Gemini, Deepseek, Qwen, Kimi and Doubao series large language models.

[0071] The Embedding model is used to vectorize the sliced document, so as to convert the semantic information into an embedding vector that can be understood by the large language model, and then store it in the preset knowledge base. The Rerank model is used to retrieve the relevant knowledge fragment from the knowledge base according to the keyword.

[0072] For example, the Embedding model and the Rerank model can be any one of the BGE, GTE, E5, Jina, OpenAI and CoROM series models.

[0073] In the embodiments of the present application, the agent in the agent model refers to a model driven by artificial intelligence technology, which can generate test cases according to test requirement information.

[0074] In an embodiment, the agent model includes at least one of a serial agent group and a parallel agent group.

[0075] Please refer to Figure 3As shown, the serial agent group includes a plurality of relay agents connected in series; the first relay agent is configured to generate a first generation of test cases according to the test requirement information, and the i-th relay agent is configured to generate an i-th generation of test cases according to the test requirement information and a last generation of test cases; i is an integer greater than 1.

[0076] As shown, the parallel agent group includes a plurality of contestant agents connected in parallel, and a plurality of judge agents connected to the contestant agents respectively; each contestant agent is configured to generate a corresponding test case according to the test requirement information, and each judge agent is configured to determine and output a final test case according to the test cases generated by the contestant agents. Figure 4

[0077] The target test case includes a test case generated and output by the last relay agent actually participating in the case generation in the serial agent group and / or the final test case.

[0078] For example, when the agent model includes the serial agent group, the serial agent group can generate and output the target test case according to the test requirement information. When the agent model includes the parallel agent group, the parallel agent group can generate and output the target test case according to the test requirement information.

[0079] Next, the operation mechanism of the serial agent group is described.

[0080] For example, the knowledge fragment can include a test case format specification. When the i-th relay agent generates an i-th generation of test cases according to the test requirement information and a last generation of test cases, the i-th relay agent can use the test case format specification and the task content information to update and adjust the last generation of test cases, so that the i-th generation of test cases generated is more consistent with the test case format specification.

[0081] For example, the number of case generation iterations of the serial agent group can be fixed. For example, when the serial agent group is used to generate the target test case, the last relay agent in the serial agent group can be regarded as the last relay agent actually participating in the case generation, and the target test case includes a test case generated and output by the last relay agent in the serial agent group.

[0082] ​For example, to improve the generation efficiency of the target test case, the number of test case generation iterations of the serial agent group can be adaptively adjusted. Specifically, when generating the target test case by using the serial agent group, the test requirement information is input into the first relay agent. When the jth generation test case output by the jth relay agent meets the test case requirement condition corresponding to the test task, the jth generation test case is determined as the target test case. j is an integer greater than 0 and less than N, and N is the total number of the relay agents in the serial agent group. Compared with the fixed test case generation iteration method, the adaptive adjustment of the number of test case generation iterations makes the generation of the target test case more flexible, and can improve the generation efficiency of the target test case as much as possible while ensuring the accuracy of the generated target test case.

[0083] In the example, the test case requirement condition corresponding to the test task can be set by the developer in advance, or can be obtained based on the knowledge fragment corresponding to the test task. For example, the test case requirement condition can include a test case format specification. In this case, if it is determined that the jth generation test case output by the jth relay agent meets the test case format specification, the jth generation test case can be used as the target test case.

[0084] It should be further noted that in the example, the jth relay agent can determine whether the jth generation test case generated by itself meets the test case requirement condition. If yes, the target test case is directly output. If not, the jth generation test case is input into the (j+1) th relay agent, and the (j+1) th relay agent generates a new generation test case. Of course, the (j+1) th relay agent can also determine whether the jth generation test case meets the test case requirement condition. If yes, the (j+1) th relay agent stops test case generation and uses the jth generation test case as the target test case. If not, the (j+1) th relay agent generates a new generation test case based on the jth generation test case and the test requirement information, obtains the (j+1) th generation test case, and inputs the (j+1) th generation test case into the (j+2) th relay agent.

[0085] Next, the operation mechanism of the parallel agent group is described.

[0086] The judge agent can score the test cases generated by the contestant agents, and select the final test case from the scored test cases.

[0087] For example, the knowledge fragment includes a test case format specification. The judge agent can determine m scoring items based on the test case format specification and determine the weight of each scoring item. Of course, the weight can also be set by the user according to the difference in importance of each scoring item. Then, for each version of test cases generated by each contestant agent, the score of each scoring item is determined using the test case format specification. Then, the total score corresponding to each version of test cases is calculated using the scoring item scores and corresponding weights. For example, according to the formula Y = W1X1 + W2X2 + ... + W m X m Calculate the total score for each version of the test cases, where Y represents the total score, and W1, W2, ..., W... m The values ​​X1, X2, ..., X represent the weights of each rating item. m This represents the score for each evaluation item. Then, the judge's agent selects the test case with the highest total score from the various versions of test cases generated by the contestant's agent as the target test case.

[0088] It should be noted that when the serial agent group and the parallel agent group run simultaneously, the final target test cases can include both the test cases generated and output by the last agent in the serial agent group that actually participated in the test case generation and the final test cases output by the judge agent.

[0089] In one embodiment, the agent model includes a serial agent group and a parallel agent group. In this case, inputting test requirement information into the agent model to generate and output target test cases for the test task may include:

[0090] When the preset serial mechanism operating conditions are met, the test requirement information is input into the serial intelligent agent group, which then generates and outputs the target test cases for the test task.

[0091] Once the preset operating conditions of the parallel mechanism are met, the test requirement information is input into the parallel intelligent agent group, which then generates and outputs the target test cases for the test task.

[0092] In this embodiment, either a serial intelligent agent group or a parallel intelligent agent group can be flexibly selected to generate target test cases according to the current situation, making the test case generation more flexible.

[0093] Both the preset serial mechanism operating conditions and the preset parallel mechanism operating conditions can be flexibly set by the developers. In one embodiment, the preset serial mechanism operating conditions may include at least one of the following conditions:

[0094] The current amount of idle resources of the electronic device is greater than or equal to the preset idle resource threshold; the electronic device is the device currently executing the test case generation method;

[0095] The requirement duration of the test case generation process is greater than or equal to a preset duration threshold;

[0096] The preset parallel mechanism running condition can include at least one of the following conditions:

[0097] The current idle resource amount of the electronic device is less than a preset idle resource amount threshold;

[0098] The requirement duration of the test case generation process is less than a preset duration threshold.

[0099] It should be noted that the preset idle resource amount threshold and the preset duration threshold in the embodiment can be flexibly set by the developer.

[0100] For example, the requirement duration of the test case generation process can be issued by the user. The user can input the requirement duration of the test case generation process to the electronic device according to the requirement. Specifically, the requirement duration of the test case generation process can be issued in the dialogue process, that is, the dialogue information mentioned above can include the requirement duration of the test case generation process.

[0101] The serial agent group requires less computing resources, but takes more time, while the parallel agent group requires relatively more computing resources, but takes less time. Therefore, the embodiment can flexibly select a suitable agent group to participate in the work of generating target test cases according to the current idle resource amount of the electronic device and / or the requirement duration of the test case generation process.

[0102] In an embodiment, referring to Figure 5 As shown, the agent model includes a plurality of agent groups, which can form an agent cluster. At least one of the agent groups is one of a serial agent group and a parallel agent group. The step S11 can include the following sub-steps:

[0103] Sub-step one: obtaining a total task description.

[0104] Sub-step two: performing task decomposition processing according to the total task description to obtain task content information of a plurality of test tasks and knowledge fragments associated with each test task.

[0105] Correspondingly, the step S12 can include the following sub-steps:

[0106] Sub-step one: inputting the task content information and the knowledge fragments corresponding to each test task into the corresponding agent group to generate target test cases corresponding to each test task.

[0107] Sub-step two: outputting each target test case.

[0108] For example, the total task description can be input by a user, and a plurality of test tasks can be obtained by task decomposition of the total task description, and the plurality of test tasks are subtasks of the total task corresponding to the total task description.

[0109] For example, a total keyword corresponding to the total task description can be determined, the total knowledge fragment can be obtained by searching the knowledge base according to the total keyword, and the knowledge fragment associated with each test task can be obtained by decomposing the total knowledge fragment. Of course, when the total task description is decomposed, the keywords of the test tasks can be directly determined, and the knowledge fragments associated with the test tasks can be obtained by searching the knowledge base according to the keywords of the test tasks.

[0110] For example, the number of agent groups in the agent model is p, the number of test tasks obtained by decomposition is k, p and k are integers greater than 1, if k≤p, k agent groups are activated, k knowledge fragments and k task content information are input into the corresponding agent groups respectively, and the k agent groups can output the target test cases of the corresponding test tasks; if k>p, p agent groups are activated, p knowledge fragments and p task content information are input into the corresponding agent groups respectively, p target test cases are obtained, after a target test case corresponding to a test task is output by an agent group, a new knowledge fragment and a new task content information are input into the agent group, and a new target test case is obtained, until the generation and output of k target test cases are completed.

[0111] For example, if k≤p, the serial agent groups in the agent model can be activated preferentially, and the serial agent groups can be preferentially used to generate the target test cases corresponding to the test tasks, so that the target test cases corresponding to the test tasks can be simultaneously and respectively generated.

[0112] For example, when the activated intelligent agent group includes a serial intelligent agent group and a parallel intelligent agent group, the use case generation resource requirement corresponding to each test task can be determined according to the task content information and / or the knowledge fragment of each test task, and the serial intelligent agent group or the parallel intelligent agent group is allocated to each test task according to the use case generation resource requirement of each test task. Specifically, the test task with higher use case generation resource requirement can be preferentially allocated to the serial intelligent agent group, and the test task with lower use case generation resource requirement can be preferentially allocated to the parallel intelligent agent group. The use case generation resource requirement represents the amount of computing resources required to generate the target test case corresponding to the test task. For example, the more content contained in the knowledge fragment, the higher the requirement for the test case, and the higher the use case generation resource requirement, so the serial intelligent agent group can be allocated to the test task. Since the serial intelligent agent group itself has a small demand for computing resources, the high demand for computing resources of the test task itself can be balanced in this way.

[0113] In an embodiment, the preset knowledge fragment in the knowledge base can also be checked by the maintenance mode intelligent agent, such as checking whether the preset knowledge fragment in the knowledge base has errors, omissions and irregularities, and outputting modification suggestions. For example, when the maintenance mode is started, the maintenance mode intelligent agent can obtain the task content information of the test task, and obtain the corresponding knowledge fragment from the knowledge base through retrieval, and then check the knowledge fragment.

[0114] Please refer to Figure 6 , Figure 6 the test case generation system architecture diagram provided by the present embodiment, Figure 7 a flowchart of a test case generation method based on the system architecture diagram. Of course, the test case generation system can also perform other test case generation methods mentioned in the above embodiments. The system includes a retriever and a generator, the generator includes an intention recognition intelligent agent for generating task content information according to dialogue information, and further includes a maintenance mode intelligent agent, a single-point mode intelligent agent group and a batch mode intelligent agent cluster. The retriever includes a retrieval intelligent agent, a knowledge base, an Embedding model and a Rerank model.

[0115] It should be noted that in the knowledge base setting stage, after uploading the document, the maintenance mode intelligent agent can check the document and prompt the user according to the checking result. For example, when it is determined through checking that the document has errors, omissions and irregularities, a document modification suggestion can be outputted for prompting, or the document can be directly modified.

[0116] In addition, before each target test case generation, the retrieved knowledge fragments can be rechecked by the maintenance mode agent, and the target test case generation is performed after the rechecking is passed, so as to improve the quality of the finally generated target test case.

[0117] When the number of current test tasks is 1, the corresponding target test case can be generated for the test task by the single-point mode agent group; when the number of current test tasks is multiple, the corresponding target test case set can be generated for multiple test tasks by the batch mode agent cluster.

[0118] The single-point mode agent group is one of a serial agent group and a parallel agent group. The batch mode agent cluster includes multiple agent groups, and the agent group is one of a serial agent group and a parallel agent group.

[0119] Through the test case generation method provided in this embodiment, a suitable mode can be selected as needed, which can not only meet the knowledge base maintenance task, the single-point verification and other fine tasks, but also efficiently support the large-batch test case set generation scene, and flexibly adapt to various task requirements.

[0120] In addition, through the multi-agent cooperation mechanism, the generated target test case is repeatedly checked and optimized, and the performance limitation and illusion of the large language model are avoided to reduce the quality of the test case. In addition, in the face of the generation task of a large batch of test case sets, the multi-agent cooperation mechanism reduces the output pressure of a single agent, shortens the model reasoning time, and greatly improves the test case generation efficiency and quality.

[0121] The knowledge base can be checked before the test case is generated, so as to avoid the influence of document errors on the quality of the test case. When the target test case is generated, a large batch of test cases can be generated first, and then the single-point optimization adjustment is performed after manual inspection, so as to faster realize the coverage of all test task requirements.

[0122] In an embodiment, a test case generation device is provided, please refer to Figure 8 as shown, comprising:

[0123] The acquisition module 801 is configured to acquire test requirement information; the test requirement information includes task content information of a test task and a knowledge fragment associated with the test task;

[0124] The generation module 802 is configured to input the test requirement information into an agent model, generate and output a target test case of the test task; the agent model includes multiple different agents.

[0125] In an embodiment, the obtaining module 801 is configured to obtain dialogue information, determine task content information of a test task according to the dialogue information, and generate a keyword according to the dialogue information; and retrieve a knowledge fragment associated with the test task from a knowledge base by using the keyword.

[0126] In an embodiment, the agent model comprises at least one of a serial agent group and a parallel agent group; the serial agent group comprises a plurality of relay agents connected in series; a first relay agent is configured to generate a first generation of test cases according to the test requirement information, and an i th relay agent is configured to generate an i th generation of test cases according to the test requirement information and a last generation of test cases; i is an integer greater than 1; the parallel agent group comprises a plurality of contestant agents connected in parallel and a judge agent connected to each contestant agent; each contestant agent is configured to generate a corresponding test case according to the test requirement information, and the judge agent is configured to determine and output a final test case according to the test cases generated by each contestant agent; the target test case comprises a test case generated and output by a last relay agent actually participating in case generation in the serial agent group and / or the final test case.

[0127] In an embodiment, when the agent model comprises the serial agent group, the generating module 802 is configured to input the test requirement information into a first relay agent, and determine a j th generation of test cases output by a j th relay agent as the target test case when the j th generation of test cases meets a case requirement condition corresponding to the test task; j is an integer greater than 0 and less than N, and N is the total number of relay agents in the serial agent group.

[0128] In an embodiment, the agent model comprises the serial agent group and the parallel agent group, and the generating module 802 is configured to input the test requirement information into the serial agent group to generate and output a target test case of the test task by the serial agent group when a preset serial mechanism running condition is met, and input the test requirement information into the parallel agent group to generate and output a target test case of the test task by the parallel agent group when a preset parallel mechanism running condition is met.

[0129] In an embodiment, the preset serial mechanism running condition comprises at least one of the following conditions:

[0130] The current idle resource amount of an electronic device is greater than or equal to a preset idle resource amount threshold; the electronic device is a device currently executing the test case generation method;

[0131] The requirement duration of the test case generation process is greater than or equal to a preset duration threshold;

[0132] The preset parallel mechanism running condition comprises at least one of the following conditions:

[0133] The current idle resource amount of the electronic device is less than the preset idle resource amount threshold;

[0134] The requirement duration of the test case generation process is less than the preset duration threshold.

[0135] In an embodiment, the agent model comprises a plurality of agent groups, at least one of the agent groups being one of the serial agent group and the parallel agent group; the obtaining module 801 is configured to obtain a total task description; the total task description is subjected to task decomposition processing to obtain task content information of a plurality of test tasks and knowledge fragments associated with each test task; the generating module 802 is configured to input the task content information and the knowledge fragments corresponding to each test task into the corresponding agent group, to generate target test cases corresponding to each test task; and the target test cases are subjected to aggregation and output.

[0136] It should be understood that, for the sake of brevity of description, some of the contents described in the embodiments are not repeated in the present embodiment.

[0137] In an embodiment, referring to FIG. 8, Figure 9 The electronic device comprises a processor 901 and a memory 902, the memory 902 stores a computer program, and the processor 901 executes the computer program to implement each step of the method described above, which is not repeated here.

[0138] The processor 901 can be an integrated circuit chip with signal processing capability. The processor 901 can be a general-purpose processor, including a CPU (Central Processing Unit), a NP (Network Processor), etc.; or a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. It can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0139] The memory 902 can include, but is not limited to, a RAM (Random Access Memory), a ROM (Read Only Memory), a PROM (Programmable Read Only Memory), an EPROM (Erasable Programmable Read-Only Memory), and an EEPROM (Electrically Erasable Programmable Read Only Memory), and the like.

[0140] Those skilled in the art can understand that, Figure 9 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the application of the scheme of the present application, and the specific electronic device can include more or less components than those shown in the figure, or combine certain components, or have a different component arrangement.

[0141] Based on the same inventive concept, the embodiments of the present application also provide a computer readable storage medium, such as a floppy disk, an optical disk, a hard disk, a flash memory, a U disk, an SD (Secure Digital) card, an MMC (Multi-Media Card) card, etc., which stores a computer program, and the computer program is executed by at least one processor to implement the steps of the methods in the above embodiments, which will not be repeated here.

[0142] Based on the same inventive concept, the embodiments of the present application also provide a computer program product, which includes a computer program, and the computer program is executed by a processor to implement the method according to any one of the above embodiments.

[0143] The program code of the computer program product for executing the present application can be written in any combination of one or more programming languages, and can be executed completely on a user device, partially on a user device, as a separate software package, partially on a user device and partially on a remote device, or completely on a remote device.

[0144] Those skilled in the art will appreciate that embodiments of the application can be readily used as a method, a system or a computer program product. Accordingly, the application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the application can take the form of a computer program product on one or more computer readable storage media (including, but not limited to, disk memory, optical storage etc.) embodying computer readable program code.

[0145] The application is described in reference to the flow diagrams and / or block diagrams of methods, apparatus (systems) and computer program products according to this application. It will be understood that each block of the flow diagrams and / or block diagrams, and combinations of blocks in the flow diagrams and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flow diagrams and / or block diagrams block or blocks. Figure 1 one or more flow or flow diagrams and / or block diagrams Figure 1 means for carrying out the functions specified in the flow diagrams and / or block diagrams block or blocks.

[0146] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the flow diagrams and / or block diagrams flow or flows and / or block or blocks. Figure 1 one or more flow or flow diagrams and / or block diagrams Figure 1 means for carrying out the functions specified in the flow diagrams and / or block diagrams block or blocks.

[0147] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the flow diagrams and / or block diagrams flow or flows and / or block or blocks. Figure 1 one or more flow or flow diagrams and / or block diagrams Figure 1 means for carrying out the functions specified in the flow diagrams and / or block diagrams block or blocks.

[0148] It is to be noted that the drawings provided in the embodiments are only schematic and are intended to provide the basic understanding of the application. In the drawings, the shape, the number and the size of the components are not drawn according to the actual implementation, and the shape, the number and the size of the components in the actual implementation can be changed arbitrarily, and the component layout form can be more complex. The structure, the ratio, the size, etc. shown in the drawings of the present specification are only used to cooperate with the content disclosed in the specification, so as to be understood and read by those skilled in the art, and do not limit the defined conditions that can be implemented by the present application, so it does not have the technical significance. Any modification of the structure, change of the ratio relationship or adjustment of the size, without affecting the effect and purpose that can be achieved by the present application, should still fall within the scope of the technical content disclosed by the present application. At the same time, the terms such as "upper", "lower", "left", "right", "middle" and "one" in the specification are only for the convenience of clear understanding of the description, and are not used to limit the scope of the application that can be implemented, and the change or adjustment of the relative relationship is also regarded as the scope of the application that can be implemented without changing the technical content.

[0149] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly contemplated that embodiments described herein can be combined with other embodiments.

[0150] As used herein, unless the context clearly indicates otherwise, the words "comprise", "comprising", "consisting of" and the like are to be construed in an inclusive sense as opposed to an exclusive or exhaustive sense that they are often carried. That is, unless the context requires otherwise, the words "comprise", "comprising", and the like will be understood to mean the inclusion of one or more integers or components within the composition, group, process, method, or apparatus that is described, but not to the exclusion of other integers or components.

[0151] As used herein, the term "have", "has", "have", or "may have" indicates the presence of the corresponding function, operation, element, etc. herein, and does not limit the presence of other function or operation, element, etc. In addition, it should be understood that the term "include" or "have" as used herein indicates the presence of the features, numbers, steps, operations, elements, components or combinations described in the specification, and does not exclude the presence or addition of one or more other features, numbers, steps, operations, elements, components or combinations.

[0152] The prefix words such as "first", "second" are used in the embodiments of the present application only to distinguish different description objects, and have no limiting effect on the position, order, priority, quantity or content of the described objects. The use of ordinal words such as "first" in the embodiments of the present application does not limit the described objects, and the description of the described objects should be seen in the context of the claims or embodiments, and should not be construed as redundant limitation because of the use of such prefix words. In addition, in the description of the embodiments, unless otherwise stated, the meaning of "a plurality of" is two or more.

[0153] The technical features of the above embodiments can be combined arbitrarily. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, but as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.

[0154] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.

Claims

1. A test case generation method, characterized in that, include: Obtain test requirement information; The test requirement information includes the task content information of the test task and the knowledge fragments associated with the test task; The test requirement information is input into the agent model to generate and output the target test cases for the test task; the agent model includes multiple different agents.

2. The test case generation method as described in claim 1, characterized in that, The acquisition of test requirement information includes: Obtain dialogue information; The task content information of the test task is determined based on the dialogue information, and keywords are generated based on the dialogue information; The keywords are used to retrieve knowledge fragments related to the test task from the knowledge base.

3. The test case generation method as described in claim 1, characterized in that, The agent model includes at least one of serial agent groups and parallel agent groups; The serial intelligent agent group includes multiple relay intelligent agents connected in series; the first relay intelligent agent is used to generate the first generation test case according to the test requirement information, and the i-th relay intelligent agent is used to generate the i-th generation test case according to the test requirement information and the previous generation test case. i is an integer greater than 1; The parallel intelligent agent group includes multiple contestant intelligent agents connected in parallel and judge intelligent agents connected to each contestant intelligent agent respectively; each contestant intelligent agent is used to generate its own corresponding test cases according to the test requirement information, and the judge intelligent agent is used to determine and output the final test cases according to the test cases generated by each contestant intelligent agent. The target test cases include the test cases generated and output by the relay agent generated by the last actual participating test case in the serial agent group and / or the final test cases.

4. The test case generation method as described in claim 3, characterized in that, When the agent model includes the serial agent group, the step of inputting the test requirement information into the agent model, generating and outputting the target test cases for the test task includes: The test requirement information is input into the first relay agent. When the j-th generation test case output by the j-th relay agent meets the test case requirement conditions corresponding to the test task, the j-th generation test case is determined as the target test case; j is an integer greater than 0 and less than N, and N is the total number of relay agents in the serial agent group.

5. The test case generation method as described in claim 3, characterized in that, The agent model includes the serial agent group and the parallel agent group. The step of inputting the test requirement information into the agent model and generating and outputting the target test cases for the test task includes: When the preset serial mechanism operating conditions are met, the test requirement information is input into the serial intelligent agent group, and the serial intelligent agent group generates and outputs the target test cases of the test task. When the preset parallel mechanism operation conditions are met, the test requirement information is input into the parallel intelligent agent group, which then generates and outputs the target test cases for the test task.

6. The test case generation method as described in claim 5, characterized in that, The preset operating conditions for the serial mechanism include at least one of the following: The current amount of idle resources of the electronic device is greater than or equal to a preset idle resource threshold; the electronic device is the device currently executing the test case generation method; The required duration of the test case generation process is greater than or equal to a preset duration threshold. The preset parallel mechanism operation conditions include at least one of the following conditions: The current amount of idle resources of the electronic device is less than the preset idle resource threshold. The required time for the test case generation process is less than the preset time threshold.

7. The test case generation method as described in claim 3, characterized in that, The agent model includes multiple agent groups, at least one of the agent groups being either the serial agent group or the parallel agent group; obtaining test requirement information includes: Get the overall task description; Based on the overall task description, task decomposition processing is performed to obtain task content information of multiple test tasks and knowledge fragments associated with each test task. The step of inputting the test requirement information into the intelligent agent model, generating and outputting the target test cases for the test task includes: Input the task content information and knowledge fragments corresponding to each test task into the corresponding intelligent agent group to generate target test cases corresponding to each test task; The target test cases described above are summarized and output.

8. A test case generation device, characterized in that, include: The acquisition module is used to acquire test requirement information; The test requirement information includes the task content information of the test task and the knowledge fragments associated with the test task; The generation module is used to input the test requirement information into the agent model, generate and output the target test cases of the test task; the agent model includes multiple different agents.

9. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to implement the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by at least one processor, implements the method as described in any one of claims 1-7.