Test case generation method and device and electronic equipment

By displaying controls on the target interface and combining a large generative language model with prompt information, one-click fully automatic test case generation is achieved, solving the problems of low generation efficiency and difficult quality assurance in existing technologies, and improving the efficiency and quality of test case generation.

CN120803899APending Publication Date: 2025-10-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410423245.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-09
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

The test case generation schemes in the existing technology have low versatility, high complexity, and lack of effective feedback mechanism, resulting in low test case generation efficiency and difficulty in ensuring quality.

Method used

By displaying controls on the target interface to input requirement data, a large-scale generative language model and prompt information combination are used to automatically generate test cases, and rendering is performed based on test type elements to achieve one-click fully automatic test case generation.

Benefits of technology

It significantly improves the efficiency and quality of test case generation, reduces user learning load and labor costs, meets the needs of diverse test types and scenarios, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803899A_ABST
    Figure CN120803899A_ABST
Patent Text Reader

Abstract

The invention discloses a test case generation method and device and electronic equipment, and belongs to the technical field of artificial intelligence. The test case generation method comprises the steps that a first control and a second control are displayed on a target interface; acquiring target demand data under the condition that the first control is triggered; under the condition that the second control is triggered, sequentially carrying out demand element extraction and demand element-based code text processing on the target demand data to obtain a standard demand document; analyzing the standard demand document to obtain tested function elements and test type elements; determining first prompt information matched with the test type element, wherein the first prompt information is used for indicating the large-scale generative language model to output a test case for testing the tested functional element in a test mode indicated by the test type element; inputting the first prompt information and the standard requirement document into a large-scale generative language model to obtain a test case; and rendering the test case in a rendering mode corresponding to the test type element in the target interface. According to the method and the device, one-button test case generation and display can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

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

[0002] A test case refers to description information used for a function test task performed on an application. By writing test input, execution conditions and expected results in a test case, it can be verified based on the test case whether the application being tested can meet specific functional requirements. Related technologies generally rely on manual writing of test cases, which often requires a lot of time and effort. Of course, some semi-automatic or automatic test case generation schemes have been proposed, but these schemes have the problems of low universality and high complexity. SUMMARY

[0003] The embodiments of the present application provide a test case generation method, device and electronic equipment, which can automatically generate test cases, have strong universality and low complexity, significantly reduce the learning load and labor cost of testers, can realize visual one-key test case generation, thereby significantly improving the test case generation efficiency and improving the application experience of testers.

[0004] According to an aspect of an embodiment of the present application, a test case generation method is provided, which comprises:

[0005] Displaying a first control and a second control on a target interface, the first control being used to import requirement data, and the second control being used to trigger generation of a test case;

[0006] In the case where the first control is triggered, obtaining target requirement data;

[0007] In the case where the second control is triggered, sequentially performing requirement element extraction and code-based text processing on the target requirement data to obtain a standard requirement document;

[0008] Analyzing the standard requirement document to obtain a tested function element and a test type element;

[0009] Determining a first prompt information, the first prompt information being matched with the test type element, and the first prompt information being used to instruct a large generative language model to output a test case used to test the tested function element in a test mode indicated by the test type element;

[0010] Inputting the first prompt information and the standard requirement document into the large generative language model to obtain a test case;

[0011] In the target interface, rendering the test case in a rendering mode corresponding to the test type element.

[0012] According to an aspect of the embodiments of the present application, a test case generation device is provided, the device comprising:

[0013] a display module configured to display a first control and a second control on a target interface, the first control being configured to transmit incoming requirement data, and the second control being configured to trigger generation of a test case;

[0014] a test case generation module configured to, in a case where the first control is triggered, acquire target requirement data; in a case where the second control is triggered, sequentially perform requirement element extraction and code-based text processing based on requirement elements on the target requirement data to obtain a standard requirement document; parse the standard requirement document to obtain a tested function element and a test type element; determine a first prompt information, the first prompt information being matched with the test type element, the first prompt information being configured to instruct a large generative language model to output a test case for testing the tested function element in a test mode indicated by the test type element; and input the first prompt information and the standard requirement document into the large generative language model to obtain a test case;

[0015] the display module is further configured to render the test case in the target interface in a rendering mode corresponding to the test type element.

[0016] According to an aspect of the embodiments of the present application, a computer device is provided, the computer device comprising a processor and a memory, the memory storing at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by the processor to implement the test case generation method described above.

[0017] According to an aspect of the embodiments of the present application, a computer readable storage medium is provided, the storage medium storing at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by a processor to implement the test case generation method described above.

[0018] According to an aspect of the embodiments of the present application, a computer program product is provided, the computer program product comprising computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform to implement the test case generation method described above.

[0019] The technical solutions provided by the embodiments of the present application can bring the following beneficial effects:

[0020] The embodiment of the application provides a test case generation method, device and electronic equipment, which can display a first control and a second control on a target interface, realizes the import of user demand data based on the first control, realizes one-key test case generation and display based on the demand data when the second control is triggered, and the test case is displayed in a form corresponding to a test type, thereby realizing the technical effect of one-key direct visualization of user requirements for test cases, without any intermediate state, directly hitting the user's fundamental appeal, and significantly improving user experience.

[0021] In addition, the first prompt information is generated based on the test type element and the measured function element in the test case generation process, so that the large-scale generative language model outputs the test case under the prompt of the first prompt information. In this way, on the one hand, the combination of prompt information and the large-scale generative language model realizes automatic test case generation, on the other hand, it also ensures the quality of the test case, and the prompt information matches the test type element, so that the output test case can also match the test type, and the user no longer needs to convert the type of the test case, which also facilitates the rendering of the test case in a test type matching manner, and significantly improves the user experience. BRIEF DESCRIPTION OF DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the application, the drawings needed to be used in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.

[0023] Figure 1 is a schematic diagram of an application running environment provided by an embodiment of the application;

[0024] Figure 2 is a flowchart of a test case generation method provided by an embodiment of the application;

[0025] Figure 3 is a schematic diagram of a target interface provided by an embodiment of the application;

[0026] Figure 4 is a schematic diagram of prompt information corresponding to an artificial test type and a behavior-driven type respectively provided by an embodiment of the application;

[0027] Figure 5 is a schematic diagram of a prompt information generation method based on a knowledge base provided by an embodiment of the application;

