A test case generation method and device, electronic equipment and storage medium

By constructing business views and automating test case generation, the problems of unstable test case generation quality and difficulty in reuse were solved, achieving efficient and standardized test case generation and improving software testing quality.

CN114443493BActive Publication Date: 2025-11-11AGRICULTURAL BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210112968.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-29
Publication Date
2025-11-11
Estimated Expiration
2042-01-29

AI Technical Summary

Technical Problem

In existing technologies, test case generation relies on manual writing, resulting in poor standardization, unstable quality, difficulty in reuse, and impact on software testing quality.

Method used

By constructing a business view, extracting the input elements and operation atoms of the constituent nodes, generating a business rule base, determining the operation process set based on the execution order, and automatically generating test cases using the relationship.

Benefits of technology

It enables automated generation of test cases, improves coverage and standardization, and enhances test case generation efficiency and software testing quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114443493B_ABST
    Figure CN114443493B_ABST
Patent Text Reader

Abstract

The application discloses a test case generation method and device, electronic equipment and a storage medium, wherein the method comprises the following steps: constructing a business rule base according to input elements and operation atoms of each component node in a business view; determining an operation flow set according to an execution order of each component node in the business view; and generating a test case based on an association relationship between the business rule base and the operation flow set. The embodiment of the application realizes automatic generation of the test case, improves the coverage of the test case, solves the problem of test case reuse difficulty, improves the test case generation efficiency, enhances the standardization degree of the test case, and improves the software test quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer application technology, and in particular to a test case generation method, apparatus, electronic device, and storage medium. Background Technology

[0002] Software testing is the process of using manual or automated methods to determine the functionality of a software system. The purpose of software testing is to verify whether the software functions meet specified requirements, discover errors in the software system, and verify whether the software design conforms to requirements. Basic software testing methods include static testing, dynamic testing, functional testing, performance testing, black-box testing, and white-box testing. In the field of software testing, test requirement analysis and test case writing are crucial steps in functional testing, directly impacting the quality of the testing work and the completeness of the software's functionality. Currently, business test case writing mainly relies on manual methods. Testers analyze business scenarios and rules based on the requirements specification or requirements document and manually write test cases according to the analysis results. This method leads to problems such as poor test case standardization, inconsistent test case quality, and difficulty in reusing test cases. Summary of the Invention

[0003] This invention provides a test case generation method to solve the problems of unstable test case generation quality and difficulty in test case reuse. It can improve test case generation efficiency, enhance the standardization of test cases, and improve the quality of software testing.

[0004] According to one aspect of the present invention, a test case generation method is provided, wherein the method includes:

[0005] The business rule base is constructed based on the input elements and operation atoms of each component node in the business view;

[0006] The operation flow set is determined based on the execution order of each component node in the business view;

[0007] Test cases are generated based on the relationship between the business rule base and the operation process set.

[0008] According to one aspect of the present invention, a test case generation apparatus is provided, wherein the apparatus comprises:

[0009] The rule determination module is used to construct a business rule base based on the input elements and operation atoms of each component node in the business view;

[0010] The process determination module is used to determine the set of operation processes based on the execution order of each component node in the business view;

[0011] The test case generation module is used to generate test cases based on the relationship between the business rule base and the operation process set.

[0012] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0013] At least one processor; and

[0014] A memory communicatively connected to the at least one processor; wherein,

[0015] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the test case generation method according to any embodiment of the present invention.

[0016] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the test case generation method according to any embodiment of the present invention.

[0017] The technical solution of this invention obtains input elements and operation atoms from the constituent nodes of the business view to form a business rule base, determines the operation process set based on the execution order of each constituent node of the business view, and generates test cases according to the relationship between the business rule base and the operation process set. This can realize the automated generation of test cases, improve the coverage of test cases, solve the problem of difficult test case reuse, improve the efficiency of test case generation, enhance the standardization of test cases, and improve the quality of software testing.

[0018] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart of a test case generation method provided in Embodiment 1 of the present invention;

[0021] Figure 2 This is a flowchart of a test case generation method provided in Embodiment 2 of the present invention;

[0022] Figure 3This is a schematic diagram of a test case generation device according to Embodiment 3 of the present invention;

[0023] Figure 4 This is a schematic diagram of the structure of an electronic device that implements the test case generation method of this invention. Detailed Implementation

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

[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0026] Example 1

