Test case automatic generation method and device, equipment and storage medium

By obtaining and analyzing the path code of the business flow chart, test cases are automatically generated, which solves the problem of low-efficiency test case generation caused by differences in recording habits, and achieves more efficient test case generation.

CN120162264APending Publication Date: 2025-06-17BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510305437.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-14
Publication Date
2025-06-17

AI Technical Summary

Technical Problem

In the prior art, due to differences in recording habits among recorders, the format and details of the business documents are inconsistent, which in turn reduces the efficiency of the generation of test cases.

Method used

By obtaining the business flowchart and determining its corresponding target code, analyzing the path code of each path, generating the corresponding target test sub-use cases, thereby automatically generating the test cases.

Benefits of technology

It avoids the adverse effects of personal recording habits on business data, saves testers the time and energy to read business data, and improves the efficiency of test cases generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120162264A_ABST
    Figure CN120162264A_ABST
Patent Text Reader

Abstract

The invention relates to a test case automatic generation method and device, equipment and a storage medium, and the method comprises the steps: obtaining a business flow chart which is obtained according to a target business; determining a target code corresponding to the business flow chart; analyzing the target code, and determining a path code corresponding to each path in the business flow chart; and according to the path code corresponding to each path, generating a corresponding target test sub-case for each path, and obtaining a target test case corresponding to the target service. According to the method, the adverse effect of personal recording habits on the business data can be avoided, the time and energy of reading the business data by testers are saved, and the generation efficiency of the test case is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and particularly to a method, device, equipment, and storage medium for automatically generating test cases. Background Art

[0002] Over time, technology and business environments continue to evolve. In the current existing technology system, the recording of project business data is mainly undertaken by recorders, who record relevant content in text form in documents such as Feishu documents, Wiki documents, etc., thus forming business documents. Subsequently, testers carry out corresponding test case writing work based on these business documents.

[0003] However, in the actual operation process, due to significant differences in the recording habits of each person, the formats and levels of detail of business documents vary. Therefore, when testers write test cases based on these business documents, they will spend a lot of time and energy reading the business documents, thus reducing the generation efficiency of test cases. Summary of the Invention

[0004] This application provides a method, device, equipment, and storage medium for automatically generating test cases. This method avoids the adverse effects of personal recording habits on business data, saves the time and energy of testers in reading business data, and improves the generation efficiency of test cases.

[0005] In a first aspect, this application provides a method for automatically generating test cases, the method including:

[0006] Obtain a business process diagram, where the business process diagram is obtained according to the target business;

[0007] Determine the target code corresponding to the business process diagram;

[0008] Analyze the target code to determine the path code corresponding to each path in the business process diagram;

[0009] Generate a corresponding target test sub-case for each path according to the path code corresponding to each path, to obtain the target test case corresponding to the target business.

[0010] Optionally, the analyzing the target code to determine the path code corresponding to each path in the business process diagram includes:

[0011] Obtain a pre-trained code analysis model;

[0012] Input the target code into the pre-trained code analysis model to obtain the path code corresponding to each path in the business process diagram.

[0013] Optionally, analyzing the target code to determine the path code corresponding to each path in the service flow chart includes:

[0014] Analyzing the target code to determine the target node code in the target code;

[0015] Based on the target node code and the target code, obtaining the path code corresponding to each path.

[0016] Optionally, generating a corresponding test case for each path according to the path code corresponding to each analysis includes:

[0017] Obtaining the test data corresponding to each path;

[0018] For each path, based on the test data corresponding to the path, executing the corresponding path code to obtain the test case corresponding to each path.

[0019] Optionally, the method further includes:

[0020] Receiving a modification instruction for the service flow chart, where the modification instruction includes the modified service flow chart;

[0021] Generating a reference test case according to the modified service flow chart;

[0022] Updating the target test case according to the reference test case.

[0023] Optionally, the method further includes:

[0024] Determining the node modified by the user according to the modification instruction;

[0025] When the modified node is the main node, comparing the reference test case and the target test case to obtain the different part, and using the different part to update the target test case;