[0028] Figure 6 is a schematic diagram of a test case generation method provided by an embodiment of the application;

[0029] Figure 7is a test case rendering result schematic diagram provided by an embodiment of the present application;

[0030] Figure 8 is a system architecture diagram of an embodiment test case generation method provided by an embodiment of the present application;

[0031] Figure 9 is a block diagram of a test case generation apparatus provided by an embodiment of the present application;

[0032] Figure 10 is a structural block diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0033] Before introducing the method embodiments provided by the present application, the related terms or nouns possibly involved in the method embodiments of the present application are briefly introduced, so as to facilitate the understanding of the present application by the skilled in the art.

[0034] Artificial Intelligence (AI) is to use digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which tries to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making.

[0035] Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, both hardware and software technologies. Artificial intelligence basic technologies generally include technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, large test case generation technology, operation / interaction system, mechatronics, etc. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc.

[0036] Cloud technology refers to the integration of hardware, software, network, and other resources in a wide area network or local area network to achieve data calculation, storage, processing, and sharing. Cloud technology is a combination of network technology, information technology, integration technology, management platform technology, and application technology based on cloud computing business model. It can form a resource pool and be used on demand. Cloud computing technology will become an important support. The backend service of a technical network system requires a large amount of computing and storage resources, such as video websites, image websites, and more portals. With the high development and application of the Internet industry, every item may have its own identification mark in the future, and it needs to be transmitted to the backend system for logical processing. Different levels of data will be processed separately, and various industry data will require strong system support, which can only be achieved through cloud computing.

[0037] Natural Language Processing (NLP): is an important direction in the field of computer science and artificial intelligence. It studies various theories and methods that can realize effective communication between people and computers using natural language. Natural Language Processing is a scientific field that integrates linguistics, computer science, and mathematics.

[0038] LLM: Large Language Model (English Large Language Model, LLM) refers to a computer model that can process and generate natural language. It represents a major advance in the field of artificial intelligence and natural language processing (NLP), and has the potential to change these fields through learned knowledge. LLM can predict the next word or sentence by learning the statistical rules and semantic information of language data. As the input data set and parameter space continue to expand, the ability of LLM will also improve accordingly. It is used in various application fields such as robotics, machine learning, machine translation, speech recognition, image processing, etc.

[0039] Prompt tuning: Prompt learning, a learning method in machine learning: by adding "prompt information" to the input as a kind of information enhancement, the effect of the model can be greatly improved without significantly changing the structure and parameters of the pre-trained language model. He can be seen as an instruction for the task, but also a reuse of the pre-training goal. Its essence is the enhancement of parameter effectiveness training. By generating a prompt template separately, then fine-tuning and evaluating on each task. The prompt information in prompt learning (Prompt) can significantly enhance the ability of LLM and improve the accuracy of LLM output results.

[0040] Transformer: A type of neural network that learns context and thus meaning by extracting relationships in sequential data. Transformer models apply a set of evolving mathematical techniques called attention or self-attention to detect subtle ways in which even distant data elements in a series influence and depend on each other. Transformers are the backbone network for large generative language models.

[0041] Instruction Tuning: Instruction tuning refers to generating instructions for each task individually by fine-tuning on several tasks and then evaluating the generalization ability on specific tasks. It is usually done on a large public NLP task data set to stimulate the understanding ability of the language model, and by giving more explicit instructions, the model can understand and give correct feedback.

[0042] Fine-tuning: In the field of machine learning, especially deep learning, fine-tuning refers to fine-tuning a pre-trained model using a specific task dataset to achieve better performance on that task. Instruction Tuning belongs to Fine-tuning.

[0043] Few-Shot Learning is a machine learning paradigm that aims to enable models to complete learning tasks with a small number of samples. Few-Shot Learning uses the idea of "less is more" to achieve model training and generalization with very few samples. In the field of natural language processing (NLP), Few-Shot Learning can learn new tasks on limited data sets and achieve high performance without a large amount of labeled data.

[0044] Before specifically describing the embodiments of the present application, the related technical background related to the embodiments of the present application is introduced, so as to facilitate the understanding of the technical personnel in the field of the present application.

[0045] Test cases refer to the description information used for functional testing tasks performed on applications. By writing test inputs, execution conditions and expected results in test cases, it can be verified whether the tested application can meet specific functional requirements based on test cases. Related technologies generally rely on manual test case writing, and of course semi-automatic or automatic test case generation schemes such as template-based test case generation, rule-based test case generation, and search algorithm-based test case generation have also been proposed. However, these test case writing or generation schemes have the following problems:

[0046] In the scheme of manually writing test cases, the tester can analyze the requirements one by one according to the requirement document, and then write the corresponding test cases. The advantage of this scheme is easy to understand and suitable for various scenarios, but the efficiency of manually writing test cases is low and time-consuming. The tester needs to analyze the requirements one by one and then write the corresponding test cases, which often requires a lot of time and effort.

[0047] In the template-based test case generation scheme, the tester can quickly generate some general test cases through the pre-defined test case structured template. In the rule-based test case generation scheme, the requirement document can be converted into test cases through the pre-defined rule set. The advantages of these two methods are that they can improve the writing efficiency and realize automatic generation of test cases, but the universality is limited. The structured template or rule set itself is difficult to design and needs to be defined in advance, and in actual application, it is often difficult to cover all requirements, so the generated test cases may not fully meet the testing requirements.

[0048] In the test case generation scheme based on search algorithm, the test case that meets the specific test target is found through search algorithms such as genetic algorithm and simulated annealing algorithm. The advantage of this method is that it can automatically generate test cases and cover more test scenarios, but the algorithm complexity is high and the maintenance is difficult.

[0049] In summary, the test case generation scheme in the related art has the problems of low universality and high complexity, and the related art often lacks an effective feedback mechanism in the process of generating test cases, which makes the tester unable to understand the quality of the generated test cases in time, so as to adjust the test strategy in time. The test case generation method proposed in the embodiments of the present application can provide a test case generation scheme with high efficiency, full automation, high accuracy, high controllability, high universality and easy operation.

