Method, device and equipment for automatically generating test case and computer readable medium

By automatically generating test cases, using a large model to automatically generate test cases based on test case templates and engineering background information, solving the problem of low efficiency in manual writing test cases and improving simulation testing efficiency.

CN119167647AInactive Publication Date: 2024-12-20BEIJING GLOBAL CROWN JINYANG TECH DEV CO LTD

Patent Information

Application Number
CN202411325918.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-23
Publication Date
2024-12-20
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When using automated testing tools for simulation tests, users need to manually write a large number of test cases, resulting in low writing efficiency and low simulation testing efficiency.

Method used

Provides a method to automatically generate test cases. By obtaining test case templates, target engineering background information and target scenario description information, input them into a large model, analyzing the output data to automatically generate test cases, and improving the efficiency of writing test cases.

Benefits of technology

It realizes automatic and rapid generation of multiple test cases, improves simulation testing efficiency, and reduces the tedious work of manual writing by users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119167647A_ABST
    Figure CN119167647A_ABST
Patent Text Reader

Abstract

The invention provides a method, device and equipment for automatically generating a test case and a computer readable medium, the method is applied to an automatic test tool based on a simulation test platform, and the method comprises the following steps: obtaining a test case template, target engineering background information and target scene description information; inputting the test case template, the target engineering background information and the target scene description information into the target large model to obtain target output data; and analyzing the target output data, and automatically generating a target test case. Therefore, the test cases can be directly and automatically generated by utilizing the large model according to the test case template, the engineering background information and the scene description information, and even if a large number of test cases need to be generated, a plurality of test cases can be automatically and quickly generated based on the test case template and the large model; the efficiency of compiling the test case is improved, and finally the simulation test efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a method, device, equipment and computer-readable medium for automatically generating test cases. Background Art

[0002] At present, with the development of computer technology, simulation test platforms are also developing rapidly. The simulation test platform includes an automated test tool, which can be used to perform automatic simulation tests. The simulation test platform is, for example, GCAir, and the automated test tool is, for example, TestManager.

[0003] However, when using automated testing tools for simulation testing, users are required to manually write test cases. When the number of test cases is large, it is difficult, time-consuming, and cumbersome for users to manually write multiple test cases, resulting in low efficiency in writing test cases and ultimately low efficiency in simulation testing. Summary of the invention

[0004] In view of this, the purpose of the present application is to provide a method, apparatus, device and computer-readable medium for automatically generating test cases, which can automatically and quickly generate multiple test cases and improve the efficiency of writing test cases.

[0005] The present application provides a method for automatically generating test cases, the method being applied to an automated testing tool based on a simulation testing platform, the method comprising:

[0006] Acquire a test case template, target project background information, and target scenario description information, wherein the test case template meets the test requirements of the automated testing tool, and the target scenario description information is constructed based on the target project background information;

[0007] Input the test case template, the target project background information and the target scenario description information into the target macro model to obtain target output data;

[0008] The target output data is parsed to automatically generate target test cases.

[0009] As a possible implementation manner, the step of inputting the test case template, the target engineering background information and the target scenario description information into the target macro model to obtain target output data includes:

[0010] The test case template, the target engineering background information and the target scenario description information are input into the target big model, and the target output data is obtained according to the test case generation prompt of the target big model. The test case generation prompt is used to instruct the target big model to generate test case data that conforms to the target engineering background information and the target scenario description information according to the test case template.

[0011] As a possible implementation, the target scenario description information includes test object information, test manufacturer information and test case requirement information;

[0012] The acquisition of the test case template, target project background information and target scenario description information includes:

[0013] Acquire the test case template and target project background information uploaded by the user on the information upload page of the automated testing tool;

[0014] The test object information, test manufacturer information and test case requirement information entered by the user on the information upload page are obtained.

[0015] As a possible implementation manner, the parsing the target output data and automatically generating a target test case includes:

[0016] Parse the target output data and extract the target application data;