[0026] When the modified node is a branch node, obtaining the target path where the branch node is located, and updating the target test sub-case corresponding to the target path according to the reference test sub-case corresponding to the target path.

[0027] Optionally, the method further includes:

[0028] Detecting whether the service flow chart meets the preset conditions;

[0029] When the service flow chart does not meet the preset conditions, obtaining the target data that does not meet the preset conditions, and generating a warning notification according to the target data to warn the user that the target data does not meet the preset conditions.

[0030] Second aspect, the present application provides a device for automatically generating test cases, the device comprising:

[0031] An acquisition unit, configured to acquire a service flow chart, where the service flow chart is obtained according to a target service;

[0032] A determination unit, configured to determine a target code corresponding to the service flow chart;

[0033] An analysis unit, configured to analyze the target code to determine a path code corresponding to each path in the service flow chart;

[0034] A generation unit, configured to generate a corresponding target test sub-case for each path according to the path code corresponding to each path, to obtain a target test case corresponding to the target service.

[0035] Optionally, the analysis unit is configured to:

[0036] Acquire a pre-trained code analysis model;

[0037] Input the target code into the pre-trained code analysis model to obtain a path code corresponding to each path in the service flow chart.

[0038] Optionally, the analysis unit is configured to:

[0039] Analyze the target code to determine a target node code in the target code;

[0040] According to the target node code and the target code, obtain a path code corresponding to each path.

[0041] Optionally, the generation unit is configured to:

[0042] Acquire test data corresponding to each path;

[0043] For each path, execute the corresponding path code based on the test data corresponding to the path to obtain a test case corresponding to each path.

[0044] Optionally, the device further comprises a first modification unit, and the first modification unit is configured to:

[0045] Receive a modification instruction for the service flow chart, where the modification instruction includes a modified service flow chart;

[0046] Generate a reference test case according to the modified service flow chart;

[0047] Update the target test case according to the reference test case.

[0048] Optionally, the device further includes a second modification unit, configured to:

[0049] Determine the node modified by the user according to the modification instruction;

[0050] When the modified node is the main node, compare the reference test case and the target test case to obtain the different part, and use the different part to update the target test case;

[0051] When the modified node is a branch node, obtain the target path where the branch node is located, and update the target test sub-case corresponding to the target path according to the reference test sub-case corresponding to the target path.

[0052] Optionally, the device further includes a detection unit, configured to:

[0053] Detect whether the business process diagram meets a preset condition;

[0054] When the business process diagram does not meet the preset condition, obtain the target data that does not meet the preset condition, and generate a warning notification according to the target data to warn the user that the target data does not meet the preset condition.

[0055] In a third aspect, the present application provides a test case automatic generation device, including: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus, wherein the processor is configured to:

[0056] Obtain a business process diagram, which is obtained according to a target business;

[0057] Determine the target code corresponding to the business process diagram;

[0058] Analyze the target code to determine the path code corresponding to each path in the business process diagram;

[0059] Generate a corresponding target test sub-case for each path according to the path code corresponding to each path, and obtain the target test case corresponding to the target business.

[0060] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned test case automatic generation method is implemented.

[0061] The above technical solutions provided by the embodiments of the present application have the following advantages compared with the prior art:

[0062] In an embodiment of the present application, a business process diagram is obtained. The business process diagram is obtained according to a target business, and the target code corresponding to the business process diagram is determined. Then, the target code is analyzed to determine the path code corresponding to each path in the business process diagram. Finally, according to the path code corresponding to each path, a corresponding target test sub-use case is generated for each path, and the target test case corresponding to the business process diagram is obtained. By writing business data into the business process diagram, the advantages of the business process diagram in intuitively presenting business process steps, decision points, process directions, and the relationships of each participating party are exerted, the adverse effects of personal recording habits on business data are avoided, the time and energy of testers for reading business data are saved, and the generation efficiency of test cases is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present invention and used together with the specification to explain the principles of the present invention.

