Automated test case generation method and system based on standard sentence library

CN123011698APending Publication Date: 2026-10-30HEFEI JUYI POWER SYST CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202611125421.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0005]综上,现有技术中尚缺少一种能够打通从软件需求到自动化测试用例全流程自动生成的技术方案,无法解决因流程断裂导致的人工深度干预、效率低下、维护困难等技术问题

Benefits of technology

采用上述的技术方案,通过构建封装有可复用功能单元的标准语句库,并在编写需求思维导图时将节点与库条目关联,在解析时自动识别并拼接生成可执行脚本,从而打通了从软件需求到自动化测试用例的全流程自动化链路,真正实现了无需人工编码干预的一键式自动生成,同时因脚本由标准化语句拼装而成,也一并解决了人工编写一致性差和半自动方案脚本鲁棒性低的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123011698A_ABST
    Figure CN123011698A_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on standard sentence library's automated test case generation method and system, it is related to software automation testing technical field.The method comprises the following steps: defining the node level and content format of mind map to establish the mapping relationship between requirement and test case;Standard sentence library is constructed, reusable functional units in automation testing framework are encapsulated and stored in the form of entries;The mind map is written by obtaining the decomposed software requirement, the node is associated with the entry of standard sentence library;When parsing the mind map, the library entry associated with the node is identified, and an executable script that meets the syntax requirements of the automation framework is automatically spliced and generated according to the preset conversion rule, while a structured manual test case document is generated.The application connects the whole process automatic generation link from requirement to automation case, solves the problem of manual deep intervention and process breakage in the prior art, improves the generation efficiency and script robustness, and is suitable for automation testing in the field of new energy vehicles.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automated testing technology, and in particular to an automated test case generation method and system based on a standard statement library. Background Technology

[0002] Automated testing is widely used in fields such as new energy vehicles where software is rapidly iterating, due to its low labor costs, repeatability, high efficiency, and convenient data retention and management.

[0003] Currently, the mainstream methods for implementing automated test cases are mainly divided into manual writing and semi-automatic generation. Manual writing refers to manually converting test cases, requirement documents, and interface documents into automated script test cases according to the framework and syntax specifications of automated testing software or tools. This method suffers from low efficiency, high error rates, high maintenance costs, strong coupling with the testing environment, and difficulty in knowledge accumulation. Semi-automatic generation refers to using the functional interfaces and templates provided by automated testing software and tools to convert test cases into executable automated test cases. While this method improves the initial writing speed, it still relies heavily on manual intervention to supplement assertions, logic, and exception scenarios. The scripts have poor robustness; they become invalid when variable positions change, making it difficult to cope with the current trend of rapid iteration and complex business logic.

[0004] Patent document 1 (CN121743189A) proposes using mapping to improve the generality of XCP variables in test cases, thus avoiding repeated modifications to test cases due to changes in signals from different projects. However, this method only improves the generality of signals in test cases and does not address the automatic generation of test cases. Patent document 2 (CN119473885A) proposes a method for automated test case management based on a web interface. It uses an established Excel spreadsheet to filter and select specific test cases, effectively achieving test case selection and management. However, it does not address the generation and writing of original test cases. Patent document 3 (CN113094288A) proposes a method for generating test cases based on mind maps in the field of general software testing. This method can effectively reduce the time cost of test case maintenance for testers and facilitate review. However, it only solves the problem of manually writing and generating test cases and does not address a solution for further automatically converting requirement mind maps into executable automated test cases.

[0005] In summary, there is currently a lack of a technical solution that can automatically generate test cases throughout the entire process from software requirements to automated test cases, and it is unable to solve the technical problems such as deep manual intervention, low efficiency, and maintenance difficulties caused by process breaks. Summary of the Invention

[0006] The purpose of this invention is to overcome the shortcomings of the existing technology. To achieve the above objective, an automated test case generation method and system based on a standard statement library is adopted to solve the problems mentioned in the background technology.