[0050] The test case generation method proposed in the embodiments of the present application can display a first control and a second control on a target interface, realize the import of user requirement data based on the first control, and realize one-key test case generation and display based on the requirement data when the second control is triggered, and the test case is displayed in the form corresponding to the test type, thereby realizing the technical effect of one-key direct visualization of the user's requirement for the test case, without any intermediate state in the middle, directly hitting the user's fundamental appeal, and significantly improving the user experience.

[0051] And, the first prompt information is generated based on the test type element and the tested function element in the test case generation process, so as to trigger the large generative language model to output the test case under the prompting of the first prompt information. In this way, on the one hand, the combination of the prompt information and the large generative language model realizes the automatic generation of the test case, and on the other hand, the quality of the test case is ensured. Moreover, the prompt information matches the test type element, so that the output test case can also match the test type, and the user no longer needs to convert the type of the test case, which also facilitates the rendering of the test case in the test type matching manner, and significantly improves the user experience.

[0052] In order to make the objects, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings. It should be noted that the various data used by the embodiments of the present application are fully authorized before use. Figure 1

[0053] Please refer to Figure 2 which shows a schematic diagram of an application running environment provided by an embodiment of the present application. The application running environment can include a terminal 10 and a server 20.

[0054] The terminal 10 includes but is not limited to a mobile phone, a computer, a smart voice interactive device, a smart home appliance, a vehicle-mounted terminal, a game console, an e-book reader, a multimedia playback device, a wearable device, etc. The terminal 10 can install a client of an application.

[0055] In the embodiments of the present application, the above-mentioned application can be any application that can provide or rely on a test case generation service. Typically, the application is a game application. Of course, in addition to the game application, the test case generation service can also be provided or relied on in other types of applications. For example, a news application, a social application, an interactive entertainment application, a browser application, a shopping application, a content sharing application, a virtual reality (VR) application, an augmented reality (AR) application, etc. The embodiments of the present application do not limit this. Optionally, the terminal 10 runs a client of the above-mentioned application.

[0056] The server 20 is configured to provide background services for the client of the application program in the terminal 10. For example, the server 20 can be a background server of the application program. The server 20 can be a single physical server, a server cluster composed of multiple physical servers, or a distributed system. The server 20 can also be a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms. Alternatively, the server 20 can provide background services for multiple application programs in multiple terminals 10.

[0057] Optionally, the terminal 10 and the server 20 can communicate with each other through the network 30. The terminal 10 and the server 20 can be directly or indirectly connected through wired or wireless communication, which is not limited in the present application.

[0058] Please refer to Figure 1 , which shows a flowchart of a test case generation method provided by an embodiment of the present application. The method can be applied in a computer device, which is an electronic device with data computing and processing capabilities. For example, the execution subject of each step can be a device in the application program running environment shown in Figure 3 , such as the server 20 or the terminal 10 running the client. The method can include the following steps:

[0059] Step S201. Display a first control and a second control on a target interface. The first control is configured to input requirement data, and the second control is configured to trigger the generation of a test case.

[0060] The embodiments of the present application do not limit the requirement data. For example, the requirement data can include information such as which functions to test, which test type to use to test the functions, and in which scenarios to test the functions. These information can be abstractly expressed as requirement elements. The embodiments of the present application do not limit the requirement elements, which can include at least one of the following: a function-to-be-tested element, a test type element, a test scenario element, a test case quantity element, and a test case coverage rate element.

[0061] Please refer to Figure 3The target interface diagram shows that the target interface diagram in the embodiment of the application can transmit requirement data in three ways of direct input, uploading a file or selecting from a requirement management system. The carrier controls of the three ways belong to the first control. In the case that the first control is triggered, the requirement data can be transmitted. In the case that the second control "generate test case" is triggered, the test case can be generated and displayed. The requirement management system is a system for managing test requirements. The system can be developed independently or developed as a component of a system for implementing the test case generation method in the embodiment of the application.

[0062] The system for implementing the test case generation method can help the R&D personnel and the test personnel to quickly generate test cases based on software requirements, so as to quickly understand the software requirements through the test cases. The system can help the relevant personnel to build a more complete test idea and coverage path through the automatically generated test cases, and finally improve the test efficiency to save the writing time of the R&D personnel and the test personnel and improve the experience. Figure 4 The requirement data required to be input can be a text data. For the user, the requirement text can be directly input in the input area, can be a text file uploaded, or can be a requirement single in the requirement management system. Essentially, it is a text data of a requirement document. In the system for implementing the test case generation method, the user can newly create a test case and associate the requirement document. The system for implementing the test case generation method can quickly generate the test case corresponding to the requirement data without the historical data and close to the format of the user's habits. For example, if the user is used to the manual test method, the test case matching the manual test type can be output. If the user is used to the behavior-driven test method, the test case matching the behavior-driven type can be output.

[0063] Step S202. In the case that the first control is triggered, the target requirement data is acquired.

[0064] The target requirement data is the requirement data transmitted by the user by triggering the first control. The target requirement data is the core input for generating the test case. In general, it can fully explain the related points of the tested function and better support more businesses. However, the requirements of each business are different. In order to increase the adaptability to the business, the embodiment of the application processes the target requirement data in step S203.

[0065] Step S203. In the case that the second control is triggered, the target requirement data is sequentially subjected to requirement element extraction and code text processing based on the requirement element, and a standard requirement document is obtained.

[0066] After the demand elements are extracted, the demand elements need to be integrated and coded to form a standard demand document with a format standard for large generative language models to understand. The integration and coding process is not limited by the embodiments of the application, which does not constitute an implementation obstacle. In a feasible implementation, the code-based text processing based on the demand elements can be in the Markdown processing mode. Markdown is a lightweight markup language that allows documents to be written in a readable and easy-to-write plain text format. This language absorbs many features of plain text markup.

[0067] Step S204. Analyze the above standard demand document to obtain the tested function element and the test type element.

[0068] The test type element is important information related to both the generation of prompt information and the rendering of test cases. The tested function element can include only the tested function element itself, but can also include other elements used to assist testing, such as the aforementioned test scenario element, test case quantity element, and test case coverage of test scenario element, which can also be integrated into the tested function element.

[0069] Step S205. Determine the first prompt information, which matches the test type element. The first prompt information is used to instruct the large generative language model to output test cases for testing the tested function element in the test mode indicated by the test type element.