[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can be obtained according to these drawings without creative efforts.

[0065] One or more embodiments are exemplarily illustrated by the pictures in the corresponding accompanying drawings. These exemplary illustrations do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements. Unless otherwise stated, the drawings in the figures do not constitute a proportional limitation.

[0066] Figure 1 A schematic flowchart of a method for automatically generating test cases provided for an embodiment of the present application;

[0067] Figure 2 A schematic diagram of a reference picture provided for an embodiment of the present application;

[0068] Figure 3 A schematic flowchart of a method for marking a marking box provided for an embodiment of the present application;

[0069] Figure 4 A schematic flowchart of a method for determining target materials provided for an embodiment of the present application;

[0070] Figure 5 A schematic flowchart of another method for modifying a marking box provided for an embodiment of the present application;

[0071] Figure 6 A schematic flowchart of a method for generating a reference picture provided for an embodiment of the present application;

[0072] Figure 7 A schematic flowchart of yet another relationship creation method provided by an embodiment of the present application;

[0073] Figure 8 A schematic diagram of a test case automatic generation method provided by an embodiment of the present application;

[0074] Figure 9 A schematic diagram of yet another test case automatic generation method provided by an embodiment of the present application;

[0075] Figure 10 A schematic flowchart of a test case automatic generation device provided by an embodiment of the present application;

[0076] Figure 11 A schematic diagram of a test case automatic generation device provided by an embodiment of the present application. Detailed implementation manners

[0077] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.

[0078] The following disclosure provides many different embodiments or examples for implementing different structures of the present invention. To simplify the disclosure of the present invention, components and settings of specific examples are described below. Of course, they are only examples and are not intended to limit the present invention. In addition, the present invention may repeat reference numerals and / or letters in different examples. Such repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0079] Over time, the technology and business environment continue to evolve. In the current existing technology system, the recording work of project business data is mainly undertaken by recorders, who will record relevant content in text form in documents such as Feishu documents and Wiki documents, thereby forming business documents. Subsequently, testers carry out corresponding test case writing work based on these business documents. However, in the actual operation process, due to significant differences in the recording habits of each person, the formats and levels of detail of business documents vary. Therefore, when testers write test cases based on these business documents, they will spend a lot of time and effort reading the business documents, thereby reducing the generation efficiency of test cases.

[0080] To solve the above problems, an embodiment of the present application provides a method for automatically generating test cases. This method avoids the adverse effects of personal recording habits on business data, saves the time and effort of testers in reading business data, and improves the efficiency of generating test cases. As Figure 1 shown, the specific steps include:

[0081] Step 101, obtain a business process diagram.

[0082] Among them, the business process diagram is obtained according to the target business. For example, a technician can determine the business process according to the target business, and then draw the corresponding business process diagram in BPMN according to the business process, so as to generate the target use case corresponding to the target business according to the business process diagram subsequently.

[0083] Among them, BPMN (Business Process Model and Notation), using its standardized and graphical characteristics, is used as a basic method for accumulating business knowledge, and a complete system is developed. Users can organize their business process knowledge by business line and meet daily management needs by customizing file levels and file permissions.

[0084] Step 102, determine the target code corresponding to the business process diagram.

[0085] In this step, the underlying code corresponding to the business process diagram can be obtained in BPMN, and then the underlying code is determined as the target code. Or, manually write the target code corresponding to the business process diagram. Or analyze each node and the association relationship between each node in the business process diagram, and then automatically generate the corresponding target code according to each node and the association relationship. Other methods can also be used to determine the target code in this step, which is not limited here.

[0086] Step 103, determine the path code corresponding to each path in the business process diagram according to the target code.