[0027] Figure 1 This is a flowchart of a test case generation method according to Embodiment 1 of the present invention. This embodiment is applicable to the automated generation of software test cases. The method can be executed by a test case generation device, which can be implemented in hardware and / or software and can be configured in a server or device terminal. Figure 1 As shown, the method includes:

[0028] Step 110: Construct a business rule base based on the input elements and operation atoms of each component node in the business view.

[0029] The business view can be a visual directed node graph generated based on the requirements specification or requirements specification of the software system. Each component node in the business view can correspond to a function point in the software system. Input elements can be the information that needs to be input in the function point, and operation atoms can be the operation functions performed at the function point.

[0030] In this embodiment of the invention, a business view can be generated in advance based on the requirements specification or requirements statement of the software system. The method for generating the business view is not limited here and can include automated generation or manual generation. Specifically, for the business view, the constituent nodes can be scanned sequentially to extract the corresponding input elements and operation atoms associated with each constituent node. The input elements and operation atoms can be combined to form business rules and stored in a business rule base. The business rules can include different types of input elements and execution order requirements between operation atoms, etc. The business rules can be generated automatically or configured by testers.

[0031] Step 120: Determine the operation flow set based on the execution order of each component node in the business view.

[0032] The execution order refers to the sequential order in which the software functions corresponding to each component node are executed to fulfill the business requirements. The execution order can be composed of different component nodes; for example, it can be an ordered sequence where the order of the component nodes represents the execution order of the corresponding software functions. The operation flow set can be a collection of one or more operation flows, which can be stored in matrix or vector form.

[0033] Specifically, the execution order of each component node on different lines can be determined by the direction of the connection between the component nodes in the business view. Different lines in the business view can be regarded as different business operation processes of the software system. The component nodes on different lines can be arranged into operation processes according to their respective execution order and stored in the operation process set.

[0034] Step 130: Generate test cases based on the relationship between the business rule base and the operation process set.

[0035] The association relationship can refer to whether there is an association between the business rules in the business rule base and the operation process in the operation process set. For example, if the operation atom in the business rule is a component of the operation process in the operation process set, then the operation atom and the operation process are associated.

[0036] In this embodiment of the invention, business rules in the business rule base and operation processes in the operation process set can be traversed sequentially. A relationship is established by determining whether each business rule is related to each operation process. After determining the relationship between the business rule base and the operation process set, one or more test cases are generated according to the related business rules and operation processes. In the test cases, corresponding test content can be generated through business rules and operation processes. For example, test methods and test cases are determined for business rules, and test processes for each test method and test user are determined for operation processes.

[0037] In this embodiment of the invention, input elements and operation atoms are obtained through the constituent nodes of the business view to form a business rule base. The execution order of each constituent node of the business view is used to determine the operation process set. Test cases are generated according to the relationship between the business rule base and the operation process set. This can realize the automated generation of test cases, improve the coverage of test cases, solve the problem of difficult test case reuse, improve the efficiency of test case generation, enhance the standardization of test cases, and improve the quality of software testing.

[0038] Example 2

[0039] Figure 2 This is a flowchart of a test case generation method according to Embodiment 2 of the present invention. This embodiment is a specific variation of the above embodiment. By identifying the relationship between the business rule base and the operation process set in a relational matrix manner, the coverage of test cases can be further enhanced. Figure 2 As shown, the method includes:

[0040] Step 210: Traverse the constituent nodes within the business view and extract input elements and operation atoms for each constituent node.

[0041] In this embodiment of the invention, the business view can be traversed. The traversal method can include depth-first traversal or breadth-first traversal. For the component nodes accessed in the business view, the input elements and operation atoms of the corresponding software functions of the component nodes can be extracted from the software requirements specification or requirements specification. Furthermore, the extracted input elements and operation atoms can be temporarily stored.

[0042] Step 220: Determine the preset business rule template for matching input elements and operation atoms.

[0043] Among them, the preset business rule template can be a rule template designed for different system software business. The preset business rule template can include the requirements of input elements and operation atoms in different business scenarios, and can include the requirements of a single operation atom and the requirements of combining different operation atoms, etc.

[0044] In this embodiment of the invention, after extracting the input elements and operation atoms, the unique identifier information of the input elements or operation atoms can be used to match them in a preset business rule template to determine a preset business rule template that regulates the input elements and operation atoms. The preset business rule template may include one or more constraints for planning the corresponding input elements or operation atoms. For example, for banking business, the query operation cannot be performed before the login operation.