[0070] The embodiments of the application do not limit the generation method of the first prompt information, which can be generated directly according to the tested function element and the test type element, and does not constitute an implementation obstacle. In an embodiment, the determination of the first prompt information includes: in the case where the test type element indicates manual testing type, generating the first prompt information in the form of scenario description; and in the case where the test type element indicates behavior-driven type, generating the first prompt information in the form of behavior link.

[0071] Please refer to Figure 4 which shows the prompt information diagrams corresponding to the manual testing type and the behavior-driven type in the embodiments of the application. The design purpose of the test cases for manual testing type is to facilitate manual testing by reproducing a clear scenario, and the design purpose of the test cases for behavior-driven type is to simulate the behavior link of triggering a function to complete testing. The embodiments of the application distinguish between these two different test types to meet the needs of testers in different testing situations. Figure 4 (1) The first prompt information diagram corresponding to the manual testing type, in which the code describes the concrete test scenario, thereby facilitating the large generative language model to generate test cases by reproducing the scenario. Figure 5(2) The first prompt information diagram corresponding to the behavior-driven type. The code in the diagram describes the behavior link formed by multiple behaviors, thereby facilitating the large generative language model to generate test cases by constructing the behavior link.

[0072] In one embodiment, the application can also generate the first prompt information based on the existing knowledge base in combination with the tested functional element and the test type element. Please refer to Figure 3 which shows the prompt information generation method based on the knowledge base in the embodiment of the application. The above determination of the first prompt information includes:

[0073] Step S501. Display a third control on the target interface. The third control is used to trigger the case generation based on the knowledge base. The knowledge base includes at least one of the following: a scenario case prompt library, a behavior case prompt library, a test function prompt library, and a concept library. The scenario case prompt library is used to store prompt information associated with a test scenario. The behavior case prompt library is used to store prompt information associated with an account behavior. The test function prompt library is used to store prompt information associated with a tested function. The concept library is used to store background technical knowledge.

[0074] Please refer to the control in Figure 3 , Figure 6 that indicates the knowledge base. The knowledge base contains relevant business background knowledge and related prompt information of multiple businesses. If the third control is triggered, the knowledge base can be automatically matched with the tested functional element to generate higher-quality first prompt information.

[0075] Step S502. Extract prompt information or background technical knowledge associated with the tested functional element from the knowledge base.

[0076] The prompt information and background technical knowledge in the knowledge base for generating test cases related to the tested functional element can be used as part of the first prompt information. Compared with the scheme of generating the first prompt information directly based on the tested functional element, the content of the first prompt information generated in combination with the knowledge base is obviously more abundant. By improving the quality of the first prompt information, the quality of the generated test cases can be improved. The knowledge base includes behavior prompts, scenario prompts, function prompts, and can also supplement background knowledge, thereby significantly improving the quality of the first prompt information.

[0077] Step S503. Based on the extraction result, generate the first prompt information matched with the test type element.

[0078] The integrated extraction result is supplemented into the first prompt information, so as to improve the quality of the first prompt information. In an embodiment, the test cases generated in the past can be stored to build a test case library, and the existence of the test case library can further improve the quality of the first prompt information generated based on the extraction result and matched with the test type element. The determination of the first prompt information further includes: in a case where there is an associated test case in the test case library, the associated test case has a higher correlation with the to-be-tested function element than a preset threshold, and the first prompt information matched with the test type element is generated according to the associated test case, the to-be-tested function element, and the extraction result. The first prompt information is used to instruct the large generative language model to output other test cases for testing the to-be-tested function element in the test mode indicated by the test type element, except for the associated test case. Of course, the present application does not limit the calculation method of the correlation and the size of the preset threshold, which does not constitute an implementation obstacle.

[0079] In a case where there are many associated test cases suitable for the target requirement data in the test case library, the first prompt information matched with the test type element can be generated according to the associated test case, the to-be-tested function element, and the extraction result. The first prompt information is a kind of prompt information for generating incremental test cases. In this way, the large generative language model can generate more perfect test cases by checking and supplementing the associated test case based on sufficient knowledge base information and the actual needs of the target requirement data. The test case generation result and the associated test case form a complete test case pool, and the high-quality test case pool significantly improves the test effect.

[0080] Step S206. Inputting the first prompt information and the standard requirement document into the large generative language model to obtain a test case.

[0081] The large generative language model is a special model with a transformer as a skeleton, and the present application does not limit this. The first prompt information is a kind of Prompt used to constrain the output of the large generative language model. Under the action of the first prompt information, the large generative language model can output a test case for testing the to-be-tested function element in the test mode indicated by the test type element.

[0082] In an embodiment, please refer to Figure 7 which shows a test case generation method of an embodiment of the present application. The inputting of the first prompt information and the standard requirement document into the large generative language model to obtain a test case includes:

[0083] Step S601. Input the first prompt information and the standard requirement document into the large generative language model to obtain a first output text.

[0084] Step S602. In a case where the first output text includes a test case prompt, extract an initial case from the first output text based on the test case prompt.

[0085] In some cases, the large generative language model outputs a prompt such as “OK, I understand your requirements, and I will now start writing the test case for you: ” and the generation result of the test case follows the prompt, so the initial case can be extracted by extracting the prompt.

[0086] Step S603. In a case where the initial case fails the integrity check, determine the missing case elements of the initial case.

[0087] A complete test case should include four case elements of test case name, preconditions, operation steps, and expected results, but the present application embodiment proposes that the initial case output by the large generative language model may be missing some case elements in some cases, and therefore, the present application embodiment judges whether the initial case output by the large generative language model includes the complete four case elements through the integrity check. If not, the integrity check fails.

[0088] Step S604. Based on the missing case elements, generate a second prompt information, the second prompt information being used to instruct the large generative language model to continue outputting the missing case elements in the initial case.

[0089] Step S605. Input the second prompt information and the initial case into the large generative language model to obtain a second output text.

[0090] The second prompt information is generated in the context created by steps S601 to S604, and therefore, the second prompt information can be regarded as a subsequent dialogue with the large generative language model. Through at least one subsequent dialogue, the large generative language model is guided to generate the second output text, and even more output texts subsequently.

[0091] Step S606. Based on the second output text and the initial case, generate the test case.

[0092] The test case can be generated in combination with the previous output texts and the initial case. The test case generation scheme can improve the accuracy of the test case, avoid including non-test case content, and ensure the completeness of the test case.