[0087] Among them, the path code is the code corresponding to a certain path, and this path includes the content of the starting node, the content of all nodes in a certain process between the starting node and the ending node, and the content of the ending node. A business process diagram is provided in this step, such as Figure 2As shown, the business process flowchart includes 7 paths, namely Check Request - Check the capabilities running for the same customer - Engine Database, Check Request - Check the capabilities running for the same customer - Perform Credit Check - Check the instances in the waiting state for the same customer - Engine Database, Check Request - Check the capabilities running for the same customer - Perform Credit Check - Check the instances in the waiting state for the same customer - Check the instances in the waiting state for the same customer - Credit Check Completed, Check Request - Check the capabilities running for the same customer - Perform Credit Check - Check the instances in the waiting state for the same customer - Check the instances in the waiting state for the same customer - Notify the waiting instances, Check Request - Check the capabilities running for the same customer - Run Instance - Perform Credit Check - Check the instances in the waiting state for the same customer - Engine Database, Check Request - Check the capabilities running for the same customer - Run Instance - Perform Credit Check - Check the instances in the waiting state for the same customer - Check the instances in the waiting state for the same customer - Credit Check Completed, Check Request - Check the capabilities running for the same customer - Run Instance - Perform Credit Check - Check the instances in the waiting state for the same customer - Check the instances in the waiting state for the same customer - Notify the waiting instances.

[0088] In this step, a pre-trained code analysis model can be used to analyze the target code to obtain the path code corresponding to each path. Alternatively, conditional judgment statements corresponding to the decision nodes in the business process flowchart can be found in the code. After this conditional judgment statement is the branch. In this way, the target code can be divided and combined according to the conditional judgment statements in the business process flowchart to obtain the path code corresponding to each path.

[0089] Step 104, according to the path code corresponding to each path, generate the corresponding target test sub-cases for each path to obtain the target test cases for the target business.

[0090] Among them, test cases generally include test case number, test case name, test steps, expected results, actual results, test status, etc. The test case name is generally its corresponding path.

[0091] In this step, when generating the target test sub-cases for a certain path, the path test data required for this path needs to be obtained first. Then, use this path test data to run the path code corresponding to this path, and then obtain the target test sub-cases corresponding to this path. After that, after obtaining the target test sub-cases corresponding to all paths, these target test sub-cases will form the target test cases for the target business.

[0092] In an embodiment of the present application, a business process diagram is obtained. The business process diagram is obtained according to a target business, and the target code corresponding to the business process diagram is determined. Then, the target code is analyzed to determine the path code corresponding to each path in the business process diagram. Finally, according to the path code corresponding to each path, a corresponding target test sub-use case is generated for each path, and the target test case corresponding to the target business is obtained. By writing business data into the business process diagram, the advantages of the business process diagram in intuitively presenting business process steps, decision points, process directions, and the relationships of all participating parties are exerted, avoiding the adverse effects of personal recording habits on business data, saving the time and energy of testers in reading business data, and improving the generation efficiency of test cases.

[0093] In the implementation of the present application, a pre-trained code analysis model can also be called, and this model is used to analyze the target code to obtain the path code corresponding to each path in the business process diagram. Therefore, the embodiment of the present application provides a method for determining path code, which is a further limitation on step 103, as Figure 3 shown, including:

[0094] Step 301, obtain a pre-trained code analysis model.

[0095] In the process of training the code analysis model, a large number of training samples also need to be obtained first. These training samples correspond to different flowcharts, including the total code corresponding to these flowcharts, each path in the flowchart, and its corresponding path code. This path code can be determined by technicians according to experience in the total code. Then, these training samples are used to train the code analysis model to obtain a pre-trained code analysis model.

[0096] Step 302, input the target code into the pre-trained code analysis model to obtain the path code corresponding to each path in the business process diagram.

[0097] In this step, the target code is input into the pre-trained code analysis model so that the pre-trained code analysis model analyzes the target code and outputs the path code corresponding to each path.

[0098] In an embodiment of the present application, when generating test cases, the test data corresponding to each path also needs to be obtained first, and then the test data corresponding to each path is used to execute the corresponding path code to obtain the test case corresponding to each path. Therefore, the embodiment of the present application provides a method for generating test cases, which is a further limitation on step 104, as Figure 3 shown, and the specific steps include:

[0099] Step 401, obtain the test data corresponding to each path.