[0007] An automated test case generation method based on a standard statement library includes the following steps: Define the node hierarchy and content format of the mind map to establish a mapping relationship between requirements and test cases; Obtain the decomposed software requirements and create a mind map based on the node hierarchy and content format; The mind map is analyzed to identify the semantic and hierarchical relationships of each node and generate a structured manual test case document. A standard statement library is constructed, which encapsulates reusable functional units in the automated testing framework and stores them in the form of entries. When creating a mind map, the nodes of the mind map are associated with the entries in the standard statement library; When parsing the mind map, the entries in the standard statement library associated with the nodes are identified, and the contents of the entries are automatically concatenated according to preset conversion rules to generate an executable automated test case script that conforms to the syntax requirements of the automated testing framework.

[0008] As a further improvement of the present invention, the entries in the standard statement library are classified into precondition class, test action class, and assertion logic class; wherein, the precondition class encapsulates environment initialization and state preset statements, the test action class encapsulates instruction operation statements, and the assertion logic class encapsulates result comparison and state judgment statements; each entry is configured with parameter format and calling rules to ensure that the concatenated script is directly compatible with the automated testing framework.

[0009] As a further improvement of the invention, each entry is also configured with a name and description tag for fuzzy search matching when creating a mind map.

[0010] As a further improvement of the present invention, the definition of the node hierarchy and content format of the mind map includes: specifying that the root node corresponds to the test module, the first-level node corresponds to the test function point, and the child nodes are divided into preconditions, test steps and expected results in sequence, and preset keyword tags for the nodes, so that the node content corresponds to the test attributes, test environment, test level and requirement identification fields of the actual test cases.

[0011] As a further improvement of the present invention, the preset keyword tag includes keywords for identifying the test step type and the expected result type, so that the corresponding standard statement library entry can be identified and called according to the keywords during parsing.

[0012] As a further improvement of the present invention, the process of parsing the mind map and generating an executable automated test case script includes: traversing the nodes of the mind map, obtaining the node content and its associated standard statement library entries; according to the node hierarchy, filling the obtained entry content and its parameters into a preset automated test script template, and splicing them together to form an automated test case with step logic.

[0013] As a further improvement of the present invention, when creating a mind map, the method further includes: performing a fuzzy search based on the characters input by the user, matching entries related to the characters in the standard statement library and displaying recommendations; responding to the user's selection operation, inserting the selected entry into the current node with one click, and automatically marking parameter placeholders for filling.

[0014] As a further improvement of the present invention, when the mind map is saved, the method further includes: automatically verifying whether the saved mind map meets at least one of the following criteria: root node type, node naming conventions, keyword tag integrity, and the validity of the associated standard statement library entries; the parsing and automatic generation process is only started after the verification is passed.

[0015] As a further improvement of the present invention, when generating the manual test case document and the automated test case script, the method further includes: automatically embedding a unique traceability identifier into the generated document and script, and binding the unique traceability identifier with the hash value of the original mind map to establish a two-way traceability relationship from requirements to test assets.

[0016] An automated system for generating automated use cases from requirements maps based on a standard statement library includes: The format definition module is used to define the node hierarchy and content format of the mind map in order to establish the mapping relationship between requirements and test cases; The mind map writing module is used to obtain the decomposed software requirements and write mind maps according to the node hierarchy and content format. The parsing module is used to parse the mind map, identify the semantic and hierarchical relationships of each node, and generate a structured manual test case document. A standard statement library storage module is used to build and store a standard statement library, which encapsulates reusable functional units in the automated testing framework and stores them in the form of entries. The association module is used to associate the nodes of the mind map with the entries in the standard statement library when creating the mind map; The parsing module is also used to identify the entries in the standard statement library associated with the node, and automatically concatenate the contents of the entries according to the preset conversion rules to generate an executable automated test case script that conforms to the syntax requirements of the automated testing framework.

[0017] Compared with the prior art, the present invention has the following technical advantages: By adopting the above technical solution, a standard statement library encapsulating reusable functional units is constructed. When writing the requirement mind map, nodes are associated with library entries. During parsing, the system automatically identifies and assembles the statements to generate executable scripts. This opens up a fully automated link from software requirements to automated test cases, truly achieving one-click automatic generation without manual coding intervention. At the same time, because the scripts are assembled from standardized statements, the problems of poor consistency in manual writing and low robustness of semi-automatic solution scripts are also solved. Attached Figure Description