[0017] Automatically generate target test cases based on target application data.

[0018] As a possible implementation manner, the method further includes:

[0019] Converting the test case template, the target engineering background information and the target scenario description information into a test case template, target engineering background information and target scenario description information in a target format;

[0020] The step of inputting the test case template, the target engineering background information and the target scenario description information into the target macro model to obtain target output data comprises:

[0021] Input the test case template in the target format, the target engineering background information and the target scenario description information into the target large model to obtain the target output data.

[0022] As a possible implementation manner, the method further includes:

[0023] Verifying the target test case according to the test requirements of the automated testing tool to obtain a verification result;

[0024] If the verification result is that the verification passes, the target test case is imported into the position corresponding to the target scenario description information.

[0025] As a possible implementation manner, the method further includes:

[0026] If the verification result is that the verification fails, obtain error information during the verification process;

[0027] Inputting the error information and the target test case into the target macro model to obtain a corrected test case;

[0028] Continue to verify the modified test case according to the test requirements of the automated testing tool to obtain a verification result;

[0029] If the verification result is that the verification passes, importing the modified test case into the position corresponding to the target scenario description information;

[0030] If the verification result is a verification failure, repeatedly obtain the error information in the verification process and input the error information and the corrected test case into the target large model, and obtain the corrected test case again, until the verification result is a verification pass or the verification times threshold is reached.

[0031] The present application provides a device for automatically generating test cases, the device comprising:

[0032] An acquisition unit, used to acquire a test case template, target project background information and target scenario description information, wherein the test case template meets the test requirements of the automated testing tool, and the target scenario description information is constructed based on the target project background information;

[0033] An input unit, used to input the test case template, the target project background information and the target scenario description information into the target macro model to obtain target output data;

[0034] A generating unit is used to parse the target output data and automatically generate target test cases.

[0035] The present application provides a device for automatically generating test cases, the device comprising: a processor and a memory;

[0036] The memory is used to store instructions;

[0037] The processor is used to execute the instructions in the memory to perform the method according to any one of claims 1 to 7.

[0038] The present application provides a computer-readable medium, characterized in that it includes instructions, which, when executed on a computer, enable the computer to execute the method described above.

[0039] The present application provides a method for automatically generating test cases, which is applied to an automated testing tool based on a simulation test platform, and the method includes: obtaining a test case template, target engineering background information, and target scenario description information, wherein the test case template meets the test requirements of the automated testing tool, and the target scenario description information is constructed based on the target engineering background information, that is, the target engineering background information and the target scenario description information include key information that needs to be filled in the test case template; input the test case template, the target engineering background information, and the target scenario description information into the target large model to obtain the target output data; parse the target output data, and automatically generate the target test case, that is, use the target large model to infer the template information of the test case template, infer the key information in the target engineering background information and the target scenario description information, so as to generate the target output data, and automatically generate the target test case by parsing the target output data. It can be seen from this that the present application can use the large model to directly and automatically generate test cases according to the test case template, engineering background information, and scenario description information, even if a large number of test cases need to be generated, multiple test cases can be automatically and quickly generated based on the test case template and the large model, improve the efficiency of writing test cases, and ultimately improve the efficiency of simulation testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The above and other features, advantages and aspects of the embodiments of the present application will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0041] Figure 1 A schematic diagram of a process for automatically generating test cases provided by an embodiment of the present application is shown;

[0042] Figure 2 A schematic diagram of a test case template provided in an embodiment of the present application is shown;

[0043] Figure 3 A schematic diagram of an information upload page of an automated testing tool provided in an embodiment of the present application is shown;

[0044] Figure 4 A schematic diagram of a simulation test interface of an automated test tool provided in an embodiment of the present application is shown;

[0045] Figure 5A schematic diagram of a process for automatically generating test cases provided by an embodiment of the present application is shown;

[0046] Figure 6 A schematic diagram of the structure of a device for automatically generating test cases provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0047] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as being limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not intended to limit the scope of protection of the present application.