[0100] Among them, the test data is the data necessary for the execution of the corresponding path, which is set by technicians for each path according to actual needs, and specifically includes preconditions, test environment configuration data, such as login, password, etc. This test data also includes verification points, marked data, etc., which are not limited here.

[0101] Step 402: For each path, based on the test data corresponding to the path, execute the corresponding path code to obtain the test case corresponding to each path.

[0102] In this step, for each path, configure the test environment based on the test data corresponding to the path. After the configuration is completed, use other data in the test data to execute the corresponding path code in this test environment to obtain the test case corresponding to each path.

[0103] In the embodiment of the present application, when the target service changes, technicians can also modify the service flow chart. After that, since the service flow chart is modified, the corresponding target test case also changes. Therefore, it is also necessary to update the target test case to avoid inaccurate test cases and the inability to detect defects in the target service, thereby affecting the operation of the target service. Therefore, the embodiment of the present application provides a test case update method, and the method is as Figure 5 shown, and the specific steps include:

[0104] Step 501: Obtain the modification instruction of the service flow chart.

[0105] Among them, the modification instruction includes the modified service flow chart. The modification instruction is generated when modifying nodes and their corresponding association relationships in the service flow chart. For example, the modification instruction is generated when adding new nodes and their corresponding association relationships in the service flow chart, or it can also be generated when deleting old nodes and their corresponding association relationships in the service flow chart.

[0106] In this step, when the user modifies the service flow chart, generate a modification instruction according to the modified service flow chart so that the current device can obtain the modification instruction of the service flow chart.

[0107] Step 502: Generate reference test cases according to the modified service flow chart.

[0108] In this step, obtain the service flow chart in the modification instruction, and then, according to Figure 1 the method, generate reference test cases according to the service flow chart in the modification instruction.

[0109] Step 503: Update the target test cases according to the reference test cases.

[0110] In this step, the reference test cases include reference test sub-cases corresponding to multiple paths, and the target test cases also include target test sub-cases corresponding to multiple paths. Then, the target test sub-cases and reference test sub-cases corresponding to the same path are determined. For each path, the two sub-cases corresponding to the path are compared. When they match, there is no need to update the target test sub-case. When they do not match, it may be necessary to update the target test sub-case according to the reference test sub-case.

[0111] It should be noted that the name of each sub-case is generated according to the corresponding path. Therefore, in this step, the reference test sub-case and the target test sub-case with the same name can be found and determined as the reference test sub-case and the target test sub-case corresponding to the same path.

[0112] In the embodiment of the present application, the business flow chart includes a main node and branch nodes. The main node is a node on the main branch, and the main branch represents the most core and common execution path in the business process, without involving the directions after special condition judgments. For example, Figure 2 the check request node and the check of the running instances of the same customer in [] are the content of the main node, and the corresponding node is the main node. The branch node is a node on the branch, and the branch is the different directions generated at a certain decision node in the process. The decision node is a point for making judgments according to specific conditions. According to the judgment result, the process will continue to execute in different directions. For example Figure 2 the running instance and the execution of credit check in [] are the content of the branch node, and the corresponding node is the branch node.

[0113] Furthermore, when the user modifies the main node in the business flow chart, since the main node is related to all target test sub-cases, all target test sub-cases need to be modified. When the user modifies the branch node in the business flow chart, since the branch node is only on certain paths, only the target test sub-cases corresponding to these paths need to be modified. Therefore, the embodiment of the present application provides a use case modification method, and the method is as Figure 6 shown, and the specific steps include:

[0114] Step 601, according to the modification instruction, determine the node modified by the user.

[0115] In this step, obtain the business flow chart in the modification instruction. Then, image recognition technology can be used to compare the business flow chart before modification and the business flow chart after modification to determine the node modified by the user. Or after obtaining the business flow chart in the modification instruction, first generate its corresponding code, and then compare the codes corresponding to the two charts, determine the different codes, analyze the codes to determine the content modified by the user, and determine the node corresponding to the content as the node modified by the user.