[0018] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings: Figure 1 This is a schematic diagram illustrating the steps of the generation method in an embodiment of this application; Figure 2 This is a schematic diagram illustrating a typical format definition of an embodiment disclosed in this application. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] Please refer to Figure 1 In this embodiment of the invention, an automated test case generation method based on a standard statement library is divided into three core stages: defining the mind map format specification, constructing the LIB standard statement library, and parsing the mind map and converting it into test cases. The method includes the following steps: Step S1: Define the node hierarchy and content format of the mind map. This step establishes a structured mapping between software requirements and test cases. Specifically, based on the adopted test case format, it defines the node hierarchy and content format specifications of the mind map. In a typical application, the root node corresponds to the test module, the first-level nodes correspond to the test function points, and the child nodes sequentially divide the preconditions, test steps, and expected results. Each node can be bound to preset keyword tags, such as speed, torque, and operating status, to identify the test step type and expected result type, facilitating subsequent parsing and identification. Simultaneously, a one-to-one mapping relationship is established between the node content and the actual test case's test attributes, function, test environment, test level, requirement ID, and creator fields.

[0021] Step S2: Construct the standard statement library (LIB library) This step is the foundational support for achieving automatic test case conversion. First, all common and reusable functional units in the system's automated testing framework are identified and categorized into three main types: preconditions, test actions, and assertion logic. The preconditions class primarily encapsulates common statements such as environment initialization, interface pre-requests, and state presetting; the test actions class encapsulates common operations such as torque commands, speed commands, status commands, and diagnostic commands; and the assertion logic class encapsulates standard logic statements such as result comparison, status judgment, and exception handling.

[0022] In a specific embodiment, the classification is the minimum allocation item for the subsequent formation of test cases. Other classification items can also be added to adapt to different scenarios, such as filtering based on different "test environments".

[0023] Each LIB entry is configured with a clear name and description tag, and the parameter format and calling rules for each entry are uniformly defined to ensure that subsequent parsing and concatenation can directly adapt to the syntax requirements of the automated testing framework without additional adjustments or corrections. The LIB library supports continuous addition and modification of entries, and can be updated according to iterative business needs.

[0024] Step S3: Create a mind map and link it to LIB library entries. After obtaining and decomposing the software requirements, a mind map is created based on the node hierarchy and content format defined in Step 1. During the creation process, the system provides intelligent assistance functions: it performs fuzzy search based on the characters entered by the user, matches entries related to the characters in the standard statement library, and displays recommendations; in response to the user's selection operation, it inserts the selected entry into the current node with one click and automatically marks parameter placeholders for subsequent filling.

[0025] When a mind map is saved, the system automatically verifies whether it conforms to the root node type, node naming conventions, keyword tag completeness, and the validity of associated standard statement library entries. Only after the verification passes will the subsequent parsing and automatic generation process begin, ensuring that the mind map has a rigorous structure and semantic completeness.

[0026] In specific embodiments, the implementation of association is the same as the "one-click insertion" principle. In addition to the "one-click insertion" method, testers can also manually filter the associations.

[0027] Step S4: Parse the mind map and generate test cases. After successful verification, the system initiates the parsing process. First, it traverses the nodes of the mind map, obtaining the semantic content, hierarchical relationships, and associated standard statement library entries for each node. Based on the node hierarchy, the obtained entry content and its filled parameters are input into a preset automated test script template, automatically assembling it to form an executable automated test case script with logical steps that conforms to the syntax requirements of the corresponding automated testing framework.

[0028] At the same time, the system generates structured manual test case documents (such as Excel documents) based on the mapping relationship between node content and fields. The document fields correspond strictly one-to-one with the test steps and include full information such as test case number, title, preconditions, execution steps, expected results, and priority.

