Method, device, system, and medium for generating test cases

By automatically generating test cases, the problems of low design efficiency and insufficient coverage in the existing technology are solved, and logical coverage and efficiency improvement are achieved.

CN113760732BActive Publication Date: 2024-11-15BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110132785.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-29
Publication Date
2024-11-15
Estimated Expiration
2041-01-29

AI Technical Summary

Technical Problem

In the prior art, software test case design requires manual review and communication, which is inefficient and difficult to cover all logical situations, resulting in low test coverage.

Method used

By obtaining the logical node information in the project flowchart, test case data that meets and does not meet the logical conditions are automatically generated, and marked on the output data flow to form a visual flow chart containing the data flow direction.

Benefits of technology

It realizes test case generation that covers almost all logic, improves testing efficiency, and makes the test cases clear and dependable in combination with project flowcharts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760732B_ABST
    Figure CN113760732B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, device, system, and medium for generating test cases. The method includes first obtaining a first project flowchart, the first project flowchart includes at least one logical node, wherein the logical node is used to judge the input data according to the logical conditions of the logical node and determine the flow direction of the output data. Then, the logical nodes in the first project flowchart are traversed to obtain a second project flowchart including test case information. The traversal process specifically generates, for each logical node, a first type of test case data that meets the logical conditions of the logical node, and generates a second type of test case data that does not meet the logical conditions of the logical node, and then marks the first type of test case data on the first output data stream where the logical node is successfully executed, and marks the second type of test case data on the second output data stream where the logical node fails to execute.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Internet information security technology, and more specifically, to a method, device, system, and medium for generating a test case. Background Art

[0002] At present, the development process of software products usually designs a project flowchart in the PRD product requirement document, and then sorts out the mind map according to the flowchart during testing, and manually designs test cases. After the test case design is completed, the tester needs to review and communicate with the R&D personnel and product production personnel several times to confirm whether the mind map is correct and covers all situations. Summary of the invention

[0003] In view of this, the embodiments of the present disclosure provide a method, device, system, and medium for generating test cases that can automatically generate test cases according to a project flowchart.

[0004] One aspect of an embodiment of the present disclosure provides a method for generating test cases. The method includes: obtaining a first project flowchart, the first project flowchart includes at least one logical node; the logical node is used to judge the input data according to the logical conditions of the logical node to determine the flow direction of the output data; and traversing the logical nodes in the first project flowchart according to the following operations to obtain a second project flowchart including test case information. The traversal process specifically generates, for each of the logical nodes, a first type of test case data that meets the logical conditions of the logical node; generates a second type of test case data that does not meet the logical conditions of the logical node; marks the first type of test case data on the first output data stream where the logical node is successfully executed; and marks the second type of test case data on the second output data stream where the logical node fails to execute.

[0005] According to an embodiment of the present disclosure, obtaining the first project flowchart further includes: generating a first configuration file of the first project flowchart, wherein a first statement satisfying a logical condition of the logical node and a second statement not satisfying the logical condition of the logical node are generated for each of the logical nodes.

[0006] According to an embodiment of the present disclosure, traversing the logic nodes in the first project flowchart includes traversing the logic nodes in the first configuration file and generating the first category test case data and the second category test case data for each of the logic nodes.

[0007] According to an embodiment of the present disclosure, traversing the logical nodes in the first project flowchart also includes: taking the first category of test case data and the second category of test case data as output data, storing them in the first statement and the second statement of the logical node in the first configuration file respectively, to obtain a second configuration file containing test case information.

[0008] According to an embodiment of the present disclosure, marking the first category of test case data and the second category of test case data on the first output data stream and the second output data stream, respectively, includes restoring the second configuration file into the second project flowchart.

[0009] According to an embodiment of the present disclosure, the logical expression of the logic node includes an AND conditional expression, then the first category of test case data includes any data combination that satisfies the AND conditional expression, and the second category of test case data includes any data combination corresponding to each of the three situations that do not satisfy the AND conditional expression.

[0010] According to the dual clutch disclosed in the present invention, the logic expression of the logic node includes an OR conditional expression, then the first category of test case data includes any data combination corresponding to each of the three situations that satisfy the OR conditional expression, and the second category of test case data includes any data combination that does not satisfy the OR conditional expression.

[0011] According to an embodiment of the present disclosure, the logical expression of the logic node includes a non-conditional expression, then the first category of test case data includes any data that satisfies the non-conditional expression, and the second category of test case data includes any data that does not satisfy the non-conditional expression.