[0093] Step S207. In the above target interface, the test case is rendered in the rendering mode corresponding to the above test type element.

[0094] The present application renders test cases according to test type elements, which directly displays test cases that meet the requirements of test types and user testing habits. The above test case is rendered in the rendering mode corresponding to the above test type element, including: extracting the test case elements to obtain a plurality of test case elements, the plurality of test case elements including test case name, preconditions, operation steps and expected results; in the case of manual test type indicated by the test type element, generating a textual data record based on the plurality of test case elements, and rendering the textual data record in text form; in the case of behavior-driven type indicated by the test type element, performing node processing on each of the test case elements to generate a tree-shaped data record corresponding to the test case, and rendering the tree-shaped data record in the form of mind map.

[0095] Please refer to Figure 7 , which shows the test case rendering result schematic diagram in the embodiment of the present application. Figure 7 (1) is a test case rendering result schematic diagram corresponding to manual test type. Figure 7 (1) The left side shows various requirement elements in the standard requirement document, Figure 7 (1) The right side shows the textual data record formed by the test case rendered in text form. Figure 7 (1) In the middle, a plurality of test cases can be generated for user preview, editing and saving. Figure 8 (2) shows the tree-shaped data record formed by the test case rendered in the form of mind map, and the generated test case is displayed in the form of user habit mind map. The user only needs to add, delete or modify the mind map to complete the editing and saving of the test case.

[0096] The embodiment of the present application further includes: in the case of manual test type indicated by the test type element, in response to the editing operation on the textual data record, modifying the textual data record, and storing the modified textual data record; in the case of behavior-driven type indicated by the test type element, in response to the editing operation on the node of the tree-shaped data record, modifying the tree-shaped data record, and storing the modified tree-shaped data record.

[0097] The core of the test case generation method proposed in the embodiments of the present application is to automatically process data and automatically generate structured test cases by inputting target requirement data, and to support WYSIWYG editing of test cases. This method mainly solves the problems of low efficiency and long time consumption in the test case writing process, significantly saving the time of test personnel from 0 to 1 in writing test cases. When generating test cases, the large generative language model technology is used for automatic case generation based on prompt learning. The large generative language model can be trained using Fine Tunning, Few-Shot Learning, Prompt tuning and other learning methods, which will not be described in detail in the embodiments of the present application. These learning methods can cultivate the large generative language model to fully understand the knowledge in the relevant field and better cope with various test situations and test types.

[0098] By innovatively applying the large generative language model, the large generative language model trained by Fine Tunning, Few-Shot Learning, Prompt tuning and other learning methods can understand the requirement elements and generate related test cases according to the prompt requirements. The generated test cases are automatically parsed and rendered by one key, breaking the scene limit, having high universality, directly reaching the fundamental needs of test personnel, and having important practical value and broad application prospect.

[0099] Please refer to Figure 9 , which shows a system architecture diagram for implementing the test case generation method in the embodiments of the present application. The system architecture diagram includes, from top to bottom, an access layer, a function support layer, an application layer, an LLM layer and a middleware.

[0100] The access layer includes some open interfaces, a test case management platform and a requirement platform. Users can use the test case management platform to generate and visually manage test cases, use the requirement platform to visually manage requirements and import requirement data to the test case management platform, conveniently realize test case generation, and allow third parties to access and use the test case generation service of the embodiments of the present application.

[0101] The function support layer supports automatic generation of test cases for two types of tests, namely behavior-driven type (BDD) and manual test type. It supports rendering in table form and mind map form for the two types of tests, fully implements the concept of saving user time and reduces the user's manual conversion cost of test cases. The function support layer realizes automatic generation of test cases for extended test case boundaries and abnormal scenarios. Taking the extended test case boundary as an example, related prompt information can be generated, which can be exemplarily expressed as follows:

[0102] scenario: user switches the playing speed during the video playing process

[0103] given: user has successfully uploaded a video file and opened the playing window

[0104] when: user switches the playing speed during the video playing process

[0105] then: the video is played according to the new speed

[0106] Taking the construction of an abnormal scenario as an example, relevant prompt information can be generated, which can be exemplarily expressed as follows:

[0107] scenario: user plays a video under unstable network condition

[0108] given: user has successfully uploaded a video file and opened the playing window

[0109] when: user clicks the playing button under unstable network condition

[0110] then: prompt user that the network is unstable and playing fails

[0111] These prompt information for expanding the boundary of test cases and abnormal scenarios are recorded in the knowledge base and are incrementally and dynamically deposited in the knowledge base, so that the generality and professionalism of the test case generation method in the embodiments of the present application are better and better.

[0112] The application layer includes various learning strategies for training large generative language models, which have been described above, and the purpose is to enable the large generative language model to fully understand the input and stable output results. Multi-round Prompt guides the large generative language model to perfect the test case of the output in the form of dialogue with the large generative language model, and dynamic Prompt is constantly updated according to actual needs to fully adapt to the needs of the actual test case generation scene. FineTunning is mainly to align the large generative language model, so that the large generative language model can have more stable input and output. History data memory mainly allows users to find previous requirement documents at any time, and supports any requirement of the large generative language model to supplement the test case of a specific field. Data processing chain is mainly to improve the stability of the generated test case, and the output of the large generative language model is parsed into the test case corresponding to the test type through the data processing chain, which can also improve the stability of the test case.

[0113] The LLM layer is essentially a model factory. As described above, the first prompt and the standard requirement document are input into the large generative language model to obtain test cases. This includes calling a model interface based on the prompt template and the standard requirement document, so that the large generative language model called by the model interface receives the prompt template and the standard requirement document. The model interface is an interface of the model factory, and the model factory encapsulates at least two large generative language models.

[0114] Each large generative language model is constantly iterating and evolving, and different large generative language models are constantly chasing each other and updating at an extremely fast speed. Therefore, the embodiments of the present application do not use a single large generative language model, but design a model factory that can support the use of multiple large generative language models in the generation environment and can easily replace the large generative language model with one key. The model factory encapsulates deployment reasoning and other underlying capabilities, and the upper application scenario of generating test cases is decoupled from the large generative language model through encapsulation. Of course, the embodiments of the present application do not limit specific large generative language models.