[0048] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part 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 relevant definitions of other terms will be given in the following description.

[0049] It should be noted that the concepts such as "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0050] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0051] TestManager is a supporting tool for automated testing of the simulation test platform GCAir. It can realize automated batch simulation testing based on requirements. Import the GCAir project into TestManager, write test cases on TestManager according to the test requirements, run the simulation to complete the automated batch testing, and generate a test report.

[0052] Although you can write test cases step by step through the user interface (UI) on TestManager, or import written test cases, manually writing test cases can be completed quickly when the number of test cases is small. However, when a test project requires a large number of test cases, manually writing each test case is a very tedious and time-consuming task.

[0053] Based on this, the present application provides a method for automatically generating test cases, which is applied to an automated testing tool based on a simulation test platform, and the method includes: obtaining a test case template, target engineering background information, and target scenario description information, wherein the test case template meets the test requirements of the automated testing tool, and the target scenario description information is constructed based on the target engineering background information, that is, the target engineering background information and the target scenario description information include key information that needs to be filled in the test case template; input the test case template, the target engineering background information, and the target scenario description information into the target large model to obtain the target output data; parse the target output data, and automatically generate the target test case, that is, use the target large model to infer the template information of the test case template, infer the key information in the target engineering background information and the target scenario description information, so as to generate the target output data, and automatically generate the target test case by parsing the target output data. It can be seen from this that the present application can use the large model to directly and automatically generate test cases according to the test case template, engineering background information, and scenario description information, even if a large number of test cases need to be generated, multiple test cases can be automatically and quickly generated based on the test case template and the large model, improve the efficiency of writing test cases, and ultimately improve the efficiency of simulation testing.

[0054] In order to better understand the technical solution and technical effects of the present application, specific embodiments will be described in detail below with reference to the accompanying drawings.

[0055] See also Figure 1 , which is a flow chart of a method for automatically generating test cases provided in an embodiment of the present application.

[0056] The method for automatically generating test cases provided in the embodiment of the present application can be applied to an automated testing tool based on a simulation testing platform, such as GCAir, and an automated testing tool such as TestManager.

[0057] The method for automatically generating test cases provided in the embodiment of the present application comprises the following steps:

[0058] S101, obtaining a test case template, target project background information and target scenario description information, wherein the test case template meets the test requirements of the automated testing tool, and the target scenario description information is constructed based on the target project background information.

[0059] In an embodiment of the present application, taking into account the need to automatically generate test cases, the test cases need to meet the test requirements of the automated testing tool. Therefore, in order to automatically generate a large number of test cases, it is necessary to provide a test case template that meets the test requirements of the automated testing tool. The test case template includes template information and key information. The key information is information that can be replaced according to the test requirements, so as to meet multiple test requirements by utilizing the template information of the test case template.

[0060] refer to Figure 2 Shown is a schematic diagram of a test case template provided in an embodiment of the present application. Figure 2 In the test case template shown in the figure, "from GCAir import", "Variable" and "#Variable starting with "REQ_" indicates passing the judgment, and a value of -1 indicates failure" are all template information, which meets the test requirements of the automated testing tool. Figure 2 The "display name", "variable type", "description information" and "default value" in the test case template shown in the figure are all key information, which needs to be provided by using the target project background information and target scenario description information.

[0061] In an embodiment of the present application, since the test case template includes key information, it is necessary to obtain the target project background information and target scenario description information that provide the key information. Among them, the target project background information is used to indicate the target project related information of the test case, such as the target project and project indicators that need to be achieved. The target scenario description information is constructed based on the target project background information, and the target scenario description information is used to indicate the test requirements based on the target project. Specifically, the target scenario description information includes test object information, test manufacturer information and test case requirement information.

[0062] As an example, the target engineering background information may be automobile engineering, the target scenario description information may be the time required for a car to accelerate from a speed of 0 to a speed of 100 m / s, the test object information may be automobile information, the test manufacturer information may not be restricted, and the test case requirement information may be the time required for a car to accelerate from a speed of 0 to a speed of 100 m / s.