[0045] Step 230: Fill the input elements and operation atoms into the preset business rule template and store the filled preset business rule template as a business rule in the business rule library.

[0046] Specifically, input elements and operation atoms can be filled into the corresponding positions in a preset business rule template. This preset business rule template can exist in the form of tabular data or file data. The preset business rule template filled with input elements and operation atoms can be used as a business rule, and the business rule can be stored in the business rule library.

[0047] Step 240: Connect the constituent nodes of the business view in the execution order of the constituent nodes and perform a depth-first traversal of each constituent node.

[0048] In this embodiment of the invention, the execution order of different component nodes in the business view can be represented by the directed connections in the business view. One or more component nodes on one or more directed connections in the business view can be traversed in depth sequentially. That is, after all the component nodes on one directed connection are visited, the component nodes on other directed connections are visited.

[0049] Step 250: Store the operation atoms extracted from each component node during each depth traversal as a set of operation flows into the operation flow set.

[0050] Specifically, during the depth-first traversal of the constituent nodes in the business view, the operation atoms of each constituent node on a directed connection can be extracted and the ordered sequence of operation atoms can be used as a set of operation flows according to the execution order. It can be understood that the number of directed connections in the business view can correspond to the number of sets of operation flows, and the extracted operation flows can be stored in the operation flow set.

[0051] Step 260: Use the business rule base and operation process set as vertex set and edge set respectively to generate the analysis model graph.

[0052] In this embodiment of the invention, each business rule in the business rule base can be used as a vertex in the vertex set, and the operation process in the process operation set can be used as an edge in the edge set. The vertices can be connected sequentially with edges according to whether the operation process has an association with the business rule, and the resulting image can be used as an analysis model graph.

[0053] Step 270: Determine the correlation matrix of the analysis model diagram.

[0054] Specifically, an association matrix can be generated for the analysis model diagram. Different types of association relationships can be identified in the association matrix by taking different parameter values. For example, if business rule 1 is the starting point of operation process a, then the value of the corresponding element in the association matrix is ​​1. If there is no association relationship between business rule 1 and operation process a, then the value of the corresponding element in the association matrix is ​​0.

[0055] Step 280: Generate the directed tree corresponding to the association matrix, and traverse each directed tree to obtain at least one traversal path.

[0056] The directed tree can be the minimum spanning tree of the incidence matrix, and methods for generating the directed tree can include Kruskal's algorithm, Prim's algorithm, etc. The traversal path can be the order in which all nodes of the directed tree are visited.

[0057] In this embodiment of the invention, the Kruskal algorithm, Prim's algorithm, etc., can be used to generate the corresponding minimum spanning tree as a directed tree for the association matrix, and one or more traversal paths can be determined by traversing each directed tree.

[0058] Step 290: Determine the test cases corresponding to each traversal path.

[0059] Specifically, for each traversal path, the business rules and operation processes corresponding to the nodes in the traversal path are extracted sequentially. The test process composed of each business rule and operation process can be used as test content to generate corresponding test cases. It can be understood that in addition to the test content, the test case can also include a unique identifier.

[0060] Step 2100: Generate the tag information for each test case and remove duplicate test cases according to the tag information.

[0061] The tag information can be a unique identifier generated for the test case. This unique identifier can be generated by processing the test content of the test case using the MD5 algorithm or a hash algorithm.

[0062] In this embodiment of the invention, label information can be generated for each test case. By comparing the label information, it can be determined whether there are duplicate or redundant test cases in each test case. For duplicate test cases, the remaining redundant test cases can be deleted to retain the unique test case.

[0063] In this embodiment of the invention, by traversing the constituent nodes in the business view and extracting the input elements and operation atoms of each constituent node, a preset business rule template matching the input elements and operation atoms is determined. The input elements and operation atoms are filled into the preset business rule template and stored as business rules in the business rule library. Each constituent node is traversed in depth according to the execution order of the business view. During each depth traversal, the operation atoms extracted from each constituent node are stored as a set of operation flows in the operation flow set. The business rule library and the operation flow set are used as vertex set and edge set, respectively, to form an analysis model graph. The association matrix of the analysis model graph is determined, and the directed tree of the association matrix is ​​determined. The traversal path is determined in the directed tree, and the corresponding test cases are generated based on the traversal path. This can realize the automated generation of test cases, improve the coverage of test cases, solve the problem of difficult test case reuse, improve the efficiency of test case generation, enhance the standardization of test cases, and improve the quality of software testing.