[0116] Step 602, when the modified node is the main node, compare the reference test case and the target test case to obtain the different parts, and use the different parts to update the target test case.

[0117] In this step, when the modified node is the main node, obtain all the sub-test cases in the reference test case and the target test case, compare the sub-test cases with the same corresponding paths, obtain the different parts, and use the different parts to update the target test case.

[0118] Step 603, when the modified node is a branch node, obtain the target path where the branch node is located, and update the target test sub-case corresponding to the target path according to the reference test sub-case corresponding to the target path.

[0119] In this step, when the modified node is a branch node, the content included in the branch node can be determined, and the path where the content is located is determined as the target path. Then, compare the reference test sub-case corresponding to the target path with the target test sub-case, obtain the different parts, and update the target test sub-case corresponding to the target path according to the different parts.

[0120] In addition, after obtaining the modified node, it can also be determined whether the modified node is an existing node. When the modified node is an existing node, execute Step 602 or Step 603. When the modified node is not an existing node, it means that the user has added a new branch. In this case, only a new path needs to be generated according to the branch, and then a new target test sub-case is generated according to the path.

[0121] In the embodiment of the present application, relevant data such as each node in the business process diagram and the association relationship between nodes can also be obtained, and it is detected whether these data meet the preset conditions to determine whether the business process diagram meets the preset conditions. When the business process diagram does not meet the preset conditions, obtain the data that does not meet the preset conditions, and generate a warning notification according to the data to warn the user that the data does not meet the preset conditions. Therefore, the embodiment of the present application provides a data checking method, and the method is as Figure 7 shown, and the specific steps include:

[0122] Step 701, detect whether the business process diagram meets the preset conditions.

[0123] Among them, the preset conditions can be whether each node in the business process diagram is standard. For example, the preset condition is whether the symbol of each node is consistent with the standard definition, or it can also be detected whether the association relationship in the business process diagram is reasonable. For example, detect whether there are unreasonable loops and deadlock situations in the business process diagram. Or, the preset condition can also be whether the node annotation of each node is simple and clear.

[0124] Step 702, when the business process diagram does not meet the preset conditions, obtain the target data that does not meet the preset conditions, and generate a warning notice based on the target data to warn the user that the target data does not meet the preset conditions.

[0125] Among them, the data is the data processing unit in the business process diagram, which can be information such as the symbols, annotations, and association relationships between nodes of each node.

[0126] In this step, when the business process diagram does not meet the preset conditions, obtain the data that does not meet the preset conditions, and determine this node as the target data. Then, generate a warning notice based on the target data and display the warning notice, thereby warning the user that the target data does not meet the preset conditions so that the user can modify the target data.

[0127] In the embodiment of the present application, the target code can also be analyzed to determine the path code corresponding to each path in the business process diagram. The specific steps are as follows: analyze the target code to determine the target node code in the target code; obtain the path code corresponding to each path based on the target node code and the target code.

[0128] Among them, the target node is a decision node, and the target node code is the code corresponding to the decision node.

[0129] In the flowchart, each node is presented in a specific graphical form, and each graph is associated with a type name. In this way, it is possible to determine whether a node belongs to a decision node based on the type name associated with the node. During the code parsing process, it is necessary to find the type name corresponding to the decision node. When the parsed statement fragment contains this type name, it can be determined that this statement is the conditional judgment statement of the corresponding decision node, that is, the target node code. Based on the same principle, the target node codes of all decision nodes can be obtained, and all combinations of these target node codes can be generated. For these combinations, determine the starting position of the target code according to the predefined rules, and extract the corresponding code fragments according to the established code structure and logical relationship, so as to obtain the corresponding path code.

[0130] Such as Figure 8As shown in the figure, an embodiment of the present application provides a schematic diagram of a method for automatically generating test cases. The specific steps of this figure include: First, extract business knowledge and establish a flowchart model based on this business knowledge to obtain a business flowchart. Then, disassemble the business flowchart to obtain multiple process branches, that is, multiple paths. Next, for each path, obtain the path code corresponding to this path and detect whether this path has been modified by the user. If not, it means that the path code is the code stored for the first time, which is the full - volume code. Furthermore, based on this full - volume code, generate full - volume test cases. If it has been modified by the user, it means that the path code is not the code stored for the first time, which is the differential code. In this way, generate incremental test cases based on it and modify the previously stored test cases based on the incremental test cases to obtain differential test cases.