[0029] During the generation process, a unique traceability identifier is automatically embedded in all outputs, and this unique traceability identifier is bound to the hash value of the original mind map to establish a two-way traceability relationship from requirements to test assets, ensuring that the entire lifecycle of test assets is traceable, auditable, and reproducible.

[0030] In a specific implementation, the traceability identifier is associated with the hash of the mind map and the timestamps of the script and document generation, so that any file can be traced back to the corresponding other documents.

[0031] Through the above steps, this method achieves the synchronous and automatic generation of software requirements mind maps, manual test case documents, and executable automated test case scripts, without the need for manual secondary transcription and writing.

[0032] Example 2 This embodiment provides an automated test case generation system based on a standard statement library. This system is used to execute the methods described in the above embodiment. The system specifically includes the following modules: The format definition module defines the node hierarchy and content format of the mind map to establish a mapping relationship between requirements and test cases. Specifically, it specifies that the root node corresponds to the test module, the first-level nodes correspond to the test function points, and the child nodes are divided into preconditions, test steps, and expected results in sequence. It also pre-defines keyword tags for the nodes, so that the node content corresponds to the test attributes, functions, test environment, test level, requirement ID, creator, and other fields of the actual test cases.

[0033] Standard Statement Library Storage Module: Used to build and store the standard statement library (LIB library). This standard statement library encapsulates reusable functional units in the automated testing framework and stores them in the form of entries. Entries are categorized into precondition classes, test action classes, and assertion logic classes: precondition classes encapsulate common statements such as environment initialization, interface pre-requests, and state presetting; test action classes encapsulate common operations such as torque commands, speed commands, status commands, and diagnostic commands; assertion logic classes encapsulate standard logic statements such as result comparison, status judgment, and exception handling. Each entry is configured with a name, description tag, parameter format, and calling rules to ensure that the concatenated scripts are directly compatible with the target automated testing framework.

[0034] Mind Mapping Module: Used to obtain the decomposed software requirements and create mind maps according to the node hierarchy and content format specified by the format definition module. This module has built-in fuzzy search and recommendation functions, which can match relevant entries in the standard statement library based on user input and display recommendations.

[0035] The Association Module: When creating a mind map, it responds to the user's selection and inserts items from the standard statement library into the current node with one click to achieve association, and automatically marks parameter placeholders for filling.

[0036] The parsing module is used to parse the mind map and generate test assets after it has been saved and validated. The parsing module traverses the nodes of the mind map, obtains the node content and its associated standard statement library entries, and fills the entry content and its parameters into a preset automated test script template according to the node hierarchy. This process generates an executable automated test case script that conforms to the syntax requirements of the automated testing framework. Simultaneously, the parsing module also generates structured manual test case documents. The document fields strictly correspond one-to-one with the test steps, including full information such as test case number, title, preconditions, execution steps, expected results, and priority.

[0037] During the generation process, the parsing module also automatically embeds a unique traceability identifier for all outputs and binds the unique traceability identifier to the hash value of the original mind map to establish a two-way traceability relationship from requirements to test assets.

[0038] In specific workflows, such as Figure 2 As shown in the diagram, this is a typical format definition illustration. First, the format definition module sets the mind map format specifications, and the standard statement library storage module initializes and stores entries in the LIB library. After obtaining the decomposed software requirements, the user creates a mind map using the mind map writing module. During the writing process, the association module retrieves and inserts LIB library entries in real time. When the mind map is saved, the system automatically performs format validation. Upon successful validation, the parsing module is triggered to perform parsing and conversion, ultimately outputting both manual test case documents and executable automated test case scripts simultaneously.

[0039] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention. The scope of the invention is defined by the appended claims and their equivalents, all of which should be included within the scope of protection of the invention.

Claims

1. A method for generating automated test cases based on a standard statement library, characterized in that, Includes the following steps: Define the node hierarchy and content format of the mind map to establish a mapping relationship between requirements and test cases; Obtain the decomposed software requirements and create a mind map based on the node hierarchy and content format; The mind map is analyzed to identify the semantic and hierarchical relationships of each node and generate a structured manual test case document. A standard statement library is constructed, which encapsulates reusable functional units in the automated testing framework and stores them in the form of entries. When creating a mind map, the nodes of the mind map are associated with the entries in the standard statement library; When parsing the mind map, the entries in the standard statement library associated with the nodes are identified, and the contents of the entries are automatically concatenated according to preset conversion rules to generate an executable automated test case script that conforms to the syntax requirements of the automated testing framework.