[0012] In another aspect of the embodiment of the present disclosure, a device for generating test cases is provided. The device includes an acquisition module and a traversal module. The acquisition module is used to acquire a first project flowchart, the first project flowchart includes at least one logical node; the logical node is used to judge the input data according to the logical conditions of the logical node and determine the output data flow direction. The traversal module is used to traverse the logical nodes in the first project flowchart to obtain a second project flowchart including test case information. The traversal module includes a test data generation submodule and a test data marking submodule. The test data generation submodule is used to generate a first type of test case data that meets the logical conditions of the logical node for each of the logical nodes; and to generate a second type of test case data that does not meet the logical conditions of the logical node. The test data marking submodule is used to mark the first type of test case data on the first output data stream of the successful execution of the logical node for each of the logical nodes; and to mark the second type of test case data on the second output data stream of the failed execution of the logical node.

[0013] Another aspect of the present disclosure provides a system for generating test cases. The system includes one or more processors and one or more memories. The memories are used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors execute the method as described above.

[0014] Another aspect of an embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the method described above when executed.

[0015] Another aspect of an embodiment of the present disclosure provides a computer program, wherein the computer program includes computer executable instructions, and the instructions are used to implement the method described above when executed.

[0016] One or more of the above embodiments have the following advantages or beneficial effects: according to the information of the logical nodes of the project flowchart, test cases that almost cover the entire logic can be automatically generated, and a visual flowchart containing data flow can be obtained. The efficiency of the test is greatly improved, and the test cases are combined with the project flowchart, which is clear and reliable. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:

[0018] Figure 1 A flow chart of a method for generating a test case according to an embodiment of the present disclosure is schematically shown;

[0019] Figure 2A A first project flow chart is schematically shown;

[0020] Figure 2B A second project flow chart obtained by the method for generating a test case according to an embodiment of the present disclosure is schematically shown;

[0021] Figure 3 A flowchart of a method for generating a test case according to another embodiment of the present disclosure is schematically shown;

[0022] Figure 4 A block diagram schematically shows an apparatus for generating test cases according to an embodiment of the present disclosure; and

[0023] Figure 5 A block diagram of a computer system suitable for generating test cases according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0024] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.

[0025] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0026] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used here should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner. The number of any element in the specification and the drawings is used for example rather than limitation, and any naming (e.g., first, second) is only used for distinction and does not have any limiting meaning.

[0027] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0028] The embodiments of the present disclosure provide a method, device, system, and medium for generating test cases. The method includes first obtaining a first project flowchart, the first project flowchart includes at least one logical node, wherein the logical node is used to judge the input data according to the logical conditions of the logical node and determine the flow direction of the output data. Then, the logical nodes in the first project flowchart are traversed according to the following operations to obtain a second project flowchart including test case information. Among them, the traversal process is specifically to generate a first type of test case data that meets the logical conditions of the logical node for each logical node, and to generate a second type of test case data that does not meet the logical conditions of the logical node, and then mark the first type of test case data on the first output data stream where the logical node is successfully executed, and mark the second type of test case data on the second output data stream where the logical node fails to execute.

[0029] In this way, the output data flow lines of the successful and failed execution of each logic node in the second project flowchart correspond to the test case data of the successful and failed execution of the logic node. Therefore, by combining the test case data of each logic node according to the corresponding data flow direction, test cases covering almost all logics can be obtained.

[0030] Therefore, the disclosed embodiment can automatically generate test cases that cover almost all logic according to the information of the logical nodes of the project flowchart, and can obtain a visual flowchart containing data flow, which greatly improves the efficiency of the test and makes the test cases and project flowcharts clear and reliable.

[0031] Figure 1 A flow chart of a method for generating test cases according to an embodiment of the present disclosure is schematically shown.

[0032] like Figure 1 As shown, the method for generating a test case according to this embodiment may include operations S110 to S180.

[0033] In operation S110, a first project flow chart is obtained, the first project flow chart includes at least one logical node. The logical node is used to judge input data according to the logical conditions of the logical node and determine the flow direction of output data.

[0034] The project flow chart is connected by nodes and data flows. The nodes can be divided into two categories: logical nodes and operation nodes.

[0035] Operation nodes are used to perform corresponding operations on input data and then output them, without distinguishing different situations. Therefore, you don’t need to consider this type of operation nodes when writing test cases.

[0036] The logic node can judge the input data according to the logic expression (including AND, OR, NOT) to obtain the output data flow.