[0063] In an embodiment of the present application, a test case template is used to provide template information, and target project background information and target scenario description information are used to provide key information, so as to provide template information and key information as a data basis for subsequent automatic generation of test cases.

[0064] Considering that the automated testing tool or large model requires template information and key information, the information upload page provided by the automated testing tool can be used to obtain the test case template, project background information and scenario description information. In other words, the test case template and target project background information uploaded by the user on the information upload page of the automated testing tool can be obtained, and the test object information, test manufacturer information and test case requirement information entered by the user on the information upload page can be obtained.

[0065] As an example, the test case template, target project background information and target scenario description information can be uploaded in the form of files on the information upload page. The file format can be txt, pdf, word and excel. Figure 3 As shown, Figure 3 A schematic diagram of an information upload page of an automated testing tool provided in an embodiment of the present application is shown. Figure 3 You can upload test case templates in txt format, such as readme, target project background information in word format, such as project description, and target scenario description information in excel format, such as GcKontrol_Requirement_20231023174332.

[0066] S102, input the test case template, target project background information and target scenario description information into the target large model to obtain target output data.

[0067] In an embodiment of the present application, after obtaining the test case template, target engineering background information and target scenario description information, that is, after obtaining the template information and key information, the test case template, target engineering background information and target scenario description information can be input into the target big model, thereby using the target big model to infer the template information and key information to obtain the target output data, which includes important data for generating the target test case.

[0068] Specifically, the target large model can be a large language model, that is, through the powerful semantic understanding ability of the large language model, it can infer template information from the test case template and infer key information from the target engineering background information and target scenario description information, providing data basis for the subsequent automatic generation of test cases.

[0069] In order to achieve the output of the target large model according to the test case template, the target engineering background information and the target scene description information to obtain the target output data, the target large model can be guided by the test case generation prompt, so that the target large model can infer the template information in the test case template and the key information in the target engineering background information and the target scene description information, and finally obtain the target output data. In other words, the test case generation prompt can be used to instruct the target large model to generate test case data that conforms to the target engineering background information and the target scene description information according to the test case template, and the test case generation prompt can be used to accurately guide the target large model to generate the target output data, improve the accuracy of the target output data, and thus improve the accuracy of the test cases formed subsequently.

[0070] In an embodiment of the present application, after obtaining the test case template, target engineering background information, and target scenario description information, considering that the test case template, target engineering background information, and target scenario description information may be in multiple formats, the test case template, target engineering background information, and target scenario description information can be converted into a test case template, target engineering background information, and target scenario description information in a target format, that is, the data input into the target large model is converted into a unified target format, which is a format that the target large model can recognize. By inputting the test case template, target engineering background information, and target scenario description information in the target format into the target large model, it is convenient for the target large model to perform information reasoning.

[0071] S103, parsing the target output data and automatically generating target test cases.

[0072] In an embodiment of the present application, after the target output data is obtained, the target output data has more content. In order to extract important data from the target output data, the target output data can be parsed, thereby automatically generating a target test case based on the important data obtained by the parsing.

[0073] In actual applications, the target output data includes non-important data and important data. Non-important data is time data, etc., and important data is data that can generate target test cases. Therefore, it is necessary to parse the target output data and extract the target application data, which is the important data, so as to automatically generate target test cases directly based on the target application data.

[0074] In an embodiment of the present application, after the target test case is automatically generated, the target test case can also be verified to check whether the target test case meets the test requirements of the automated testing tool. That is to say, the target test case can be verified according to the test requirements of the automated testing tool to obtain a verification result. If the verification result is that the verification passes, the target test case is imported into the location corresponding to the target scenario description information. That is, if the target test case verification passes, the target test case is automatically imported into the corresponding test requirement directory, thereby determining that the test requirement already has a corresponding target test case, and the target test case can be directly used for simulation testing later.