[0115] The middleware introduces Kafka for queuing related test case generation tasks, which can ensure the stability of the system and the orderliness of the generated test cases; MySQL is used to store related conversation content to support various historical data memory application layer capabilities. Kafka is an open source stream processing platform, which is mainly used to build real-time data pipelines and stream processing applications, has high performance, scalability and fault tolerance, can process large-scale data streams, and provides functions such as persistent storage, data replication and stream data processing. MySQL is a relational database.

[0116] The test case generation scheme based on the foregoing system can achieve the following technical effects:

[0117] First, improve the efficiency of test case writing and the quality of test cases: by automatically generating structured test cases, the efficiency of writing test cases can be significantly improved, saving time. According to the actual use effect, 10%-70% of time can be saved. This will help shorten the software development cycle and improve overall research and development efficiency. Test cases generated based on large generative language models have high accuracy and usability.

[0118] Second, reduce the professional skill requirements of testers: using large generative language models to automatically generate test cases reduces the dependence on professional knowledge and skills required by testers. Testers only need to select appropriate inputs according to the requirement document to automatically generate corresponding test cases. This will reduce the training cost and threshold of testers.

[0119] Third, support diversified test types and scenarios: support compatible multiple test types such as BDD test type, manual test type, and multiple output forms such as table, mind map, etc. In addition, it also supports generating extended test case boundaries, abnormal scenarios and other types of test cases to meet the testing needs of different scenarios.

[0120] Fourth, improve test case management and collaboration efficiency: can be easily integrated into test case management platform, requirement management platform and other systems, realize one-key generation and one-key display of test case function. Improve the management and collaboration efficiency of test case, and further improve the overall efficiency of software development process.

[0121] Fifth, strong extension capability: adopt model factory mode, support encapsulation and use of multiple large generative language models. This makes the system have strong extension capability, which can adapt to the changing technical environment and business needs.

[0122] The following is an embodiment of the device of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0123] Please refer to Figure 10 , which shows the block diagram of the test case generation device provided by an embodiment of the present application. The device has the function of realizing the above-mentioned test case generation method. The above-mentioned function can be realized by hardware, or the corresponding software can be executed by hardware. The device can be a computer device, or can be set in a computer device. The device can include:

[0124] The display module 901 is configured to display a first control and a second control on a target interface. The first control is configured to input requirement data, and the second control is configured to trigger the generation of test cases.

[0125] The test case generation module 902 is configured to, in a case where the first control is triggered, obtain target requirement data; in a case where the second control is triggered, sequentially perform requirement element extraction and code-based text processing on the target requirement data to obtain a standard requirement document; parse the standard requirement document to obtain a tested function element and a test type element; determine a first prompt information, the first prompt information being matched with the test type element, and the first prompt information being used to indicate that a large generative language model outputs test cases for testing the tested function element in a test mode indicated by the test type element; and input the first prompt information and the standard requirement document into the large generative language model to obtain test cases.

[0126] The display module 901 is further configured to render the test cases in the target interface in a rendering mode corresponding to the test type element.

[0127] In an embodiment, the test case generation module 902 is configured to perform the following operations:

[0128] inputting the first prompt information and the standard requirement document into the large generative language model to obtain a first output text;

[0129] in a case where the first output text includes a test case prompt, extracting an initial case from the first output text based on the test case prompt;

[0130] in a case where the initial case fails the integrity check, determining a missing case element of the initial case;

[0131] generating a second prompt information based on the missing case element, the second prompt information being used to instruct the large generative language model to continue outputting the missing case element of the initial case;

[0132] inputting the second prompt information and the initial case into the large generative language model to obtain a second output text;

[0133] generating the test case based on the second output text and the initial case.

[0134] In an embodiment, the display module 901 is configured to perform the following operations:

[0135] extracting case elements from the test case to obtain a plurality of case elements, the plurality of case elements including a test case name, a precondition, an operation step, and an expected result;

[0136] in a case where the test type element indicates a manual test type, generating a textual data record based on the plurality of case elements, and rendering the textual data record in a text form;

[0137] in a case where the test type element indicates a behavior-driven type, performing node processing on each of the case elements to generate a tree-shaped data record corresponding to the test case, and rendering the tree-shaped data record in a mind map form.

[0138] In an embodiment, the test case generation module 902 is configured to perform the following operations:

[0139] in a case where the test type element indicates a manual test type, in response to an editing operation on the textual data record, modifying the textual data record, and storing the modified textual data record;

[0140] In a case where the test type element indicates a behavior-driven type, the tree-shaped data record is modified in response to an editing operation on a node of the tree-shaped data record, and the modified tree-shaped data record is stored.

[0141] In an embodiment, the test case generation module 902 is configured to perform the following operation:

[0142] In a case where the test type element indicates a manual test type, the first prompt information is generated in the form of a scenario description.

[0143] In a case where the test type element indicates a behavior-driven type, the first prompt information is generated in the form of a behavior chain.

[0144] In an embodiment, the test case generation module 902 is configured to perform the following operation:

[0145] The third control is displayed on the target interface, and the third control is used to trigger knowledge base-based test case generation. The knowledge base includes at least one of the following: a scenario test case prompt library, a behavior test case prompt library, a test function prompt library, and a concept library. The scenario test case prompt library is used to store prompt information associated with a test scenario. The behavior test case prompt library is used to store prompt information associated with an account behavior. The test function prompt library is used to store prompt information associated with a test function. The concept library is used to store background technical knowledge.

[0146] The prompt information or the background technical knowledge associated with the to-be-tested function element is extracted from the knowledge base.

[0147] Based on the extraction result, the first prompt information matching the test type element is generated.

[0148] In an embodiment, the test case generation module 902 is configured to perform the following operation:

[0149] In a case where there is an associated test case in the test case library that has a high degree of association with the to-be-tested function element higher than a preset threshold, the first prompt information matching the test type element is generated based on the associated test case, the to-be-tested function element, and the extraction result.

[0150] The first prompt information is used to instruct the large generative language model to output other test cases for testing the to-be-tested function element in the test mode indicated by the test type element, except for the associated test case.

[0151] In an embodiment, the test case generation module 902 is configured to perform the following operation:

[0152] Based on the prompt template and the standard requirement document, a model interface is called to enable a large generative language model called by the model interface to receive the prompt template and the standard requirement document.

[0153] The model interface is an interface of a model factory, and the model factory encapsulates at least two large generative language models.

