Test case generation method and device, electronic equipment and storage medium
By generating automated test cases by preset large models and prompt words, the problem of inefficient generation of automated test cases in the existing technology is solved, efficient and automated test case generation is achieved, and the development and testing costs of complex systems are reduced.
Patent Information
- Application Number
- CN202510304034.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-07-18
AI Technical Summary
Generating automated test cases in the prior art requires a lot of manual intervention and repetitive work, especially in complex systems, which is inefficient and difficult to efficiently process large numbers of signals and condition combinations.
Through preset big models and prompt words, we generate requirements logical block diagrams, test cases and automated test cases. We use preset big models to automatically generate test cases based on system needs and prompt words, including automatic recognition and adjustment of event scenarios, condition signals and condition combinations.
Significantly reduce manual intervention and repetitive work, save time and manpower, improve testing efficiency, be able to efficiently process signals and conditions combinations of complex systems, and reduce development and testing costs.
Smart Images

Figure CN120336167A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of testing technologies, and more particularly, to a test case generation method, apparatus, electronic device, and storage medium. Background Art
[0002] Automated test cases can execute preset test steps, verify whether the system functions meet the requirements, and automatically generate test results. Through automated testing, it is easier to test complex scenarios or a large amount of data, ensuring that more functions and corners are covered by the test, thereby improving test efficiency and reducing repetitive labor.
[0003] In the related art, engineers extract information from requirement documents, write test cases based on these requirements, and then convert these test cases into automated test scripts through automated tools. However, writing comprehensive and effective test cases requires engineers to invest a lot of time and effort. Especially for complex systems, the number and complexity of test cases will increase, affecting the development efficiency of related functions. Summary of the Invention
[0004] The problem solved by the present invention is how to quickly and accurately generate automated test cases.
[0005] To solve the above problems, the present invention provides a test case generation method, apparatus, electronic device, and storage medium.
[0006] In a first aspect, the present invention provides a test case generation method, which is applied to a preset large model. The test case generation method includes:
[0007] Generating a first requirement logic block diagram according to system requirements and a prompt word;
[0008] Generating test cases according to the first requirement logic block diagram and the prompt word;
[0009] Generating automated test cases according to the test cases and the prompt word.
[0010] Optionally, the generating test cases according to the first requirement logic block diagram and the prompt word includes:
[0011] Determining a first event scenario and a first conditional signal corresponding to the system requirements according to the first requirement logic block diagram and the corresponding prompt word;
[0012] Determining various conditions of the first event scenario according to the first event scenario, the first conditional signal, and the corresponding prompt word;
[0013] Generating the test cases according to the first event scenario, various conditions of the first event scenario, combinations of various conditions, and the corresponding prompt word.
[0014] Optionally, after determining various conditions of the first event scenario according to the first event scenario, the first conditional signal, and the corresponding prompt words, the method further includes:
[0015] Determining combinations of various conditions according to the various conditions of the first event scenario and the corresponding prompt words, where the combinations of various conditions include top-level condition combinations, precondition combinations, trigger condition confirmations, exit condition confirmations, and execution result confirmations.
[0016] Optionally, after generating test cases according to the first requirement logic block diagram and the prompt words, the method further includes:
[0017] Determining a second requirement logic block diagram according to the test cases;
[0018] Comparing the first requirement logic block diagram with the second requirement logic block diagram. When the first requirement logic block diagram is Figure 1 identical to the second requirement logic block diagram, applying the test cases; when there are differences between the first requirement logic block diagram and the second requirement logic block diagram, adjusting each of the prompt words and regenerating the test cases.
[0019] Optionally, determining the second requirement logic block diagram according to the test cases includes:
[0020] Determining a condition hierarchy according to the test cases and the corresponding prompt words;
[0021] Determining a second event scenario and a second conditional signal according to the condition hierarchy and the corresponding prompt words;
[0022] Determining the second requirement logic block diagram according to the second event scenario, the second conditional signal, and the corresponding prompt words.
[0023] Optionally, after generating test cases according to the first requirement logic block diagram and the prompt words, the method further includes:
[0024] Clearing invalid test cases in the test cases according to a use case template and the corresponding prompt words.
[0025] Optionally, generating automated test cases according to the test cases and the prompt words includes:
[0026] Determining a first target test case where both the sending end and the receiving end of the conditional signal are the control unit under test according to the test cases, the signal matrix table corresponding to the system requirements, and the corresponding prompt words;
[0027] Determining the trigger requirements corresponding to the conditional signals in the first target test case according to the first target test case, the sending and receiving relationship table of internal signals of the system requirements, and the corresponding prompt words;
[0028] Extract the target conditions triggering the requirements, and determine from all the test cases the second target test cases whose conditional signals match the target conditions, where the target conditions include prerequisite conditions and triggering conditions;
[0029] Replace the conditional signals of the second target test cases with the corresponding target conditions to obtain the final test cases;
[0030] Generate automated test cases in the corresponding automated language according to the final test cases and the corresponding prompt words.
[0031] Optionally, the test case generation method further includes:
[0032] When the system requirements are updated and there are changes in logical requirements, generate a new first requirement logic block diagram according to the updated system requirements and the prompt words, and generate new test cases according to the new first requirement logic block diagram and the prompt words;
[0033] When the system requirements are updated and there are no changes in logical requirements, determine the requirement difference points according to the system requirements and the updated system requirements, and modify the test cases according to the requirement difference points to generate new test cases.
[0034] In a second aspect, the present invention provides a test case generation device applied to a preset large model. The test case generation device includes:
[0035] A first module for generating a first requirement logic block diagram according to system requirements and prompt words;
[0036] A second module for generating test cases according to the first requirement logic block diagram and prompt words;
[0037] A third module for generating automated test cases according to the test cases and prompt words.
[0038] In a third aspect, the present invention provides an electronic device including a memory and a processor;
[0039] The memory is used to store a computer program;
[0040] The processor is used to implement the test case generation method as described in the first aspect when executing the computer program.
[0041] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the test case generation method as described in the first aspect is implemented.
[0042] The beneficial effects of the test case generation method of the present invention are as follows: During the automated test case generation process, by presetting a large model and corresponding prompt words to generate requirement logic block diagrams, test cases, and automated test cases, it can significantly reduce manual intervention and repetitive work, save a large amount of time and manpower, avoid the inefficiency problem of requiring a large amount of manual adjustment of test cases due to requirement changes in the traditional test process, be able to efficiently handle scenarios involving a large number of signals and condition combinations, automatically identify key interaction relationships, provide efficient test coverage for complex systems, complete a large amount of test work in a shorter time, and reduce the total cost of development and testing. Description of the Drawings
[0043] Figure 1 It is a flowchart showing the test case generation method according to an embodiment of the present invention;
[0044] Figure 2 It is a flowchart showing the process of generating test cases according to an embodiment of the present invention Figure 1 ;
[0045] Figure 3 It is a flowchart showing the process of generating test cases according to an embodiment of the present invention Figure 2 ;
[0046] Figure 4 It is a flowchart showing the process of generating test cases according to an embodiment of the present invention Figure 3 ;
[0047] Figure 5 It is a flowchart showing the process of generating automated test cases according to an embodiment of the present invention Figure 1 ;
[0048] Figure 6 It is a flowchart showing the process of generating automated test cases according to an embodiment of the present invention Figure 2 ;
[0049] Figure 7 It is a flowchart showing the test case generation method according to an embodiment of the present invention;
[0050] Figure 8 It is a flowchart showing the process of requirement iterative update according to an embodiment of the present invention;
[0051] Figure 9 It is a system architecture diagram of the test case generation device according to an embodiment of the present invention;
[0052] Figure 10 It is a system architecture diagram of the electronic device according to an embodiment of the present invention. Detailed Embodiments
[0053] To make the above objects, features, and advantages of the present invention more apparent and understandable, the following provides a detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings. Although some embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments described herein. Instead, these embodiments are provided to more thoroughly and completely understand the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not used to limit the protection scope of the present invention.
[0054] It should be understood that the various steps recorded in the method embodiments of the present invention can be executed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this regard.
[0055] The term "including" and its variants used herein are open-ended, that is, "including but not limited to"; the term "based on" is "at least partially based on"; the term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments"; the term "optionally" means "optional embodiments". The relevant definitions of other terms will be given in the following description. It should be noted that the concepts such as "first" and "second" mentioned in the present invention are only used to distinguish different devices, modules, or units, and are not used to limit the order of functions performed by these devices, modules, or units or their interdependent relationships.
[0056] It should be noted that the modifications of "one" and "multiple" mentioned in the present invention are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly specified in the context, it should be understood as "one or more".
[0057] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only for illustrative purposes and are not used to limit the scope of these messages or information.
[0058] As Figure 1 shown, a test case generation method provided by an embodiment of the present invention is applied to a preset large model (such as the Star X large model, etc.). The test case generation method includes:
[0059] S100: Generate a first requirement logic block diagram according to system requirements and prompt words.
[0060] Specifically, the system requirements refer to the requirements for implementing the ECU software function, combined with Figure 7As shown, input the system requirements, the signal matrix table (the signal sending and receiving relationships and signal sending times between each ECU), the signal sending and receiving relationship table in the system requirements, etc. into the preset large model. By using Prompt 1, the rules and boundaries in the output document of the preset large model can be limited, so that a logical block diagram A of a single requirement, that is, the first requirement logical block diagram, can be generated according to the system requirements and the prompt words.
[0061] Among them, for Prompt 1 for generating the first requirement logical block diagram, it can be: (1) Role: You are a requirements analysis expert; (2) Task: Please help me output the relationships between business logics according to the procedure I formulated and generate a logical block diagram; (3) Goal: Generate a logical block diagram. Other prompt words can be set according to specific situations.
[0062] S200: Generate test cases according to the first requirement logical block diagram and the prompt words.
[0063] Specifically, in combination with Figure 7 As shown, input the requirement logical block diagram A into the preset large model, and output according to the rules and boundaries formulated by Prompt 2 to Prompt 9 in sequence, so as to generate test cases.
[0064] S300: Generate automated test cases according to the test cases and the prompt words.
[0065] Specifically, after completing the confirmation of all conditions and the correction of test cases, the preset large model can output the final automated test cases according to the selected automated language.
[0066] In this embodiment, during the generation process of automated test cases, by using the preset large model and corresponding prompt words to generate requirement logical block diagrams, test cases and automated test cases, it can greatly reduce manual intervention and repetitive work, save a large amount of time and manpower, avoid the inefficient problem of requiring a large amount of manual adjustment of test cases due to requirement changes in the traditional test process, be able to efficiently handle scenarios involving a large number of signals and condition combinations, automatically identify key interaction relationships, provide high - efficiency test coverage for complex systems, complete a large amount of test work in a shorter time, and reduce the total cost of development and testing.
[0067] Optionally, the generating test cases according to the first requirement logical block diagram and the prompt words includes:
[0068] S210: Determine the first event scenario and the first conditional signal corresponding to the system requirements according to the first requirement logical block diagram and the corresponding prompt words.
[0069] Specifically, in combination with Figure 2 and Figure 7As shown, the requirement logic block diagram A is input into a preset large model. The preset large model outputs all the event scenarios (i.e., the first event scenarios) of the requirement and sorts out all the conditional signals (i.e., the first conditional signals) according to the rules and boundaries formulated by prompt 2.
[0070] S220: Determine various conditions of the first event scenario according to the first event scenario, the first conditional signal, and the corresponding prompt.
[0071] Specifically, in combination with Figure 2 and Figure 7 As shown, the first event scenario and the first conditional signal are input into a preset large model. The preset large model outputs various conditions of the first event scenario according to the rules and boundaries formulated by prompt 3.
[0072] S230: Generate the test cases according to the first event scenario, various conditions of the first event scenario, combinations of various conditions, and the corresponding prompt.
[0073] Specifically, in combination with Figure 2 and Figure 7 As shown, the first event scenario, various conditions of the first event scenario, and combinations of various conditions are input into a preset large model. The preset large model outputs test cases according to the rules and boundaries formulated by prompts 4 to 9.
[0074] In this optional embodiment, determining the event scenario and conditional signal corresponding to the system requirement according to the requirement logic block diagram and the prompt can clearly understand each key point in the requirement, avoid human understanding deviation, and then analyze various conditions of the event scenario according to the event scenario, conditional signal, and prompt, which helps to systematically identify and sort out all relevant conditions, avoid missing some small but important conditions when manually sorting out the scenario, and finally generate test cases according to various conditions of the event scenario to ensure that the test cases can cover every corner of the system requirement and avoid missing some boundary scenarios.
[0075] Optionally, after determining various conditions of the first event scenario according to the first event scenario, the first conditional signal, and the corresponding prompt, it further includes:
[0076] Determine combinations of various conditions according to various conditions of the first event scenario and the corresponding prompt. The combinations of various conditions include top-level condition combinations, precondition combinations, trigger condition confirmations, exit condition confirmations, and execution result confirmations.
[0077] Specifically, in combination with Figure 7As shown, various conditions of the first event scenario are input into a preset large model. The preset large model outputs a top-level condition combination according to the rules and boundaries formulated by prompt 4; the preset large model outputs a precondition combination according to the rules and boundaries formulated by prompt 5; the preset large model outputs a trigger condition confirmation according to the rules and boundaries formulated by prompt 6; the preset large model outputs an exit condition confirmation according to the rules and boundaries formulated by prompt 7; the preset large model outputs an execution result confirmation according to the rules and boundaries formulated by prompt 8.
[0078] In this optional embodiment, classifying conditions into different categories such as top-level conditions, preconditions, trigger conditions, exit conditions, and execution results helps to construct a systematic test framework, ensuring that each condition combination can be reflected in test cases, thereby enhancing the comprehensiveness of test cases.
[0079] Optionally, after generating test cases according to the first requirement logic block diagram and prompts, it further includes:
[0080] S240: Determine a second requirement logic block diagram according to the test cases.
[0081] Specifically, as shown in Figure 3 and Figure 7 , the test cases are input into a preset large model. The preset large model outputs the level of the requirement condition signal according to the rules and boundaries formulated by prompt 11. The level of the requirement condition signal is input into the preset large model. The preset large model outputs all the event scenarios of the requirement and sorts out all the condition signals according to the rules and boundaries formulated by prompt 12. The event scenarios and condition signals are input into the preset large model. The preset large model outputs the logic block diagram B of the requirement, that is, the second requirement logic block diagram, according to the rules and boundaries formulated by prompt 13.
[0082] S250: Compare the first requirement logic block diagram with the second requirement logic block diagram. When the first requirement logic block diagram is Figure 1 consistent with the second requirement logic block diagram, apply the test cases; when there are differences between the first requirement logic block diagram and the second requirement logic block diagram, adjust each of the prompts and regenerate the test cases.
[0083] Specifically, as shown in Figure 3 and Figure 7As shown, the second requirement logic block diagram is input into a preset large model. The preset large model outputs System Requirement 1 (or System Specification 1) according to the rules and boundaries formulated by Prompt 14. The two system requirements are input into the preset large model, and the preset large model outputs the differences between the two system requirements according to the rules and boundaries formulated by Prompt 15. If there are no differences, this requirement is used. If there are differences, manual intervention is required to confirm the differences, adjust the prompt according to the differences, and generate test cases again until there are no differences.
[0084] In this alternative embodiment, by comparing the requirement logic block diagrams, it is ensured that the test cases accurately reflect the requirement intent, reducing problems caused by unclear requirement understanding or incomplete test cases.
[0085] Optionally, determining the second requirement logic block diagram according to the test case includes:
[0086] S241: Determine the condition hierarchy according to the test case and the corresponding prompt.
[0087] Specifically, in combination with Figure 4 and Figure 7 As shown, the test case is input into the preset large model. The preset large model outputs the hierarchy of the requirement condition signals according to the rules and boundaries formulated by Prompt 11.
[0088] S242: Determine the second event scenario and the second condition signal according to the condition hierarchy and the corresponding prompt.
[0089] Specifically, in combination with Figure 4 and Figure 7 As shown, the hierarchy of the requirement condition signals is input into the preset large model. The preset large model outputs all the event scenarios of this requirement (i.e., the second event scenario) and sorts out all the condition signals (i.e., the second condition signal) according to the rules and boundaries formulated by Prompt 12.
[0090] S243: Determine the second requirement logic block diagram according to the second event scenario, the second condition signal and the corresponding prompt.
[0091] Specifically, in combination with Figure 4 and Figure 7 As shown, the second event scenario and the second condition signal are input into the preset large model. The preset large model outputs the logic block diagram B of this requirement, that is, the second requirement logic block diagram, according to the rules and boundaries formulated by Prompt 13.
[0092] In this alternative embodiment, by comparing the requirement logic block diagrams, it is ensured that the test cases accurately reflect the requirement intent, reducing problems caused by unclear requirement understanding or incomplete test cases.
[0093] Optionally, after generating test cases according to the first requirement logic block diagram and the prompt words, the following steps are further included:
[0094] Clear invalid test cases in the test cases according to the use case template and the corresponding prompt words.
[0095] Specifically, input the test cases and the use case template into a preset large model, and the preset large model outputs the final version of the test cases according to the rules and boundaries formulated by the prompt word 10.
[0096] In this optional embodiment, by clearing invalid test cases, test redundancy is reduced and the overall test efficiency is improved.
[0097] Optionally, generating automated test cases according to the test cases and the prompt words includes:
[0098] S310: Determine a first target test case in which both the sending end and the receiving end of the conditional signal are the controlled units under test according to the test cases, the signal matrix table corresponding to the system requirements, and the corresponding prompt words.
[0099] Specifically, as shown in Figure 5 , input the test cases and the signal matrix table into a preset large model, and the preset large model outputs a list in which both the sending end and the receiving end of the conditional signal in the use case are the ECUs under test according to the rules and boundaries formulated by the prompt word 16 (i.e., the first target test case).
[0100] S320: Determine the triggering requirements corresponding to the conditional signal in the first target test case according to the first target test case, the internal signal sending and receiving relationship table of the system requirements, and the corresponding prompt words.
[0101] Specifically, as shown in Figure 5 , input the list in which both the sending end and the receiving end of the conditional signal are the ECUs under test and the internal signal sending and receiving relationship table in the system requirements into a preset large model, and the preset large model finds the triggering requirements of the conditional signal according to the rules and boundaries formulated by the prompt word 17.
[0102] S330: Extract the target conditions of the triggering requirements, and determine a second target test case in which the conditional signal in all the test cases matches the target conditions, where the target conditions include a precondition and a triggering condition.
[0103] Specifically, as shown in Figure 5 , the preset large model extracts the precondition and the triggering condition in the triggering requirements, and finally outputs a list in which the precondition and the triggering condition in the triggering requirements are equal to the conditional signal in the use case (i.e., the second target test case).
[0104] S340: Replace the conditional signal of the second target test case with the corresponding target condition to obtain the final test case.
[0105] Specifically, as shown in Figure 5 , the preset large model replaces the conditional signal in the test case with the corresponding prerequisite condition and trigger condition according to the rules and boundaries formulated based on prompt 18 to obtain the final test case.
[0106] S350: Generate an automated test case in the corresponding automated language according to the final test case and the corresponding prompt.
[0107] Specifically, as shown in Figure 5 , input the final test case into the preset large model. The preset large model selects the test cases in the corresponding automated language (such as capl, python, etc.) to be generated according to the rules and boundaries formulated based on prompt 19, and outputs the automated test case.
[0108] In this optional embodiment, generating automated test cases through the preset large model can complete a large amount of test work in a shorter time, reducing the total cost of development and testing.
[0109] Optionally, the test case generation method further includes:
[0110] S400: When the system requirements are updated and there are logical requirement changes, generate a new first requirement logic block diagram according to the updated system requirements and the prompt, and generate new test cases according to the new first requirement logic block diagram and the prompt.
[0111] Specifically, as shown in Figure 6 and Figure 8 , when the system requirements are updated, input the old version of the system requirements (referring to the system requirements before the update), the new version of the system requirements (referring to the system requirements after the update), the old version of the original signal matrix table, the new version of the original signal matrix table, the signal sending and receiving relationship table in the old version of the system requirements, the signal sending and receiving relationship table in the new version of the system requirements, and the test cases of the old version of the requirements into the preset large model. The preset large model outputs a requirement change list according to the rules and boundaries formulated based on prompt A, and then compares the new version of the requirements with the old version of the requirements according to the rules and boundaries formulated based on prompt B. If there are requirements with logical changes, regenerate the test cases according to steps S100 to S300.
[0112] S500: When the system requirements are updated and there are no logical requirement changes, determine the requirement difference points according to the system requirements and the updated system requirements, and modify the test cases according to the requirement difference points to generate new test cases.
[0113] Specifically, as shown inFigure 6 and Figure 8 As shown in Figure 8 , when the system requirements are updated and there is no change in the logical requirements, the requirement difference points are determined based on the system requirements and the updated system requirements, and the requirement difference points are input into a preset large model. The preset large model modifies the original test cases according to the rules and boundaries formulated by the prompt word C based on the requirement difference points, outputs new test cases, and then executes steps S310 to S350, thereby generating automated test cases.
[0114] In this optional embodiment, after the requirements are updated, adjusting and generating new test cases in a timely manner can ensure that the test cases reflect the current latest requirements, improve the test efficiency, ensure that the requirements are fully verified, avoid omissions and regression problems, and reduce manual intervention.
[0115] As Figure 9 shown, a test case generation device 900 provided by an embodiment of the present invention is applied to a preset large model, and the test case generation device includes:
[0116] A first module 910, configured to generate a first requirement logic block diagram according to system requirements and a prompt word;
[0117] A second module 920, configured to generate test cases according to the first requirement logic block diagram and the prompt word;
[0118] A third module 930, configured to generate automated test cases according to the test cases and the prompt word.
[0119] As Figure 10 shown, an electronic device 1000 provided by an embodiment of the present invention includes a memory 1020 and a processor 1010; the memory 1020 is used to store a computer program; the processor 1010 is used to implement the test case generation method as described above when executing the computer program.
[0120] Or, an electronic device 1000 includes a memory 1020 and a processor 1010 coupled to the memory 1020; the memory 1020 is configured to store a computer program; the processor 1010 is configured to perform the following operations when executing the computer program:
[0121] Generate a first requirement logic block diagram according to system requirements and a prompt word;
[0122] Generate test cases according to the first requirement logic block diagram and the prompt word;
[0123] Generate automated test cases according to the test cases and the prompt word.
[0124] A computer-readable storage medium provided by an embodiment of the present invention, on which a computer program is stored. When the computer program is executed by a processor, the test case generation method described above is implemented.
[0125] Alternatively, a non-volatile computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor performs the following operations:
[0126] Generate a first requirement logic block diagram according to system requirements and prompt words;
[0127] Generate test cases according to the first requirement logic block diagram and prompt words;
[0128] Generate automated test cases according to the test cases and prompt words.
[0129] Now, an electronic device 1000 that can be a server or a client of the present invention will be described. It is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device 1000 is intended to represent various forms of digital electronic computer devices, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device 1000 can also represent various forms of mobile devices, such as, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0130] The electronic device 1000 includes a computing unit, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) or a computer program loaded from a storage unit into a random access memory (RAM). In the RAM, various programs and data required for device operation can also be stored. The computing unit, the ROM, and the RAM are connected to each other via a bus. The input / output (I / O) interface is also connected to the bus.
[0131] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc. In this application, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiments of the present invention. In addition, the functional units in each embodiment of the present invention can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0132] Although the present invention is disclosed as above, the scope of protection of the present invention is not limited thereto. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, and these changes and modifications will all fall within the scope of protection of the present invention.
Claims
1. A test case generation method, characterized in that, Applied to a preset large model, the test case generation method includes: Generating a first requirement logic block diagram according to system requirements and prompt words; Generating test cases according to the first requirement logic block diagram and prompt words; Generating automated test cases according to the test cases and prompt words.
2. The test case generation method according to claim 1, wherein The generating test cases according to the first requirement logic block diagram and prompt words includes: Determining a first event scenario and a first conditional signal corresponding to the system requirements according to the first requirement logic block diagram and the corresponding prompt words; Determining various conditions of the first event scenario according to the first event scenario, the first conditional signal, and the corresponding prompt words; Generating the test cases according to the first event scenario, various conditions of the first event scenario, combinations of various conditions, and the corresponding prompt words.
3. The test case generation method according to claim 2, wherein After determining various conditions of the first event scenario according to the first event scenario, the first conditional signal, and the corresponding prompt words, it further includes: Determining combinations of various conditions according to various conditions of the first event scenario and the corresponding prompt words, where the combinations of various conditions include top-level condition combinations, precondition combinations, trigger condition confirmations, exit condition confirmations, and execution result confirmations.
4. The test case generation method according to claim 2, wherein After generating the test cases according to the first requirement logic block diagram and prompt words, it further includes: Determining a second requirement logic block diagram according to the test cases; Comparing the first requirement logic block diagram with the second requirement logic block diagram. When the first requirement logic block diagram is consistent with the second requirement logic block diagram, applying the test cases; when there are differences between the first requirement logic block diagram and the second requirement logic block diagram, adjusting each of the prompt words and regenerating the test cases.
5. The test case generation method according to claim 4, wherein The determining a second requirement logic block diagram according to the test cases includes: Determining a condition hierarchy according to the test cases and the corresponding prompt words; Determining a second event scenario and a second conditional signal according to the condition hierarchy and the corresponding prompt words; Determining the second requirement logic block diagram according to the second event scenario, the second conditional signal, and the corresponding prompt words.
6. The test case generation method according to claim 2, wherein After generating the test cases according to the first requirement logic block diagram and prompt words, it further includes: Clearing invalid test cases in the test cases according to a use case template and the corresponding prompt words.
7. The test case generation method according to claim 2, wherein The generating automated test cases according to the test cases and prompt words includes: Determining a first target test case where both the sending end and the receiving end of the conditional signal are the DUT control unit according to the test cases, the signal matrix table corresponding to the system requirements, and the corresponding prompt words; Determining the trigger requirements corresponding to the conditional signals in the first target test case according to the first target test case, the internal signal sending and receiving relationship table of the system requirements, and the corresponding prompt words; Extracting the target conditions of the trigger requirements and determining a second target test case where the conditional signal matches the target conditions from all the test cases, where the target conditions include preconditions and trigger conditions; Replacing the conditional signals in the second target test case with the corresponding target conditions to obtain the final test cases; Generate automated test cases in the corresponding automated language according to the final test cases and the corresponding prompt words.
8. The test case generation method according to any one of claims 1 to 7, characterized in that It further includes: When the system requirements are updated and there are changes in logical requirements, generate a new first requirement logic block diagram according to the updated system requirements and prompt words, and generate new test cases according to the new first requirement logic block diagram and prompt words; When the system requirements are updated and there are no changes in logical requirements, determine the requirement difference points according to the system requirements and the updated system requirements, and modify the test cases according to the requirement difference points to generate new test cases.
9. A test case generation device, characterized in that, Applied to a preset large model, the test case generation device includes: A first module for generating a first requirement logic block diagram according to system requirements and prompt words; A second module for generating test cases according to the first requirement logic block diagram and prompt words; A third module for generating automated test cases according to the test cases and prompt words.
10. An electronic device, characterized in that, It includes a memory and a processor; The memory is used to store computer programs; The processor is used to implement the test case generation method according to any one of claims 1 to 8 when executing the computer program.
11. A computer-readable storage medium, characterized in that, A computer program is stored on the storage medium, and when the computer program is executed by the processor, the test case generation method according to any one of claims 1 to 8 is implemented.