[0075] refer to Figure 4 , which is a schematic diagram of a simulation test interface of an automated testing tool provided in an embodiment of the present application. Figure 4 The target scenario description information is automobile acceleration performance, and the target test cases are ai_case1, ai_case9, ai_case15, ai_case16, and ai_case17, among which all the target test cases are placed under the test requirement directory automobile acceleration performance.

[0076] In an embodiment of the present application, when the verification result is that the verification fails, the target large model also outputs the error information during the verification process, the error information can be obtained, and then the error information and the target test case are re-input into the target large model, the target large model outputs the corrected output data, the corrected output data is parsed, and the corrected test case is automatically generated, and the corrected test case can be further verified according to the test requirements of the automated testing tool to obtain the verification result of whether the corrected test case meets the test requirements. If the verification result is that the verification passes, the corrected test case is imported into the position corresponding to the target scenario description information. If the verification result is that the verification fails, the error information during the verification process is repeatedly obtained and the error information and the corrected test case are input into the target large model, and the steps of obtaining the corrected test case again are performed until the verification result is that the verification passes or the verification times threshold is reached. The verification times threshold can be designed according to the actual situation, for example, the verification times threshold is 3 times.

[0077] In an embodiment of the present application, when acquiring the test case template, target project background information and target scenario description information, the number of test cases to be generated is also acquired at the same time, thereby realizing automatic generation of a large number of test cases.

[0078] In an embodiment of the present application, in addition to obtaining test case templates, target engineering background information and target scenario description information, historical test cases can also be obtained, and the test case templates, target engineering background information, target scenario description information and historical test cases are jointly input into the target big model, thereby improving the accuracy of the target output data output by the target big model, and then improving the accuracy of generating target test cases.

[0079] Specifically, historical test cases can be test cases written by users based on the target project background information and target scenario description information, based on test case templates, so as to improve the accuracy of the target output data output by the target large model through reasoning using the test cases written by users. Historical test cases can also be test cases that have been generated using the output data of the target large model, that is, test cases generated using the output data of the target large model assist in the subsequent data output of the target large model, further improving the accuracy of the target output data output by the target large model.

[0080] In actual applications, after the test cases are automatically generated, automated testing tools can be used to perform test verification based on the test cases and generate test reports.

[0081] refer to Figure 5 As shown, a flow chart of automatically generating test cases provided by an embodiment of the present application is provided. The automated testing tool TestManager can be used to automatically generate test cases. The test case template, engineering background information, scenario description information and the number of test cases generated are obtained, and the test case template, engineering background information and scenario description information are converted into the target format, and then the target format test case template, engineering background information and scenario description information target large model are used to parse the output data output by the target large model, generate test cases, and verify the test cases. If the verification passes, the test cases are directly imported to execute the test verification process. If the verification fails, the test cases and error information are re-entered into the target large model.

[0082] It can be seen that the present application can utilize the big model to directly and automatically generate test cases based on the test case template, engineering background information and scenario description information. Even if a large number of test cases need to be generated, multiple test cases can be automatically and quickly generated based on the test case template and the big model. There is no need for users to manually write multiple test cases, thereby improving the efficiency of writing test cases and ultimately improving the efficiency of simulation testing.

[0083] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0084] In some embodiments, the server can communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0085] Although operations are depicted in a particular order, this should not be understood as requiring that the operations be performed in the particular order shown or in a sequential order.Multitasking and parallel processing may be advantageous under certain circumstances.

[0086] It should be understood that the various steps described in the method implementation of the present application can be performed in different orders and / or performed in parallel. In addition, the method implementation may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.

[0087] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0088] Based on the multi-line elastic layout display method provided in the above embodiment, the embodiment of the present application further provides a multi-line elastic layout display container, and its working principle is described in detail below with reference to the accompanying drawings.

[0089] See also Figure 6 , which is a structural schematic diagram of a device for automatically generating test cases provided in an embodiment of the present application.