[0064] Furthermore, based on the above embodiments of the invention, the association relationships in the association matrix at least include:

[0065] The business rules in the business rule base are the starting points of the operation processes within the operation process set; the business rules in the business rule base are the ending points of the operation processes within the operation process set; the business rules in the business rule base are not associated with the operation processes within the operation process set.

[0066] In this embodiment of the invention, the association relationships in the association matrix can include a business rule being the starting point of a certain operation process, a business rule being the ending point of a certain operation process, and a business rule being unrelated to a certain operation process. Different values ​​can be used in the association matrix to represent these different association relationships. For example, R(G) = {γ1, γ2, ..., γ...} m} represents the business rule base, P(G) = {ρ1, ρ2, ..., ρ3} n} represents the set of operation processes, where a certain element b in the association matrix is... ij It can be defined as follows:

[0067]

[0068] Furthermore, based on the above embodiments of the invention, a directed tree corresponding to the association matrix is ​​generated, and each directed tree is traversed to obtain at least one traversal path, including:

[0069] Generate at least one forward directed tree with the starting point of the incidence matrix as the positive direction; traverse the forward directed tree to obtain at least one forward path; generate at least one backward directed tree with the ending point of the incidence matrix as the positive direction; traverse the backward directed tree to obtain at least one backward path.

[0070] In this embodiment of the invention, when the association matrix includes the association relationship between the starting point and the ending point, a forward directed tree can be generated with the starting point as the positive direction. The forward directed tree can be traversed to obtain one or more forward paths. These forward paths can be used to determine normal test cases. Then, a reverse directed tree can be generated with the ending point as the positive direction. The reverse directed tree can be traversed to determine one or more reverse paths. These reverse paths can also be used to determine reverse test cases. Furthermore, it can be understood that after determining the reverse test cases, the business rules of each node in each reverse path can be verified again, and reverse paths that belong to invalid or erroneous business rules can be deleted.

[0071] In one exemplary implementation, a test case generation method is provided, the method comprising:

[0072] 1. Perform business equivalence class analysis on each node in the business view to determine the input elements and possible equivalence class partitions, and establish a business rule base set R. The business rule base covers the enumeration relationships of test coverage elements, and considering the correlation between business rules, individual business rules can be combined to generate composite business rules.

[0073] 2. Perform test analysis and modeling on the business view operation flow. For a transaction flow, starting from the initial input item, model the transaction function using an operation flowchart to generate a test analysis model graph G(R, P), where R is the set of business rule bases, P is the set of operation flow steps, and G(R, P) describes the operation steps and logical relationships of the business rules in the transaction operation process. Each input item of the operation step can be selected from the business rule base as a suitable single business rule or a combination of business rules. Associating the operation steps with the business rules completes the test analysis model.

[0074] Let the set of rule vertices of the generated directed graph G be R(G) = {γ1, γ2, ..., γ...} m The set of operations relations is P(G) = {ρ1, ρ1, ..., ρ1}. n The incidence matrix of a directed graph G is B(G) = (b ij ) m×n Where m is the total number of business rule set nodes, n is the number of operation logic relationship sets, and b ij The definition is as follows:

[0075]

[0076] Based on the correlation matrix B generated by G, it is easy to know When B i When the corresponding edges in B form a tree, i=±1, otherwise B i =0, therefore, the number of business process trees that can be constructed from the directed graph of the test analysis model is N = |B||B T |

[0077] 3. Automated generation of test cases

[0078] In the test analysis model, each business equivalence class records detailed information about each business view node. The operation flow includes the sequence of business processes, path relationships, and the associations between various business rules. Automated test case generation relies on this information. The specific generation method is as follows:

[0079] 3.1 Normal Case Generation Method

[0080] Step 1: Based on the generated directed tree, obtain the total number of paths N for the operation process steps.

[0081] Step 2: Following the traversed process path, enumerate the valid equivalence classes for each business rule and combine them to generate a positive case set. The number of positive cases for each path is the same as the maximum number of valid equivalence classes for that path.

[0082] CP i = MAX[valid equivalence class (rule 1), valid equivalence class (rule 2), ..., valid equivalence class (rule n)]

[0083] Step 3: Summarize positive examples from all paths

[0084] Each path has a set of positive cases, numbered CP1, ... CP1. N The final total number of positive cases is The set of positive cases is