[0131] As Figure 9 shown, the business flowcharts involved in the present application are stored in the knowledge base trunk. When a certain user needs to modify the knowledge base trunk, a knowledge base branch will be created. In this way, when multiple users need to modify it, multiple knowledge base branches can be established. Then, this user can modify the knowledge base branch, and then generate a corresponding test case library branch. Next, obtain all current test case library branches and merge these branches to obtain the test case library trunk.

[0132] At the same time, it is also possible to update the knowledge base trunk based on all the knowledge base branches to obtain a new knowledge base trunk. When generating the test case library branch, the existing test cases in the test case library main branch can also be reused. Furthermore, based on the knowledge base branch, generate differential test cases, and use the differential test cases and the existing test cases to generate the test case library branch.

[0133] As Figure 10 shown, an embodiment of the present application provides a device for automatically generating test cases. This device corresponds to the method embodiment and specifically includes:

[0134] An acquisition unit 1001, configured to acquire a business flowchart, where the business flowchart is obtained according to the target business;

[0135] A determination unit 1002, configured to determine the target code corresponding to the business flowchart;

[0136] An analysis unit 1003, configured to analyze the target code to determine the path code corresponding to each path in the business flowchart;

[0137] A generation unit 1004, configured to generate a corresponding target test sub - case for each path according to the path code corresponding to each path, to obtain the target test cases corresponding to the target business.

[0138] Optionally, the analysis unit 1003 is configured to:

[0139] Obtain a pre-trained code analysis model;

[0140] Input the target code into the pre-trained code analysis model to obtain the path code corresponding to each path in the business process diagram.

[0141] Optionally, the analysis unit 1003 is configured to:

[0142] Analyze the target code to determine the target node code in the target code;

[0143] Based on the target node code and the target code, obtain the path code corresponding to each path.

[0144] Optionally, the generation unit 1004 is configured to:

[0145] Obtain the test data corresponding to each path;

[0146] For each path, execute the corresponding path code based on the test data corresponding to the path to obtain the test case corresponding to each path.

[0147] Optionally, the device further includes a first modification unit 1005, and the first modification unit 1005 is configured to:

[0148] Receive a modification instruction for the business process diagram, where the modification instruction includes the modified business process diagram;

[0149] Generate a reference test case according to the modified business process diagram;

[0150] Update the target test case according to the reference test case.

[0151] Optionally, the device further includes a second modification unit 1006, and the second modification unit 1006 is configured to:

[0152] Determine the node modified by the user according to the modification instruction;

[0153] When the modified node is the main node, compare the reference test case and the target test case to obtain the different part, and use the different part to update the target test case;

[0154] When the modified node is a branch node, obtain the target path where the branch node is located, and update the target test sub-case corresponding to the target path according to the reference test sub-case corresponding to the target path.

[0155] Optionally, the device further includes a detection unit 1007, and the detection unit 1007 is configured to:

[0156] Check whether the business process diagram meets the preset conditions;

[0157] When the business process diagram does not meet the preset conditions, obtain the target data that does not meet the preset conditions, and generate a warning notification based on the target data to warn the user that the target data does not meet the preset conditions.

[0158] As Figure 11 As shown, an embodiment of the present application provides a test case automatic generation device, including a processor 1101, a communication interface 1102, a memory 1103, and a communication bus 1104. Among them, the processor 1101, the communication interface 1102, and the memory 1103 complete mutual communication through the communication bus 1104.

[0159] The memory 1103 is used to store computer programs;

[0160] In an embodiment of the present application, when the processor 1101 is used to execute the program stored on the memory 1103, it implements the test case automatic generation method provided by any one of the foregoing method embodiments, including:

[0161] Obtain a business process diagram, where the business process diagram is obtained according to the target business;

[0162] Determine the target code corresponding to the business process diagram;

[0163] Analyze the target code to determine the path code corresponding to each path in the business process diagram;

[0164] Generate a corresponding target test sub-case for each path according to the path code corresponding to each path, and obtain the target test case corresponding to the target business.

[0165] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the steps executed by the test case automatic generation method provided by any one of the foregoing method embodiments.

[0166] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0167] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution or the part that contributes to the related technology can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0168] It should be understood that the terms used herein are for the purpose of describing specific example embodiments only and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" as used herein may also include the plural forms. The terms "comprising", "including", "containing", and "having" are inclusive and thus specify the presence of the stated features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or their combinations. The method steps, processes, and operations described herein are not to be construed as necessarily requiring them to be performed in the particular order described or illustrated, unless the order of performance is explicitly stated. It should also be understood that additional or alternative steps may be used.

[0169] The above are only specific embodiments of the present invention, enabling those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but rather will be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for automatically generating test cases, characterized in that: The method comprises: Obtaining a business process diagram, wherein the business process diagram is obtained according to the target business; Determine the target code corresponding to the business process diagram; Analyze the target code to determine the path code corresponding to each path in the business process diagram; According to the path code corresponding to each path, a corresponding target test sub-case is generated for each path to obtain a target test case corresponding to the target business.

2. The method according to claim 1, characterized in that: The analyzing the target code to determine the path code corresponding to each path in the business process diagram includes: Get pre-trained code analysis models; The target code is input into a pre-trained code analysis model to obtain a path code corresponding to each path in the business process diagram.

3. The method according to claim 1, characterized in that: The analyzing the target code to determine the path code corresponding to each path in the business process diagram includes: Analyzing the target code to determine the target node code in the target code; A path code corresponding to each path is obtained according to the target node code and the target code.

4. The method according to claim 1, characterized in that: The step of generating a corresponding test case for each path according to the path code corresponding to each analysis includes: Get the test data corresponding to each path; For each path, based on the test data corresponding to the path, the corresponding path code is executed to obtain the test case corresponding to each path.

5. The method according to claim 1, characterized in that: The method further comprises: receiving a modification instruction of the business process diagram, wherein the modification instruction includes a modified business process diagram; Generate reference test cases based on the modified business process diagram; The target test case is updated according to the reference test case.

6. The method according to claim 5, characterized in that: The method further comprises: Determine the node modified by the user according to the modification instruction; When the modified node is the master node, the reference test case and the target test case are compared to obtain a difference, and the target test case is updated using the difference; When the modified node is a branch node, the target path where the branch node is located is obtained, and the target test sub-case corresponding to the target path is updated according to the reference test sub-case corresponding to the target path.

7. The method according to claim 1, characterized in that: The method further comprises: Detecting whether the business process diagram meets preset conditions; When the business process diagram does not meet the preset conditions, target data that does not meet the preset conditions is obtained, and a warning notification is generated according to the target data to warn the user that the target data does not meet the preset conditions.

8. A test case automatic generation device, characterized in that: The device comprises: An acquisition unit, used to acquire a business process diagram, wherein the business process diagram is obtained according to a target business; A determination unit, used to determine the target code corresponding to the business process diagram; An analysis unit, used to analyze the target code to determine a path code corresponding to each path in the business process diagram; The generating unit is used to generate a corresponding target test sub-case for each path according to the path code corresponding to each path, so as to obtain a target test case corresponding to the target business.

9. A test case automatic generation device, characterized in that: include: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus, wherein the processor is configured to: Obtaining a business process diagram, wherein the business process diagram is obtained according to the target business; Determine the target code corresponding to the business process diagram; Analyze the target code to determine the path code corresponding to each path in the business process diagram; According to the path code corresponding to each path, a corresponding target test sub-case is generated for each path to obtain a target test case corresponding to the target business.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the test case automatic generation method according to any one of claims 1 to 7 is implemented.