[0090] The embodiment of the present application provides an apparatus 600 for automatically generating test cases, including:

[0091] An acquisition unit 610 is used to acquire a test case template, target project background information, and target scenario description information, wherein the test case template meets the test requirements of the automated testing tool, and the target scenario description information is constructed based on the target project background information;

[0092] An input unit 620, used to input the test case template, the target project background information and the target scenario description information into the target macro model to obtain target output data;

[0093] The generating unit 630 is used to parse the target output data and automatically generate a target test case.

[0094] In some embodiments, the input unit 620 is used to:

[0095] The test case template, the target engineering background information and the target scenario description information are input into the target big model, and the target output data is obtained according to the test case generation prompt of the target big model. The test case generation prompt is used to instruct the target big model to generate test case data that conforms to the target engineering background information and the target scenario description information according to the test case template.

[0096] In some embodiments, the target scenario description information includes test object information, test manufacturer information, and test case requirement information;

[0097] The acquisition unit 610 is used to:

[0098] Acquire the test case template and target project background information uploaded by the user on the information upload page of the automated testing tool;

[0099] The test object information, test manufacturer information and test case requirement information entered by the user on the information upload page are obtained.

[0100] In some embodiments, the generating unit 630 is configured to:

[0101] Parse the target output data and extract the target application data;

[0102] Automatically generate target test cases based on target application data.

[0103] In some embodiments, the device further comprises a conversion unit; the conversion unit is configured to:

[0104] Converting the test case template, the target engineering background information and the target scenario description information into a test case template, target engineering background information and target scenario description information in a target format;

[0105] The step of inputting the test case template, the target engineering background information and the target scenario description information into the target macro model to obtain target output data comprises:

[0106] Input the test case template in the target format, the target engineering background information and the target scenario description information into the target large model to obtain the target output data.

[0107] In some embodiments, the device further comprises a verification unit; the verification unit is configured to:

[0108] Verifying the target test case according to the test requirements of the automated testing tool to obtain a verification result;

[0109] If the verification result is that the verification passes, the target test case is imported into the position corresponding to the target scenario description information.

[0110] In some embodiments, the apparatus further comprises a correction unit, the correction unit being configured to:

[0111] If the verification result is that the verification fails, obtain error information during the verification process;

[0112] Inputting the error information and the target test case into the target macro model to obtain a corrected test case;

[0113] Continue to verify the modified test case according to the test requirements of the automated testing tool to obtain a verification result;

[0114] If the verification result is that the verification passes, importing the modified test case into the position corresponding to the target scenario description information;

[0115] If the verification result is a verification failure, repeatedly obtain the error information in the verification process and input the error information and the corrected test case into the target large model, and obtain the corrected test case again, until the verification result is a verification pass or the verification times threshold is reached.

[0116] The units involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the unit does not constitute a limitation on the component itself in some cases.

[0117] The names of the messages or information exchanged between multiple units in the embodiments of the present application are only used for illustrative purposes, and are not used to limit the scope of these messages or information.

[0118] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0119] Based on the device method for automatically generating test cases provided in the above embodiment, the embodiment of the present application also provides a device for automatically generating test cases, and the device for automatically generating test cases includes:

[0120] The processor and the memory may be one or more processors. In some embodiments of the present application, the processor and the memory may be connected via a bus or other means.

[0121] The memory may include a read-only memory and a random access memory, and provides instructions and data to the processor. A portion of the memory may also include an NVRAM. The memory stores an operating system and operating instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic services and processing hardware-based tasks.

[0122] The processor controls the operation of the terminal device and may also be referred to as a CPU.

[0123] The method disclosed in the above embodiment of the present application can be applied to a processor or implemented by a processor. The processor can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or the hardware and software modules in the decoding processor can be combined to perform. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0124] The embodiment of the present application also provides a computer-readable medium for storing program code, where the program code is used to execute any one of the methods of the aforementioned embodiments.