[0037] A major challenge in writing test cases is to exhaust as many possible situations as possible covered by all logical nodes to achieve a high test coverage rate.

[0038] In operation S120, the logic nodes in the first project flowchart are traversed. For example, the logic nodes in the first project flowchart may be traversed using a depth-first traversal, or may be traversed using a degree-first traversal or other algorithms.

[0039] In operation S130, it is determined whether the traversed node is a logical node. If so, operations S140 to S160 are performed, and if not, operation S170 is performed.

[0040] Specifically, in operation S140, if a logic node is traversed, first-type test case data that meets the logic condition of the logic node and second-type test case data that does not meet the logic condition of the logic node are generated.

[0041] Then in operation S150, the first type of test case data is marked on the first output data stream that is successfully executed by the logical node.

[0042] Next, in operation S160, the second type of test case data is marked on the second output data stream where the execution of the logical node fails.

[0043] Combine the following Figure 2A and Figure 2B Operations S140 to S160 are described as examples.

[0044] Figure 2A A first project flow chart 200A is schematically shown. Figure 2B The second project flowchart 200B obtained by the method for generating test cases according to the embodiment of the present disclosure is schematically shown.

[0045] Figure 2A A flowchart 200A for issuing coupons is shown. In the flowchart 200A, the type of coupon to be issued to the user can be determined based on logical conditions such as whether it is the first consumption, the consumption amount, and whether the user holds a membership card.

[0046] Taking the logic node 201 as an example, the logic expression of the logic node 201 is "whether it is the first consumption". The logic expression of the logic node 201 is relatively simple and can be regarded as a non-conditional expression. According to an embodiment of the present disclosure, when the logic expression of the logic node includes a non-conditional expression, the first type of test case can be any data that satisfies the non-conditional expression, and the second type of test case can be any data that does not satisfy the non-conditional expression.

[0047] For example, parameter A represents the number of consumptions. If the logic node 201 is executed successfully, it means A=1; on the contrary, if the logic node 201 fails to execute, it means that A is any integer greater than 1, for example, A=3. In this example, the first type of test case data generated in operation S140 can be A=1, and the second type of test case data can be A=3, for example.

[0048] Then, in operation S150 and operation S160, A=1 and A=3 may be marked on the output data stream of the successful execution and the output data stream of the failed execution of the logic node 201, respectively. Figure 2B as shown in .

[0049] According to some other embodiments of the present disclosure, the logic expression of the logic node may also include an AND conditional expression, an AND / OR conditional expression, and / or a non-conditional expression.

[0050] According to an embodiment of the present disclosure, if the logical expression of the logic node includes an AND conditional expression, the first category of test case data includes any data combination that satisfies the AND conditional expression, and the second category of test case data includes any data combination corresponding to each of the three situations that do not satisfy the AND conditional expression.

[0051] According to one embodiment of the present disclosure, if the logical expression of the logic node includes an or conditional expression, the first category of test case data includes any data combination corresponding to each of the three situations that satisfy the or conditional expression, and the second category of test case data includes any data combination that does not satisfy the or conditional expression.

[0052] For example, take the logic node 202 as an example. The logic expression of the logic node 202 includes an or conditional expression. Specifically, the logic expression of the logic node 202 is "the accumulated consumption amount is greater than 10,000, or the person holds a membership card".

[0053] The parameter D represents the accumulated consumption amount, and the parameter S represents whether a member card is held, where S=1 represents holding a member card, and S=0 represents not having a member card. If the logic node 202 is executed successfully, there are three corresponding situations: "D>10000 and S=0", "D>10000 and S=1", and "D<10000 and S=1". If the logic node 202 fails to execute, there is one corresponding situation: "D<10000 and S=0".

[0054] According to an embodiment of the present disclosure, the first type of test case data generated for the logic node 202 in operation S140 may be, for example, "D=12000 and S=0", "D=12000 and S=1", and "D=12000 and S=0", and the second type of test case data generated may be, for example, "D=8000 and S=0". Then, in operations S150 and S160, the first type of test case data and the second type of test case data generated above are marked on the output data stream of the successful execution and the output data stream of the failed execution of the logic node 202, respectively, as shown in FIG. Figure 2B as shown in .

[0055] Each logical node in the project flowchart 200A is processed through operations S140 to S160 in a manner similar to the logical node 201 or the logical node 202 .