[0085] 3.2 Reverse Case Generation Method

[0086] Step 1: Based on the generated directed tree, obtain the total number of paths N for the operation process steps.

[0087] Step 2: Each time, select an invalid equivalence class, and match other business rules against valid equivalence classes to generate reverse cases. The weight of each business rule in the total number of generated cases is ω1, ω2, ..., ω n ω equals the proportion of valid cases for each business rule to the total number of valid cases in the process. The number of reverse cases in each path is the same as the sum of the number of its invalid equivalence classes.

[0088] CR i = SUM[Invalid equivalence class (rule 1), invalid equivalence class (rule 2), ..., invalid equivalence class (rule n)]

[0089] Step 3: Summarize the reverse cases for all paths. Each path has a set of reverse cases, with quantities of CR1, CR2, ..., CR... N The final total number of reverse cases is The set of reverse cases is

[0090] 3.3 Redundancy Removal from Multi-Branch Flowchart Case Study

[0091] Step 1: Construct a dictionary of {case identifiers---case content};

[0092] Step 2: Traverse the object set of all generated cases, remove unique identifiers such as case ID, and generate tag information for each case.

[0093] Step 3: Generate an MD5 hash of the case's tag information, and check if the dictionary contains the MD5 hash of the case. If not, add it to the dictionary; otherwise, remove the case.

[0094] 3.4 Interface Inspection Case Generation Algorithm

[0095] Traverse the nodes in the flowchart and check whether each node has configured UI inspection rules. Only nodes with configured UI inspection rules will generate UI inspection cases. Each node will generate one UI inspection case.

[0096] Example 3

[0097] Figure 3 This is a schematic diagram of a test case generation device according to Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a rule determination module 301, a process determination module 302, and a case generation module 303.

[0098] The rule determination module 301 is used to construct a business rule base based on the input elements and operation atoms of each component node in the business view.

[0099] The process determination module 302 is used to determine the operation process set according to the execution order of each component node in the business view.

[0100] The case generation module 303 is used to generate test cases based on the association between the business rule base and the operation process set.

[0101] In this embodiment of the invention, the rule determination module obtains input elements and operation atoms from the constituent nodes of the business view to form a business rule base. The process determination module determines the operation process set based on the execution order of each constituent node of the business view. The test case generation module generates test cases according to the relationship between the business rule base and the operation process set. This can realize the automated generation of test cases, improve the coverage of test cases, solve the problem of difficult test case reuse, improve the efficiency of test case generation, enhance the standardization of test cases, and improve the quality of software testing.

[0102] Furthermore, based on the above embodiments of the invention, the rule determination module 301 includes:

[0103] The element extraction unit is used to traverse the component nodes within the business view and extract the input element and the operation atom for each component node.

[0104] A template determination unit is used to determine a preset business rule template for matching the input element and the operation atom, wherein the preset business rule template includes matching conditions for the input element or the operation atom.

[0105] The rule storage unit is used to fill the input elements and the operation atoms into the preset business rule template and store the filled preset business rule template as a business rule in the business rule library.

[0106] Furthermore, based on the above embodiments of the invention, the process determination module 302 includes:

[0107] The node traversal unit is used to perform a depth-first traversal of the constituent nodes of the business view according to the execution order of the constituent nodes.

[0108] The operation acquisition unit is used to store the operation atoms extracted from each of the constituent nodes during each depth traversal as a set of operation flows into the operation flow set.

[0109] Furthermore, based on the above embodiments of the invention, the case generation module 303 includes:

[0110] The model graph unit is used to generate an analysis model graph by taking the business rule base and the operation process set as the fixed point set and edge set, respectively.

[0111] The matrix determination unit is used to determine the correlation matrix of the analysis model diagram.

[0112] The path acquisition unit is used to generate the directed tree corresponding to the association matrix and traverse each of the directed trees to obtain at least one traversal path.

[0113] The test case generation unit is used to determine the test cases corresponding to each of the traversal paths.

[0114] Furthermore, based on the above embodiments of the invention, the association relationships in the association matrix at least include:

[0115] The business rules in the business rule base are the starting points of the operation processes within the operation process set; the business rules in the business rule base are the ending points of the operation processes within the operation process set; the business rules in the business rule base are not associated with the operation processes within the operation process set.