[0154] It should be noted that the apparatus provided in the above embodiments is only used as an example to divide the above functional modules in realizing the functions thereof, and in actual applications, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above-described functions. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process is detailed in the method embodiments, which will not be described here.

[0155] Please refer to ​ which shows a structural block diagram of a computer device provided in an embodiment of the present application, which is used to execute the test case generation method described above, and the computer device can be a server. Specifically:

[0156] The computer device 1000 includes a central processing unit (CPU) 1001, a system memory 1004 including a random access memory (RAM) 1002 and a read-only memory (ROM) 1003, and a system bus 1005 connecting the system memory 1004 and the central processing unit 1001. The computer device 1000 also includes a basic input / output system (I / O) 1006 that helps transfer information between various devices in the computer, and a mass storage device 1007 for storing an operating system 1013, application programs 1014, and other program modules 1015.

[0157] The basic input / output system 1006 includes a display 1008 for displaying information and an input device 1009 such as a mouse, keyboard, etc. for user input. The display 1008 and the input device 1009 are both connected to the central processing unit 1001 through the input / output controller 1010 connected to the system bus 1005. The basic input / output system 1006 can also include an input / output controller 1010 for receiving and processing input from a keyboard, mouse, or electronic stylus, and other devices. Similarly, the input / output controller 1010 also provides output to the display screen, printer, or other types of output devices.

[0158] The mass storage device 1007 is connected to the central processing unit 1001 through a mass storage controller (not shown) connected to the system bus 1005. The mass storage device 1007 and its associated computer readable media provide nonvolatile storage for the computer device 1000. That is, the mass storage device 1007 can include a computer readable medium (not shown) such as a hard drive or a CD-ROM drive.

[0159] Without loss of generality, computer readable media can include computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM (Erasable Programmable Read Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), flash memory or other solid state memory technology, CD-ROM, digital video disc (DVD), or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Computer storage media would not, however, include communication media including wired or wireless signaling media that communicate program code in a modulated data signal. The system memory 1004 and mass storage device 1007 described above can be embodied as a memory.

[0160] According to various embodiments of the present application, the computer device 1000 can also operate in a networking environment using a network 1012 to connect to the remote computer(s). The computer device 1000 can connect to the network 1012 through a network interface unit 1011 connected to the system bus 1005. It should be appreciated that the network interface unit 1011 can also be utilized to connect the computer device 1000 to other types of networks and remote computer systems (not shown).

[0161] The above-described memory also includes a computer program that is stored in the memory and configured to be executed by one or more processors to implement the above-described test case generation method.

[0162] In an example embodiment, there is also provided a computer readable storage medium having stored therein at least one instruction, at least one program, a set of codes or an instruction set, which, when executed by a processor, implement the above-described test case generation method.

[0163] Specifically, the test case generation method comprises:

[0164] displaying a first control and a second control on a target interface, the first control being used for transmitting incoming requirement data, and the second control being used for triggering generation of a test case;

[0165] in a case where the first control is triggered, obtaining target requirement data;

[0166] in a case where the second control is triggered, sequentially performing requirement element extraction and code-based text processing on the target requirement data to obtain a standard requirement document;

[0167] parsing the standard requirement document to obtain a tested function element and a test type element;

[0168] determining first prompt information, the first prompt information being matched with the test type element, and the first prompt information being used for instructing a large generative language model to output a test case for testing the tested function element in a test mode indicated by the test type element;

[0169] inputting the first prompt information and the standard requirement document into the large generative language model to obtain the test case;

[0170] in the target interface, rendering the test case in a manner corresponding to the test type element.

[0171] In one embodiment, the inputting of the first prompt information and the standard requirement document into the large generative language model to obtain the test case comprises:

[0172] inputting the first prompt information and the standard requirement document into the large generative language model to obtain first output text;

[0173] in a case where the first output text includes a test case prompt, extracting an initial case from the first output text based on the test case prompt;

[0174] in a case where the initial case fails an integrity check, determining a missing case element of the initial case;

[0175] generating second prompt information based on the missing case element, the second prompt information being used for instructing the large generative language model to continue outputting the missing case element of the initial case;

[0176] inputting the second prompt information and the initial case into the large generative language model to obtain second output text;

[0177] Based on the second output text and the initial use case, the test case is generated.

[0178] In one embodiment, rendering the test case in a rendering manner corresponding to the test type element includes:

[0179] Extracting use case elements from the test case to obtain multiple use case elements, where the multiple use case elements include a test case name, preconditions, operation steps, and expected results;

[0180] In a case where the test type element indicates a manual test type, generating a textual data record based on the multiple use case elements, and rendering the textual data record in a text form;

[0181] In the case where the test type element indicates a behavior-driven type, each of the use case elements is node-processed to generate a tree data record corresponding to the test case, and the tree data record is rendered in the form of a mind map.

[0182] In one embodiment, the above method further comprises:

[0183] In a case where the test type element indicates a manual test type, in response to an editing operation on the textual data record, modifying the textual data record and storing the modified textual data record;

[0184] In a case where the test type element indicates a behavior-driven type, in response to an editing operation on a node of the tree data record, the tree data record is modified and the modified tree data record is stored.

[0185] In one embodiment, determining the first prompt information includes:

[0186] In the case where the test type element indicates a manual test type, generating the first prompt information in the form of a scenario description;

[0187] In the case where the test type element indicates a behavior-driven type, the first prompt information is generated in the form of a behavior link.

[0188] In one embodiment, determining the first prompt information includes:

[0189] The third control is used to trigger the generation of a use case based on a knowledge base, and the knowledge base includes at least one of the following: a scene use case prompt library, a behavior use case prompt library, a test function prompt library, and a concept library; the scene use case prompt library is used to store prompt information associated with a test scene; the behavior use case prompt library is used to store prompt information associated with an account behavior; the test function prompt library is used to store prompt information associated with a test function; and the concept library is used to store background technical knowledge.

[0190] The prompt information or the background technical knowledge associated with the to-be-tested function element is extracted from the knowledge base.

[0191] Based on the extraction result, the first prompt information matching the test type element is generated.

[0192] In an embodiment, the knowledge base further includes a test case library, and the determination of the first prompt information further includes:

[0193] In a case where there is an associated test case in the test case library that is associated with the to-be-tested function element and has an association degree higher than a preset threshold, the first prompt information matching the test type element is generated based on the associated test case, the to-be-tested function element, and the extraction result,

[0194] The first prompt information is used to instruct a large generative language model to output a test case for testing the to-be-tested function element in the test mode indicated by the test type element, except for the associated test case.

[0195] In an embodiment, the inputting of the first prompt information and the standard requirement document into the large generative language model to obtain a test case includes:

[0196] The model interface is called based on the prompt template and the standard requirement document, so that the large generative language model called by the model interface receives the prompt template and the standard requirement document.

[0197] The model interface is an interface of a model factory, and the model factory encapsulates at least two large generative language models.

[0198] Optionally, the computer-readable storage medium may include: ROM (Read Only Memory), RAM (Random Access Memory), SSD (Solid State Drives), or an optical disk, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).

[0199] In an exemplary embodiment, a computer program product or computer program is also provided. The computer program product or computer program includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the test case generation method described above.

[0200] 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 three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects 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 do not limit this.

[0201] In addition, in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0202] The above is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.

Claims

1. A test case generation method, characterized in that: The method comprises: Displaying a first control and a second control on the target interface, wherein the first control is used to input requirement data, and the second control is used to trigger the generation of a test case; When the first control is triggered, obtaining target demand data; When the second control is triggered, the target demand data is sequentially subjected to demand element extraction and coded text processing based on the demand elements to obtain a standard demand document; Parsing the standard requirement document to obtain the tested functional elements and test type elements; Determining first prompt information, where the first prompt information matches the test type element, and the first prompt information is used to instruct the large-scale generative language model to output a test case for testing the functional element under test in a test manner indicated by the test type element; Inputting the first prompt information and the standard requirement document into a large-scale generative language model to obtain a test case; In the target interface, the test case is rendered in a rendering manner corresponding to the test type element.

2. The method according to claim 1, characterized in that The step of inputting the first prompt information and the standard requirement document into a large-scale generative language model to obtain a test case includes: Inputting the first prompt information and the standard requirement document into a large-scale generative language model to obtain a first output text; In a case where the first output text includes a test case prompt, extracting an initial use case from the first output text based on the test case prompt; If the initial use case fails the completeness check, determining the use case elements missing from the initial use case; Based on the missing use case elements, generating second prompt information, wherein the second prompt information is used to instruct the large-scale generative language model to continue outputting the use case elements missing from the initial use case; Inputting the second prompt information and the initial use case into the large-scale generative language model to obtain a second output text; The test case is generated based on the second output text and the initial use case.

3. The method according to claim 1 or 2, characterized in that Rendering the test case in a rendering manner corresponding to the test type element includes: Extracting use case elements from the test case to obtain multiple use case elements, wherein the multiple use case elements include a test case name, preconditions, operation steps, and expected results; In a case where the test type element indicates a manual test type, generating a textual data record based on the multiple use case elements, and rendering the textual data record in a text form; In the case where the test type element indicates a behavior-driven type, each of the use case elements is node-processed to generate a tree data record corresponding to the test case, and the tree data record is rendered in the form of a mind map.

4. The method according to claim 3, characterized in that The method further comprises: In a case where the test type element indicates a manual test type, in response to an editing operation on the textual data record, modifying the textual data record and storing the modified textual data record; In a case where the test type element indicates a behavior-driven type, in response to an editing operation on a node of the tree data record, the tree data record is modified, and the modified tree data record is stored.

5. The method according to claim 1, wherein The determining of the first prompt information includes: In a case where the test type element indicates a manual test type, generating the first prompt information in the form of a scenario description; In a case where the test type element indicates a behavior-driven type, the first prompt information is generated in the form of a behavior link.

6. The method according to claim 1 or 5, characterized in that The determining of the first prompt information includes: Displaying a third control on the target interface, the third control is used to trigger use case generation based on a knowledge base, the knowledge base including at least one of the following: a scenario use case prompt library, a behavior use case prompt library, a test function prompt library, and a concept library; the scenario use case prompt library is used to store prompt information associated with test scenarios, the behavior use case prompt library is used to store prompt information associated with account behaviors, the test function prompt library is used to store prompt information associated with tested functions, and the concept library is used to store background technical knowledge; Extracting prompt information or background technical knowledge associated with the functional element being tested from the knowledge base; Based on the extraction result, the first prompt information matching the test type element is generated.

7. The method according to claim 6, characterized in that The knowledge base also includes a test case library, and the determining of the first prompt information further includes: If there is an associated test case in the test case library whose association with the tested functional element is higher than a preset threshold, generating the first prompt information matching the test type element according to the associated test case, the tested functional element and the extraction result, The first prompt information is used to instruct the large-scale generative language model to output other test cases excluding the associated test cases for testing the functional element under test in the test manner indicated by the test type element.

8. The method according to claim 1, characterized in that The step of inputting the first prompt information and the standard requirement document into a large-scale generative language model to obtain a test case includes: Calling a model interface based on the prompt template and the standard requirement document, so that the large generative language model called by the model interface receives the prompt template and the standard requirement document; The model interface is an interface of a model factory, and the model factory encapsulates at least two large generative language models.

9. A test case generating device, characterized in that: The device comprises: A display module is used to display a first control and a second control on the target interface, wherein the first control is used to input requirement data, and the second control is used to trigger the generation of a test case; A test case generation module is configured to obtain target requirement data when the first control is triggered; when the second control is triggered, sequentially extract requirement elements and perform coded text processing based on the requirement elements on the target requirement data to obtain a standard requirement document; parse the standard requirement document to obtain a tested functional element and a test type element; determine first prompt information, the first prompt information matching the test type element, the first prompt information being used to instruct a large-scale generative language model to output a test case for testing the tested functional element in a test manner indicated by the test type element; and input the first prompt information and the standard requirement document into the large-scale generative language model to obtain a test case. The display module is further configured to render the test case in the target interface in a rendering manner corresponding to the test type element.

10. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the test case generation method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the test case generation method according to any one of claims 1 to 8.

12. A computer program product, characterized in that The computer program product includes computer instructions. A processor of a computer device reads the computer instructions, and the processor of the computer device executes the computer instructions to implement the test case generation method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Test case generation method, electronic equipment, medium and product

    CN121547113A