[0056] Next, in operation S170, it is determined whether all logical nodes have been traversed. If not, the process returns to operation S120 to continue traversing the logical nodes in the first project flow chart. If yes, operation S180 is executed.

[0057] In operation S180, when all logic nodes in the first project flowchart are traversed, a second project flowchart including test case information is output.

[0058] For example, the second project flowchart 200B is generated corresponding to the first project flowchart 200A. Among them, the data flow of the second project flowchart 200B is marked with test case data. By combining these test case data according to the data flow, you can get a test case suitable for the corresponding situation. For example, the number of consumptions A=1 and the amount of this consumption C=800 can be combined into a test case, and coupon 2 should be issued when the test case is executed correctly. For another example, the number of consumptions A=3, the amount of this consumption C=800, and the cumulative consumption amount D=12000, and the membership card held S=1 can be combined into another test case, and coupon 4 should be issued when the test case is executed correctly.

[0059] The disclosed embodiment can automatically generate test cases that cover almost all logic based on the information of the logical nodes of the project flowchart, and can obtain a visual flowchart containing data flow, which greatly improves the efficiency of the test and makes the test cases and project flowcharts clear and reliable.

[0060] In one embodiment, during the specific implementation process of the method of the embodiment of the present disclosure, the first project flowchart can be converted into a corresponding configuration file by reading the configuration file, traversing each logical node in the configuration file, generating corresponding first-category test case data and second-category test case data, and then converting the configuration file containing various test case data into the second project flowchart.

[0061] Specifically, according to an embodiment of the present disclosure, obtaining the first project flowchart in operation S110 may be generating a first configuration file for the first project flowchart, wherein a first statement satisfying the logical condition of the logical node and a second statement not satisfying the logical condition of the logical node are generated for each logical node.

[0062] The first configuration file may be, for example, a file obtained by adding the first statement and the second statement to the initial configuration file of the first project flowchart. The initial configuration file may be, for example, a configuration file converted to obtain the first project flowchart. In the first configuration file, each logical node in the first project flowchart is converted into a text description.

[0063] Taking the project flowchart 200A as an example, in the configuration file of the project flowchart 200A, the logical node 201 is converted into a corresponding text description, for example, as follows:

[0064] “The type of the logical node 201: judgment box;

[0065] Logical expression: whether it is the first consumption;

[0066] Left value: false;

[0067] The corresponding first statement is: consumption times A = 1;

[0068] Right value: true;

[0069] The corresponding second statement is: "The number of consumption times A is greater than 1".

[0070] Accordingly, traversing the logic nodes in the first project flowchart in operation S120 includes: traversing the logic nodes in the first configuration file, and generating the first type of test case data and the second type of test case data for each logic node.

[0071] According to an embodiment of the present disclosure, after generating the first category of test case data and the second category of test case data for each logical node in operation S140, the first category of test case data and the second category of test case data can also be used as output data and stored in the first statement and the second statement of the logical node in the first configuration file, respectively, to obtain a second configuration file containing test case information.

[0072] Therefore, in operation S160, the second configuration file can be restored to the second project flowchart, so that the first type of test case data and the second type of test case data of each logical node will be marked on the output data flow of the corresponding logical node execution success and execution failure accordingly.

[0073] Figure 3 The flowchart of the method for generating a test case according to another embodiment of the present disclosure is schematically shown. It can be understood that Figure 3 The example is an application example of the present disclosure, which is an illustrative illustration of the present disclosure and does not constitute any limitation to the present disclosure.

[0074] like Figure 3 As shown, the method flow of this embodiment may include operations S310 to S360, wherein operation S340 may further include operations S341 to S347.

[0075] In operation S310, a project flow chart is obtained.

[0076] In operation S320, an initial configuration file of a project flow chart is generated. The project flow chart may include logic nodes and data lines (used to indicate data flow). The logic nodes include logic expressions (AND, OR, NOT).

[0077] In operation S330, a logic configuration file (i.e., a first configuration file) is obtained based on the initial configuration file. A statement satisfying / not satisfying a condition can be generated according to the logic expression, so as to determine the logic direction according to the conditional judgment of the logic expression. The logic direction is dynamically generated according to different input data.

[0078] In operation S340, the logic configuration file is imported into a test case generating device. The test case generating device may be, for example, a device for generating test cases in an embodiment of the present disclosure or a part thereof.

[0079] Specifically, operation S340 may include operations S341 to S348.

[0080] First, in operation S341, the test case generating apparatus may obtain a logic configuration file.

