Test case structured generation method, system, electronic device and storage medium
Patent Information
- Application Number
- CN202610904000.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-22
- Publication Date
- 2026-10-27
AI Technical Summary
[0005]在本实施例中提供了一种测试用例结构化生成方法、系统、电子装置和存储介质,以解决相关技术中存在测试用例结构化生成的效率较低的问题
[0029]与相关技术相比,在本实施例中提供的测试用例结构化生成方法,通过解析目标测试用例结构化文件的格式规范,得到多个逻辑层级的结构模板;利用大语言模型,根据结构模板和非结构化的测试用例文本,生成测试用例文本对应的用例结构化单元;利用预定义的组装函数,将用例结构化单元组装成符合格式规范的测试用例结构化文件。其能够利用大语言模型、解析的结构模板、以及预定义的组装函数,自动化生成结构化的测试用例文件,从而提高了测试用例结构化生成的效率。
Smart Images

Figure CN122985608A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of software engineering and test automation technology, and in particular to methods, systems, electronic devices and storage media for the structured generation of test cases. Background Technology
[0002] In software testing, writing and managing test cases is a core and demanding task. Currently, test engineers typically use lightweight markup languages such as Markdown to write test cases to ensure readability and ease of editing. However, for visual test case management, review, or integration with specific testing platforms, it is necessary to convert these text test cases written in lightweight markup languages into structured data formats (such as specific JSON structures).
[0003] Current technologies often employ manual conversion for the structured transformation of test cases. This means engineers need to understand every field in the target JSON format, then manually compare, copy, paste, and assemble the data to convert unstructured test cases into structured ones. This method is inefficient.
[0004] There is currently no effective solution to the problem of low efficiency in the structured generation of test cases in related technologies. Summary of the Invention
[0005] This embodiment provides a method, system, electronic device, and storage medium for generating structured test cases to address the problem of low efficiency in generating structured test cases in related technologies.
[0006] Firstly, this embodiment provides a method for generating structured test cases, including:
[0007] Parse the format specifications of the target test case structured file to obtain a structure template with multiple logical levels;
[0008] Using a large language model, based on the structure template and unstructured test case text, generate test case structured units corresponding to the test case text;
[0009] Using predefined assembly functions, the test case structure units are assembled into a test case structure file that conforms to the specified format.
[0010] In some embodiments, the parsing of the target test case structure file format specification yields a structure template with multiple logical levels, including:
[0011] The format specifications of the target test case structure file are parsed to obtain the overall test case structure template, the test point structure template, and the test case structure template.
[0012] In some embodiments, the step of using a large language model to generate test case structured units corresponding to the test case text based on the structured template and unstructured test case text includes:
[0013] Based on the aforementioned structural template, generate structured prompt words;
[0014] The structured prompts and the unstructured test case text are input into the large language model to generate the test case structured units corresponding to the test case text.
[0015] In some embodiments, generating structured prompt words based on the structure template includes:
[0016] The structured prompt words are generated based on the use case structure template in the structure template.
[0017] In some embodiments, assembling the test case structuring units into a test case structuring file conforming to the format specification using a predefined assembly function includes:
[0018] The assembly function is predefined based on the structure template;
[0019] Using the assembly function, the test case structure units are assembled into a test case structure file that conforms to the format specification.
[0020] In some embodiments, the step of predefining the assembly function according to the structural template includes:
[0021] Based on the overall test case structure template and the test point structure template in the structure template, the assembly function is predefined.
[0022] Secondly, this embodiment provides a test case structure generation system, including a structure template acquisition module, a structured unit generation module, and a structured file generation module, wherein:
[0023] The structure template acquisition module is used to parse the format specifications of the target test case structure file to obtain a structure template with multiple logical levels.
[0024] The structured unit generation module is used to generate test case structured units corresponding to the test case text based on the structure template and unstructured test case text using a large language model.
[0025] The module for generating structured files is used to assemble the test case structured units into test case structured files that conform to the format specification using predefined assembly functions.
[0026] Thirdly, this embodiment provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the test case structure generation method described in the first aspect above.
[0027] Fourthly, this embodiment provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to execute the test case structure generation method described in the first aspect above.
[0028] Fifthly, this embodiment provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the test case structure generation method described in the first aspect above.
[0029] Compared with related technologies, the test case structure generation method provided in this embodiment obtains a multi-level logical structure template by parsing the format specification of the target test case structure file; it then uses a large language model to generate test case structure units corresponding to the test case text based on the structure templates and unstructured test case text; finally, it uses predefined assembly functions to assemble the test case structure units into a test case structure file that conforms to the format specification. This method can automatically generate structured test case files using a large language model, parsed structure templates, and predefined assembly functions, thereby improving the efficiency of test case structure generation.
[0030] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description
[0031] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0032] Figure 1 This is a hardware structure block diagram of the terminal for the test case structure generation method in this embodiment;
[0033] Figure 2 This is a flowchart of the test case structure generation method in this embodiment;
[0034] Figure 3 This is a block diagram of the test case structure generation system in this embodiment. Detailed Implementation
[0035] To better understand the purpose, technical solution, and advantages of this application, the application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0036] Unless otherwise defined, the technical or scientific terms used in this application shall have the general meaning understood by one of ordinary skill in the art to which this application pertains. Words such as “a,” “an,” “an,” “the,” “the,” and “these” used in this application do not indicate quantitative limitation and may be singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or modules (units) is not limited to the listed steps or modules (units) but may include steps or modules (units) not listed, or may include other steps or modules (units) inherent to these processes, methods, products, or devices. Words such as “connected,” “linked,” and “coupled” used in this application are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. “Multiple” used in this application refers to two or more. “And / or” describes the relationship between related objects, indicating that three relationships may exist; for example, “A and / or B” can represent: A alone, A and B simultaneously, and B alone. Normally, the character " / " indicates that the objects before and after it are in an "or" relationship. The terms "first," "second," "third," etc., used in this application are merely to distinguish similar objects and do not represent a specific order of objects.
[0037] The method embodiments provided in this example can be executed on a terminal, computer, or similar computing device. For example, it can run on a terminal. Figure 1 This is a hardware structure block diagram of the terminal for the test case structure generation method in this embodiment. For example... Figure 1 As shown, a terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 and a memory 104 for storing data are also included. The processor 102 may be, but is not limited to, a microprocessor (MCU) or a programmable logic device (FPGA). The terminal may also include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that… Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the terminal described above. For example, the terminal may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown are illustrated.
[0038] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the test case structure generation method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0039] The transmission device 106 is used to receive or send data via a network. This network includes a wireless network provided by the terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 can be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0040] This embodiment provides a method for generating structured test cases. Figure 2 This is a flowchart of the test case structure generation method in this embodiment, such as... Figure 2 As shown, the process includes the following steps:
[0041] Step S201: Parse the format specification of the target test case structured file to obtain a structure template with multiple logical levels.
[0042] Specifically, the target test case structure file can be a JSON file with the .km extension. This file type can be rendered into mind maps or other forms using visual test management tools or plugins for test review and management. The structure template is a standardized template used to describe the data organization method, parsed and abstracted from the format specification of the target test case structure file (e.g., a .km file). This multi-level structure template includes an overall test case structure template, a test point structure template, and a test case structure template. Parsing the format specification of the target test case structure file yields multiple logical levels of structure templates: the overall test case structure template, the test point structure template, and the test case structure template. The overall test case structure template describes the entire test suite; the test point structure template describes a specific test scenario or function (e.g., adding a new car dealer access); and the test case structure template describes a test case at the smallest granularity. In addition, a root structure can be obtained, containing fixed fields such as root, template, theme, version, and id.
[0043] Step S202: Using the large language model, generate the test case structure unit corresponding to the test case text based on the structure template and unstructured test case text.
[0044] Specifically, the large language model can be DeepSeek-R1, GPT-4V, Gemini, etc. The unstructured test case text can be written using the Markdown lightweight markup language. The test case structure unit is a test case that conforms to a test case structure template. Based on the structure template, structured prompts are generated. The structured prompts and unstructured test case text are input into the large language model to generate the corresponding test case structure units.
[0045] Step S203: Using a predefined assembly function, the test case structure units are assembled into a test case structure file that conforms to the format specification.
[0046] Specifically, this assembly function is used to automatically assemble test case structure units into complete test case structure files that conform to the target test case structure file format specification. This assembly function can be a test point creation function (such as `create_testpoint`), a system construction function (such as `build_system_struct`), etc. Using this predefined assembly function, test case structure units can be assembled into test case structure files that conform to the target test case structure file format specification.
[0047] In this embodiment, by parsing the format specification of the target test case structured file, a structure template with multiple logical levels is obtained. Using a large language model, based on the structure templates and unstructured test case text, test case structured units corresponding to the test case text are generated. Using predefined assembly functions, the test case structured units are assembled into a test case structured file that conforms to the format specification. This approach can automatically generate structured test case files using a large language model, parsed structure templates, and predefined assembly functions, thereby improving the efficiency of test case structured generation.
[0048] In some of these embodiments, the format specification of the target test case structured file is parsed to obtain a structure template with multiple logical levels, including: parsing the format specification of the target test case structured file to obtain an overall test case structure template, a test point structure template, and a test case structure template.
[0049] Specifically, parsing the format specification of the target test case structure file yields multiple logical-level structure templates: the overall test case structure template, the test point structure template, and the test case structure template. The overall test case structure corresponds to a test suite or module; the test point structure corresponds to a specific test scenario or functional point; and the test case structure corresponds to a test case at the smallest granularity, containing three leaf nodes: preconditions, operation steps, and expected results. These leaf nodes contain the fields id, created, text, and usecase. In addition, a root structure can be obtained, containing fixed fields such as root, template, theme, version, and id.
[0050] For example, the target test case structure file is as follows:
[0051] {
[0052] "root": "test",
[0053] "template": "default",
[0054] "theme": "light",
[0055] "version": "1.0",
[0056] "id": "km_20260515_001",
[0057] "children": [
[0058] {
[0059] "id": "module_aitc_001",
[0060] "created": 1747296000000
[0061] "text": "Channel-AITC",
[0062] "usecase": 0,
[0063] "children": [
[0064] {
[0065] "id": "testpoint_001",
[0066] "created": 1747296000000
[0067] "text": "Added new dealer access",
[0068] "usecase": 0,
[0069] "children": [
[0070] {
[0071] "id": "usecase_001",
[0072] "created": 1747296000000
[0073] "text": "Complete new car dealer information"
[0074] "usecase": 2,
[0075] "children": [
[0076] {
[0077] "id": "cond_001",
[0078] "created": 1747296000000
[0079] "text": "1. Test environment is normal; 2. Logged into AITC backend; 3. Car dealer qualification materials are complete."
[0080] "usecase": 1
[0081] },
[0082] {
[0083] "id": "step_001",
[0084] "created": 1747296000000
[0085] "text": "1. Access the dealer management page; 2. Click the 'Add Dealer' button; 3. Fill in the complete dealer information; 4. Submit for review."
[0086] "usecase": 3
[0087] },
[0088] {
[0089] "id": "expect_001",
[0090] "created": 1747296000000
[0091] "text": "1. Submission successful; 2. Dealer status shows 'Pending Review'; 3. Dealer data added to the list."
[0092] "usecase": 4
[0093] } ]
[0095] } ]
[0097] } ]
[0099] } ]
[0101] };
[0102] The overall structure of the use case is as follows:
[0103] {
[0104] "children": [
[0105] {
[0106] "id": "module_aitc_001",
[0107] "created": 1747296000000
[0108] "text": "Channel-AITC",
[0109] "usecase": 0,
[0110] "children": [
[0111] {
[0112] }
[0113] }
[0114] };
[0115] The test point structure is as follows:
[0116] {
[0117] "children": [
[0118] {
[0119] "id": "testpoint_001",
[0120] "created": 1747296000000
[0121] "text": "Added new dealer access",
[0122] "usecase": 0,
[0123] "children": [
[0124] {
[0125] }
[0126] }
[0127] };
[0128] The use case structure is as follows:
[0129] {
[0130] "children": [
[0131] {
[0132] "id": "usecase_001",
[0133] "created": 1747296000000
[0134] "text": "Complete new car dealer information"
[0135] "usecase": 2,
[0136] "children": [
[0137] {
[0138] "id": "cond_001",
[0139] "created": 1747296000000
[0140] "text": "1. Test environment is normal; 2. Logged into AITC backend; 3. Car dealer qualification materials are complete."
[0141] "usecase": 1
[0142] },
[0143] {
[0144] "id": "step_001",
[0145] "created": 1747296000000
[0146] "text": "1. Access the dealer management page; 2. Click the 'Add Dealer' button; 3. Fill in the complete dealer information; 4. Submit for review."
[0147] "usecase": 3
[0148] },
[0149] {
[0150] "id": "expect_001",
[0151] "created": 1747296000000
[0152] "text": "1. Submission successful; 2. Dealer status shows 'Pending Review'; 3. Dealer data added to the list."
[0153] "usecase": 4
[0154] } ]
[0156] } ]
[0158] };
[0159] In some embodiments, a large language model is used to generate test case structured units corresponding to the test case text based on a structured template and unstructured test case text. This includes: generating structured prompt words based on the structured template; and inputting the structured prompt words and unstructured test case text into the large language model to generate test case structured units corresponding to the test case text.
[0160] Specifically, the unstructured test case text can be written using the Markdown lightweight markup language. The large language model can be DeepSeek-R1, GPT-4V, Gemini, etc. The test case structure unit is a test case that conforms to the test case structure template. Based on the test case structure template, structured prompts are generated. The structured prompts and unstructured test case text are input into the large language model to generate the test case structure units corresponding to the test case text.
[0161] For example, the structured prompt words are:
[0162] "You are a professional test case structure conversion assistant. Please strictly follow the following rules to process the input Markdown test cases:"
[0163] Content extraction: Accurately extract four core pieces of information from Markdown text: test case title, preconditions, operation steps, and expected results.
[0164] Fill template: Fill the extracted content into the specified test case JSON template, strictly retaining fields and hierarchy, and do not add or delete fields.
[0165] Formatting guidelines:
[0166] The usecase fields are fixed: use case title = 2, preconditions = 1, operation steps = 3, expected result = 4;
[0167] The id field uses a simple, unique string (such as uc_01, cond_01, step_01, exp_01).
[0168] Outputs only plain JSON, with no additional text, comments, or explanations.
[0169] Output structure: Generates a single, complete test case JSON unit.
[0170] Unstructured test case text is as follows:
[0171] ## Login with correct username and password
[0172] ### Prerequisites
[0173] 1. Open the login page
[0174] 2. Network connection is normal.
[0175] ### Operation Steps
[0176] 1. Enter the correct account
[0177] 2. Enter the correct password
[0178] 3. Click the login button
[0179] ### Expected Results
[0180] 1. Login successful
[0181] 2. Redirect to the homepage
[0182] The structured unit of a use case is:
[0183] {
[0184] "id": "uc_01",
[0185] "text": "Login with correct username and password",
[0186] "usecase": 2,
[0187] "children": [
[0188] {
[0189] "id": "cond_01",
[0190] "text": "1. The login page opened; 2. The network connection is normal."
[0191] "usecase": 1
[0192] },
[0193] {
[0194] "id": "step_01",
[0195] "text": "1. Enter the correct username; 2. Enter the correct password; 3. Click the login button",
[0196] "usecase": 3
[0197] },
[0198] {
[0199] "id": "exp_01",
[0200] "text": "1. Login successful; 2. Redirecting to the homepage",
[0201] "usecase": 4
[0202] } ]
[0204] };
[0205] In some of these embodiments, generating structured prompts based on a structure template includes: generating structured prompts based on a use case structure template within the structure template.
[0206] Specifically, based on the use case structure template (i.e., the third-level template, containing the use case title, preconditions, steps, and expected results) in the structure template, structured prompts are generated. These prompts include: first, requiring the model to understand the meaning and filling rules of each field in the template (such as id, text, usecase, created, children, etc.); second, specifying the input source as Markdown test cases written in natural language (usually containing "preconditions," "steps," and "expected results"), requiring the model to identify and extract the corresponding content; and finally, outputting a JSON object that fully conforms to the use case structure template, including automatically generating a unique identifier, filling in timestamps, and maintaining nested relationships. Through these structured prompts, large language models can be guided to efficiently and systematically complete the conversion from unstructured text to structured use case units.
[0207] For example, the structured prompt words are:
[0208] "You are a professional test case structure conversion assistant. Please strictly follow the following rules to process the input Markdown test cases:"
[0209] Content extraction: Accurately extract four core pieces of information from Markdown text: test case title, preconditions, operation steps, and expected results.
[0210] Fill template: Fill the extracted content into the specified test case JSON template, strictly retaining fields and hierarchy, and do not add or delete fields.
[0211] Formatting guidelines:
[0212] The usecase fields are fixed: use case title = 2, preconditions = 1, operation steps = 3, expected result = 4;
[0213] The id field uses a simple, unique string (such as uc_01, cond_01, step_01, exp_01).
[0214] Outputs only plain JSON, with no additional text, comments, or explanations.
[0215] Output structure: Generates a single, complete test case JSON unit.
[0216] In some embodiments, predefined assembly functions are used to assemble test case structure units into test case structure files that conform to a format specification, including: predefining assembly functions according to a structure template; and using the assembly functions to assemble test case structure units into test case structure files that conform to a format specification.
[0217] Specifically, the assembly function is a predefined function based on the overall test case structure template and the test point structure template in the structure template. Using this predefined assembly function, test case structure units can be assembled into a test case structure file that conforms to the format specifications of the target test case structure file. For the test point structure template, a test point creation function (e.g., `create_testpoint`) is defined. This function receives the test point name and a list of test case structure units belonging to that test point, automatically generates the identifier and timestamp of the test point node, fills its `children` field with the test case list, and outputs a test point structure JSON object. For the overall test case structure template, a system build function (e.g., `build_system_struct`) is defined. This function receives the root node name, theme style, version number, and the test point structure list, automatically generates a unique identifier for the root node, assembles all top-level fixed fields, uses the test point list as the `children` of the root node, and finally returns a complete `.km` file.
[0218] Using the predefined assembly function, multiple independent test case structured units (each unit corresponding to a specific test case) are grouped according to business logic: First, all test case units are traversed, and based on their respective test point names, the `create_testpoint` function is called to encapsulate test case units under the same test point into a test point structure; then, the list of all obtained test point structures is passed to the `build_system_struct` function, specifying the root node name, topic, and other metadata, which automatically assembles the structured test case file (i.e., the .km file) that conforms to the format specifications. The entire process requires no manual intervention, ensuring the structural consistency, data integrity, and format compliance of the output file.
[0219] In some of these embodiments, an assembly function is predefined based on a structure template, including: predefining an assembly function based on the overall use case structure template and the test point structure template in the structure template.
[0220] Specifically, based on the overall test case structure template in the structure template, the fixed fields of the overall test case structure are obtained: root (test set name), template (template identifier), theme (theme style), version (version number), and id (unique identifier). Based on this, a system build function (e.g., build_system_struct) is predefined. This function takes the root node name, theme style, version number, and a list of test point structures as parameters. This function is responsible for creating the overall test case structure, assigning the passed-in test point list to the children field, and finally outputting a complete JSON object that can be directly saved as a .km file. Based on the test point structure template in the structure template, the fixed fields of the test point structure are obtained: id, text (test point name), usecase (fixed value, such as 0), created (timestamp), and children (an array storing test case units). Based on this, a test point creation function (e.g., create_testpoint) is predefined. This function takes the test point name and a list of test case units belonging to that test point as parameters, automatically generates id and timestamp, and assembles them into a JSON object conforming to the test point structure template. In addition, predefined use case creation functions (such as `create_usecase`) can be defined. These functions take the use case title, precondition text, operation step text, and expected result text as parameters, and internally call basic utility functions to generate a complete use case structure JSON object. The basic utility functions include `generate_id()` for generating unique identifiers, and `create_condition()`, `create_steps()`, and `create_expected()` for creating standardized leaf nodes.
[0221] These predefined assembly functions encapsulate the underlying formatting details. When the final .km file needs to be generated, simply call `create_usecase` to generate test case units, call `create_testpoint` to group the test case units into test points, and finally call `build_system_struct` to assemble all test points into a JSON object that can be directly saved as a .km file.
[0222] This embodiment also provides a test case structure generation system, which is used to implement the above embodiments and preferred embodiments, and will not be repeated as described previously. The terms "module," "unit," "subunit," etc., used below can refer to a combination of software and / or hardware that performs a predetermined function. Although the system described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0223] Figure 3 This is a structural block diagram of the test case structure generation system in this embodiment, such as... Figure 3 As shown, the test case structure generation system 30 includes: a structure template acquisition module 301, a structured unit generation module 302, and a structured file generation module 303, wherein:
[0224] The structure template module 301 is used to parse the format specifications of the target test case structure file and obtain a structure template with multiple logical levels.
[0225] The structured unit generation module 302 is used to generate test case structured units corresponding to the test case text based on the structured template and unstructured test case text using a large language model.
[0226] The structured file generation module 303 is used to assemble test case structured units into test case structured files that conform to the format specifications using predefined assembly functions.
[0227] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can reside in the same processor; or the above modules can be located in different processors in any combination.
[0228] This embodiment also provides a computer program product, including a computer program that, when executed by a processor, implements the steps in any of the above-described test case structure generation method embodiments.
[0229] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated in this embodiment.
[0230] This embodiment also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to execute any of the above-described test case structure generation methods.
[0231] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated in this embodiment.
[0232] Furthermore, in conjunction with the test case structure generation method provided in the above embodiments, this embodiment can also provide a computer-readable storage medium for implementation. This storage medium stores a computer program; when executed by a processor, the computer program implements the steps of any of the test case structure generation methods in the above embodiments.
[0233] It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. All other embodiments derived by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.
[0234] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0235] Obviously, the accompanying drawings are merely some examples or embodiments of this application. Those skilled in the art can apply this application to other similar situations based on these drawings without any creative effort. Furthermore, it is understood that although the work done in this development process may be complex and lengthy, for those skilled in the art, certain design, manufacturing, or production modifications made based on the technical content disclosed in this application are merely conventional technical means and should not be considered as insufficient disclosure of this application.
[0236] The term "embodiment" in this application refers to a specific feature, structure, or characteristic described in connection with an embodiment that may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily imply the same embodiment, nor does it imply that it is mutually exclusive with or independent of other embodiments. It will be clearly or implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0237] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of patent protection. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the appended claims.
Claims
1. A method for generating structured test cases, characterized in that, include: Parse the format specifications of the target test case structured file to obtain a structure template with multiple logical levels; Using a large language model, based on the structure template and unstructured test case text, generate test case structured units corresponding to the test case text; Using predefined assembly functions, the test case structure units are assembled into a test case structure file that conforms to the specified format.
2. The test case structure generation method according to claim 1, characterized in that, The parsing of the target test case structure file format specification yields a structure template with multiple logical levels, including: The format specifications of the target test case structure file are parsed to obtain the overall test case structure template, the test point structure template, and the test case structure template.
3. The test case structure generation method according to claim 2, characterized in that, The process of generating structured test case units corresponding to the test case text using a large language model, based on the structure template and unstructured test case text, includes: Based on the aforementioned structural template, generate structured prompt words; The structured prompts and the unstructured test case text are input into the large language model to generate the test case structured units corresponding to the test case text.
4. The test case structure generation method according to claim 3, characterized in that, The step of generating structured prompt words based on the structure template includes: The structured prompt words are generated based on the use case structure template in the structure template.
5. The test case structure generation method according to claim 1, characterized in that, The step of assembling the test case structure units into a test case structure file conforming to the format specification using a predefined assembly function includes: The assembly function is predefined based on the structure template; Using the assembly function, the test case structure units are assembled into a test case structure file that conforms to the format specification.
6. The test case structure generation method according to claim 5, characterized in that, The predefined assembly function based on the structure template includes: Based on the overall test case structure template and the test point structure template in the structure template, the assembly function is predefined.
7. A test case structure generation system, characterized in that, This includes a module for obtaining structure templates, a module for generating structured units, and a module for generating structured files, wherein: The structure template acquisition module is used to parse the format specifications of the target test case structure file to obtain a structure template with multiple logical levels. The structured unit generation module is used to generate test case structured units corresponding to the test case text based on the structure template and unstructured test case text using a large language model. The module for generating structured files is used to assemble the test case structured units into test case structured files that conform to the format specification using predefined assembly functions.
8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the test case structure generation method as described in any one of claims 1 to 6.
9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to execute the test case structure generation method according to any one of claims 1 to 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the test case structure generation method as described in any one of claims 1 to 6.