2. The automated test case generation method based on a standard statement library according to claim 1, characterized in that, The entries in the standard statement library are classified into preconditions, test actions, and assertion logic. Among them, the precondition class encapsulates environment initialization and state preset statements, the test action class encapsulates instruction operation statements, and the assertion logic class encapsulates result comparison and state judgment statements; Each entry is configured with parameter format and calling rules to ensure that the concatenated script is directly compatible with the automated testing framework.

3. The automated test case generation method based on a standard statement library according to claim 2, characterized in that, Each entry is also configured with a name and description tag for fuzzy search matching when creating a mind map.

4. The automated test case generation method based on a standard statement library according to claim 1, characterized in that, The definition of the node hierarchy and content format of the mind map includes: The system specifies that the root node corresponds to the test module, the first-level nodes correspond to the test function points, and the child nodes are divided into preconditions, test steps, and expected results in sequence. It also pre-defines keyword tags for the nodes, so that the node content corresponds to the test attributes, test environment, test level, and requirement identification fields of the actual test cases.

5. The automated test case generation method based on a standard statement library according to claim 4, characterized in that, The preset keyword tags include keywords used to identify the test step type and the expected result type, so that the corresponding standard statement library entries can be identified and called according to the keywords during parsing.

6. The automated test case generation method based on a standard statement library according to claim 1, characterized in that, The process of parsing the mind map and generating executable automated test case scripts includes: Traverse the nodes of the mind map to obtain the node content and its associated standard statement library entries; According to the node hierarchy, the obtained item content and its parameters are filled into the preset automated test script template and assembled to form an automated test case with step logic.

7. The automated test case generation method based on a standard statement library according to claim 1, characterized in that, The process of creating a mind map also includes: Perform a fuzzy search based on the characters entered by the user, match entries related to the characters in the standard statement library, and display recommendations. In response to the user's selection, the selected item is inserted into the current node with one click, and parameter placeholders are automatically marked for filling.

8. The automated test case generation method based on a standard statement library according to claim 1, characterized in that, When the mind map is saved, it also includes: Automatically verify whether the saved mind map meets at least one of the following criteria: root node type, node naming conventions, keyword tag completeness, and the validity of the associated standard statement library entries; The parsing and automatic generation process will only begin after the verification is passed.

9. The automated test case generation method based on a standard statement library according to claim 1, characterized in that, Step S, in generating the manual test case document and the automated test case script, further includes: A unique traceability identifier is automatically embedded in the generated documents and scripts, and the unique traceability identifier is bound to the hash value of the original mind map to establish a two-way traceability relationship from requirements to test assets.

10. An automatic generation system for requirements maps to automated use cases based on a standard statement library, characterized in that, include: The format definition module is used to define the node hierarchy and content format of the mind map in order to establish the mapping relationship between requirements and test cases; The mind map writing module is used to obtain the decomposed software requirements and write mind maps according to the node hierarchy and content format. The parsing module is used to parse the mind map, identify the semantic and hierarchical relationships of each node, and generate a structured manual test case document. A standard statement library storage module is used to build and store a standard statement library, which encapsulates reusable functional units in the automated testing framework and stores them in the form of entries. The association module is used to associate the nodes of the mind map with the entries in the standard statement library when creating the mind map; The parsing module is also used to identify the entries in the standard statement library associated with the node, and automatically concatenate the contents of the entries according to the preset conversion rules to generate an executable automated test case script that conforms to the syntax requirements of the automated testing framework.

Citation Information

Patent Citations

  • Method for converting test case based on Xmind mind map

    CN113094288A

  • Automatic test case management method and device, equipment and storage medium

    CN119473885A

  • Automatic test case optimization design method of automobile controller and storage medium

    CN121743189A