[0081] Then, in operation S342, the logic configuration file is traversed. For example, a path depth coverage algorithm is used to traverse the logic nodes in a depth-first traversal manner. Among them, the use of the depth-first traversal idea is more in line with the thinking mode of test case generation.

[0082] In operation S343, for each traversed logic node, a test case data field indicating success / failure of node execution is reserved.

[0083] Specifically, in operation S344, it is determined whether the node traversal is complete. If not, operations S345 to S347 are performed. If the traversal is complete, operation S348 is performed.

[0084] In operation S345, the information (AND, OR, NOT) of the logic condition expression of the currently traversed logic node is determined.

[0085] In operation S346, test case data for successful / identified execution of the currently traversed logic node is generated. For example, according to the logic expression of the current node (for example, the expression here is a>2, and the type of a is number), success data is generated (e.g., a randomly generated integer of a>2 as the first type of test case data), and failure data is generated (e.g., a randomly generated integer of a<2 as the second type of test case data).

[0086] In operation S347, the success data and the failure data generated in operation S346 are stored together in the node information of the current logical node to obtain a configuration file containing the test case information.

[0087] In operation S348, after all logical nodes are traversed, a configuration file with test cases (ie, a second configuration file) is exported.

[0088] Then, in operation S350, the file information of the test case to be tested generated by the test case generating device is obtained. After each node is traversed, the originally imported JSON (JavaScript Object Notation, JS object notation) configuration file is newly added with the test case data information.

[0089] Next, in operation S360, the configuration file obtained in operation S350 is converted into a flowchart. Specifically, the configuration file with the test case data information can be traversed and restored to a flowchart mode. In this case, the restored flowchart has the configuration of the test case data information on the data flow connection of each logical node, that is, the test case also appears visually on the flowchart.

[0090] In this way, test cases can be automatically generated by simply obtaining a flowchart, which improves test efficiency and reduces communication costs in various links such as production, R&D, and testing.

[0091] Figure 4 A block diagram of an apparatus 400 for generating a test case according to an embodiment of the present disclosure is schematically shown.

[0092] like Figure 4 As shown, the device 400 for generating a test case may include an acquisition module 410 and a traversal module 420. The device 400 for generating a test case may be used to implement a reference Figure 1 to Figure 3 The method described.

[0093] The acquisition module 410 is used to acquire a first project flow chart, which includes at least one logical node. The logical node is used to judge input data according to the logical conditions of the logical node and determine the flow direction of output data.

[0094] The traversal module 420 is used to traverse the logical nodes in the first project flowchart to obtain a second project flowchart including test case information.

[0095] Specifically, the traversal module 420 may include a test data generating submodule 421 and a test data marking submodule 422 .

[0096] The test data generation submodule 421 is used to generate, for each logic node, first-type test case data that meets the logic conditions of the logic node, and to generate second-type test case data that does not meet the logic conditions of the logic node.

[0097] The test data marking submodule 422 is used to mark the first type of test case data on the first output data stream of each logical node where the logical node is successfully executed; and mark the second type of test case data on the second output data stream of the logical node where the logical node is failed to execute.

[0098] According to an embodiment of the present disclosure, the acquisition module 410 is further used to generate a first configuration file of the first project flowchart, wherein a first statement satisfying the logic condition of the logic node and a second statement not satisfying the logic condition of the logic node are generated for each logic node.

[0099] According to an embodiment of the present disclosure, the test data generation submodule 421 is further configured to traverse the logical nodes in the first configuration file and generate the first type of test case data and the second type of test case data for each logical node.

[0100] According to an embodiment of the present disclosure, the test data marking submodule 422 is also used to store the first type of test case data and the second type of test case data as output data in the first statement and the second statement of the logical node in the first configuration file respectively, to obtain a second configuration file containing test case information.

[0101] According to an embodiment of the present disclosure, the test data marking submodule 422 is further used to restore the second configuration file into a second project flow chart.

[0102] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.

[0103] For example, any multiple of the acquisition module 410, the traversal module 420, the test data generation submodule 421, and the test data marking submodule 422 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the acquisition module 410, the traversal module 420, the test data generation submodule 421, and the test data marking submodule 422 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware or in a suitable combination of any of them. Alternatively, at least one of the acquisition module 410 , the traversal module 420 , the test data generation submodule 421 , and the test data marking submodule 422 may be at least partially implemented as a computer program module, which may perform corresponding functions when executed.