[0125] In the context of the present application, a computer-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a computer-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0126] It should be noted that the computer-readable medium mentioned above in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0127] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0128] The embodiment of the present application further provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes any one of the implementation methods of the aforementioned embodiments.

[0129] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, the above-mentioned functions defined in the method of the embodiment of the present application are executed.

[0130] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

[0131] Although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present application. Certain features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination.

[0132] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.

Claims

1. A method for automatically generating test cases, characterized in that: The method is applied to an automated testing tool based on a simulation testing platform, and the method comprises: Acquire a test case template, target project background information, and target scenario description information, wherein the test case template meets the test requirements of the automated testing tool, and the target scenario description information is constructed based on the target project background information; Input the test case template, the target project background information and the target scenario description information into the target macro model to obtain target output data; The target output data is parsed to automatically generate target test cases.

2. The method according to claim 1, characterized in that The step of inputting the test case template, the target engineering background information and the target scenario description information into the target macro model to obtain target output data comprises: The test case template, the target engineering background information and the target scenario description information are input into the target big model, and the target output data is obtained according to the test case generation prompt of the target big model. The test case generation prompt is used to instruct the target big model to generate test case data that conforms to the target engineering background information and the target scenario description information according to the test case template.

3. The method according to claim 1, characterized in that The target scenario description information includes test object information, test manufacturer information and test case requirement information; The acquisition of the test case template, target project background information and target scenario description information includes: Acquire the test case template and target project background information uploaded by the user on the information upload page of the automated testing tool; The test object information, test manufacturer information and test case requirement information entered by the user on the information upload page are obtained.

4. The method according to claim 1, characterized in that: The parsing of the target output data and automatically generating target test cases comprises: Parse the target output data and extract the target application data; Automatically generate target test cases based on target application data.

5. The method according to claim 1, characterized in that The method further comprises: Converting the test case template, the target engineering background information and the target scenario description information into a test case template, target engineering background information and target scenario description information in a target format; The step of inputting the test case template, the target engineering background information and the target scenario description information into the target macro model to obtain target output data comprises: Input the test case template in the target format, the target engineering background information and the target scenario description information into the target large model to obtain the target output data.

6. The method according to claim 1, characterized in that The method further comprises: Verifying the target test case according to the test requirements of the automated testing tool to obtain a verification result; If the verification result is that the verification passes, the target test case is imported into the position corresponding to the target scenario description information.

7. The method according to claim 6, characterized in that The method further comprises: If the verification result is that the verification fails, obtain error information during the verification process; Inputting the error information and the target test case into the target macro model to obtain a corrected test case; Continue to verify the modified test case according to the test requirements of the automated testing tool to obtain a verification result; If the verification result is that the verification passes, importing the modified test case into the position corresponding to the target scenario description information; If the verification result is a verification failure, repeatedly obtain the error information in the verification process and input the error information and the corrected test case into the target large model, and obtain the corrected test case again, until the verification result is a verification pass or the verification times threshold is reached.

8. A device for automatically generating test cases, characterized in that: The device comprises: An acquisition unit, used to acquire a test case template, target project background information and target scenario description information, wherein the test case template meets the test requirements of the automated testing tool, and the target scenario description information is constructed based on the target project background information; An input unit, used to input the test case template, the target project background information and the target scenario description information into the target macro model to obtain target output data; The generating unit is used to parse the target output data and automatically generate target test cases.

9. A device for automatically generating test cases, characterized in that: The device comprises: a processor and a memory; The memory is used to store instructions; The processor is used to execute the instructions in the memory to perform the method according to any one of claims 1 to 7.

10. A computer-readable medium, characterized in that The method comprises instructions which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Test case generation method and device based on large model

    CN117349188A

  • Test case generation method and device, terminal equipment and readable storage medium

    CN117707922A

  • Test case generation method and device, equipment, storage medium and program product

    CN118467390A

Cited By

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

    CN121547113A