[0116] Furthermore, based on the above embodiments of the invention, the path acquisition unit is specifically used to: generate at least one forward directed tree with the starting point of the association matrix as the positive direction; traverse the forward directed tree to obtain at least one forward path; generate at least one reverse directed tree with the ending point of the association matrix as the positive direction; and traverse the reverse directed tree to obtain at least one reverse path.

[0117] Furthermore, based on the above embodiments of the invention, the test case generation unit further includes: a tag removal subunit, used to generate tag information for each test case and remove duplicate test cases according to the tag information.

[0118] The test case generation device provided in the embodiments of the present invention can execute the test case generation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0119] Example 4

[0120] Figure 4 This is a schematic diagram of the structure of an electronic device implementing the test case generation method of embodiments of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0121] like Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0122] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0123] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as test case generation methods.

[0124] In some embodiments, the test case generation method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the test case generation method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the test case generation method by any other suitable means (e.g., by means of firmware).

[0125] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0126] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0127] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0128] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0129] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0130] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0131] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0132] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A test case generation method, characterized in that, include: The business rule base is constructed based on the input elements and operation atoms of each component node in the business view; The input elements are the information that needs to be entered into the constituent nodes; The operation flow set is determined based on the execution order of each component node in the business view; Test cases are generated based on the relationship between the business rule base and the operation process set, including: The business rule base and the operation process set are respectively used as the vertex set and edge set to generate the analysis model graph; Determine the correlation matrix of the analysis model diagram; different types of correlation relationships are identified in the correlation matrix by different parameter values; Generate a directed tree corresponding to the association matrix, and traverse each directed tree to obtain at least one traversal path; Determine the test cases corresponding to each of the traversal paths; The association relationships in the association matrix include at least the following: The business rules in the business rule base are the starting points of the operation processes in the operation process set; The business rules in the business rule base are the endpoints of the operation processes within the operation process set; The business rules in the business rule base are not associated with the operation processes in the operation process set.

2. The method according to claim 1, characterized in that, The process of constructing a business rule base based on the input elements and operation atoms of each component node within the business view includes: Traverse the constituent nodes within the business view, and extract the input elements and operation atoms for each constituent node; Determine the preset business rule template for atomic matching of the input elements and the operation; The input elements and the operation atoms are filled into the preset business rule template, and the filled preset business rule template is stored as a business rule in the business rule library.

3. The method according to claim 1, characterized in that, The step of determining the operation flow set based on the execution order of the constituent nodes within the business view includes: The business view is traversed sequentially by depth according to the execution order of the constituent nodes. The operation atoms extracted from each of the constituent nodes during each depth traversal are stored as a set of operation flows in the operation flow set.

4. The method according to claim 1, characterized in that, The step of generating the directed tree corresponding to the association matrix and traversing each directed tree to obtain at least one traversal path includes: Generate at least one positive directed tree with the starting point of the correlation matrix as the positive direction; Traverse the forward directed tree to obtain at least one forward path; Generate at least one reverse directed tree with the endpoint of the correlation matrix as the positive direction; Traverse the reverse directed tree to obtain at least one reverse path.

5. The method according to claim 1, characterized in that, When determining the test cases corresponding to each of the traversal paths, the method further includes: Generate label information for each test case, and remove duplicate test cases according to the label information.

6. A test case generation device, characterized in that, include: The rule determination module is used to construct a business rule base based on the input elements and operation atoms of each component node in the business view; The input elements are the information that needs to be entered into the constituent nodes; The process determination module is used to determine the set of operation processes based on the execution order of each component node in the business view; The test case generation module is used to generate test cases based on the relationship between the business rule base and the operation process set; The case generation module includes: The model graph unit is used to generate an analysis model graph by using the business rule base and the operation process set as the vertex set and edge set, respectively. A matrix determination unit is used to determine the correlation matrix of the analysis model diagram; different types of correlation relationships are identified in the correlation matrix through different parameter values; The path acquisition unit is used to generate a directed tree corresponding to the association matrix and traverse each of the directed trees to obtain at least one traversal path. A test case generation unit is used to determine the test cases corresponding to each of the traversal paths; The relationships in an association matrix must include at least the following: The business rules in the business rule base are the starting points of the operation processes in the operation process set; The business rules in the business rule base are the endpoints of the operation processes within the operation process set; The business rules in the business rule base are not associated with the operation processes in the operation process set.

7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the test case generation method according to any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the test case generation method of any one of claims 1-5.

Citation Information

Patent Citations

  • Test case generation method and device, computer equipment and storage medium

    CN113419964A