[0104] Figure 5 The block diagram of a computer system 500 suitable for generating test cases according to an embodiment of the present disclosure is schematically shown. Figure 5 The computer system 500 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0105] like Figure 5 As shown, the computer system 500 according to the embodiment of the present disclosure includes a processor 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage part 508 to the random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include an onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.

[0106] In RAM 503, various programs and data required for the operation of computer system 500 are stored. Processor 501, ROM 502 and RAM 503 are connected to each other via bus 504. Processor 501 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 502 and / or RAM 503. It should be noted that the program can also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.

[0107] According to an embodiment of the present disclosure, the computer system 500 may further include an input / output (I / O) interface 505, which is also connected to the bus 504. The system 500 may further include one or more of the following components connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.

[0108] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the processor 501, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.

[0109] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.

[0110] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 502 and / or RAM 503 described above and / or one or more memories other than ROM 502 and RAM 503.

[0111] An embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains a program code for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the image recognition method provided by the embodiment of the present disclosure.

[0112] When the computer program is executed by the processor 501, the above functions defined in the system / device of the embodiment of the present disclosure are executed. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0113] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 509, and / or installed from the removable medium 511. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0114] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).

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

[0116] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.

[0117] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.

Claims

1. A method for generating test cases, include: Acquire a first project flowchart, wherein the first project flowchart includes at least one logical node; The logic node is used to judge the input data according to the logic conditions of the logic node and determine the flow direction of the output data; as well as Traversing the logic nodes in the first project flowchart according to the following operations to obtain a second project flowchart including test case information includes: For each of the logical nodes, Generate a first type of test case data that satisfies the logic conditions of the logic node; Generating a second type of test case data that does not satisfy the logic condition of the logic node; Marking the first type of test case data on the first output data stream of the successful execution of the logic node; and The second type of test case data is marked on the second output data stream where the logical node fails to execute.

2. The method according to claim 1, in, The flowchart for obtaining the first project also includes: A first configuration file of the first project flow chart is generated, wherein a first statement satisfying a logic condition of the logic node and a second statement not satisfying the logic condition of the logic node are respectively generated for the logic nodes.

3. The method according to claim 2, in, The traversing the logic nodes in the first project flow chart includes: The logical nodes are traversed in the first configuration file, and the first type of test case data and the second type of test case data are generated for each of the logical nodes.

4. The method according to claim 3, in, The traversing the logic nodes in the first project flow chart further includes: The first type of test case data and the second type of test case data are used as output data and stored in the first statement and the second statement of the logic node in the first configuration file respectively, so as to obtain a second configuration file containing test case information.

5. The method according to claim 4, in, The step of marking the first type of test case data and the second type of test case data on the first output data stream and the second output data stream, respectively, comprises: The second configuration file is restored into the second project flowchart.

6. The method according to any one of claims 1 to 5, in, The logic expression of the logic node includes an AND condition expression, then: The first type of test case data includes any data combination that satisfies the AND conditional expression; and The second category of test case data includes any data combination corresponding to each of the three situations that do not satisfy the conditional expression.

7. The method according to any one of claims 1 to 5, in, The logic expression of the logic node includes an OR conditional expression, then: The first type of test case data includes any data combination corresponding to each of the three situations satisfying the or conditional expressions; and The second type of test case data includes any data combination that does not satisfy the or conditional expressions.

8. The method according to any one of claims 1 to 5, in, The logic expression of the logic node includes a non-conditional expression, then: The first type of test case data includes any data that satisfies the non-conditional expression; and The second type of test case data includes any data that does not satisfy the non-conditional expression.

9. A device for generating test cases, include: An acquisition module, configured to acquire a first project flowchart, wherein the first project flowchart includes at least one logical node; The logic node is used to judge the input data according to the logic conditions of the logic node and determine the flow direction of the output data; A traversal module, used to traverse the logic nodes in the first project flowchart to obtain a second project flowchart including test case information; wherein the traversal module includes: A test data generation submodule, for generating, for each of the logic nodes, first-type test case data that meets the logic conditions of the logic node; and generating second-type test case data that does not meet the logic conditions of the logic node; The test data marking submodule is used to mark the first type of test case data on the first output data stream of each logical node where the logical node is successfully executed; and mark the second type of test case data on the second output data stream where the logical node is failed to execute.

10. A system for generating test cases, include: one or more processors; one or more memories for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors execute the method according to any one of claims 1 to 8.

11. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute the method according to any one of claims 1 to 8.