Test coverage determination method and device, equipment, storage medium and program product
By determining the business model and functional path of business transaction data, calculating the test coverage with the test case data, and identifying the untested functional paths, the problem of low test coverage in the existing technology is solved, and the comprehensiveness and stability of business function testing is achieved.
Patent Information
- Application Number
- CN202411603393.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-03-04
AI Technical Summary
In the prior art, the test coverage of business functions is not high, resulting in low comprehensiveness of business function testing, which affects the actual operation stability of business functions.
By obtaining the business transaction data to be tested, determining its corresponding business model and node configuration information, traversing the node configuration information to generate all functional paths, obtaining test case data to determine the target functional path, and finally calculating the target test coverage and identifying the untested functional path.
Accurate analysis of the coverage of test cases is achieved, ensuring the comprehensiveness and reliability of business function testing, thereby ensuring the actual operational stability of business functions.
Smart Images

Figure CN119557214A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a test coverage determination method, apparatus, device, storage medium and program product. Background Art
[0002] With the continuous development of Internet technology, the degree of digitalization in the financial and other fields is constantly deepening. Correspondingly, the types of online business functions are also increasing. Before the online business functions are actually put into use, testers usually need to test the business functions, so that the program vulnerabilities involved in the business functions can be adjusted in time.
[0003] In related technologies, testers usually manually write test cases based on their own understanding of the business function operation logic. Test specific functional paths. However, since the operation logic of business functions is relatively complex and there may be multiple logical branches, the test method based on testers manually writing test cases is likely to result in low coverage of test cases and low comprehensiveness of business function testing, which in turn affects the stability of the actual operation of business functions. Summary of the invention
[0004] The embodiments of the present application provide a test coverage determination method, apparatus, equipment, storage medium and program product, which can achieve accurate analysis of test case coverage, ensure the comprehensiveness of business function testing, and further ensure the stability of business functions during actual operation.
[0005] In a first aspect, an embodiment of the present application provides a method for determining test coverage, comprising:
[0006] Acquire business transaction data to be tested, and determine the business model corresponding to the business transaction data;
[0007] Determine node configuration information corresponding to the business model;
[0008] Traversing the node configuration information to generate all functional paths included in the business model;
[0009] Acquire test case data corresponding to the business transaction data, and determine a target functional path according to the test case data; the target functional path is a functional path for which a test case exists in the business model;
[0010] According to the target functional path and all functional paths included in the business model, a target test coverage is determined, and untested functional paths are determined among all the functional paths.
[0011] In a possible implementation manner, determining the business model corresponding to the business transaction data includes:
[0012] Determine a plurality of nodes included in the business transaction data; the plurality of nodes include a start node, an end node, a branch node, and a function node;
[0013] A business model corresponding to the business transaction data is determined according to the multiple nodes and the execution processes corresponding to the business transaction data.
[0014] In a possible implementation, the determining the node configuration information corresponding to the service model includes:
[0015] According to the execution process of the business model, determine the successor node corresponding to each node in the business model, and obtain the node association information corresponding to each node;
[0016] Node configuration information corresponding to the business model is generated according to the node identifiers of the respective nodes and the node association information.
[0017] In a possible implementation, traversing the node configuration information to generate all functional paths included in the business model includes:
[0018] Searching for a starting node in the node configuration information;
[0019] Determining a first successor node corresponding to the starting node according to the node association information of the starting node;
[0020] Generate a target number of functional paths according to the target number of the first successor nodes, and add the first successor nodes to the functional paths;
[0021] For each of the functional paths, the second successor node is continuously searched according to the node configuration information until the functional path includes a termination node, thereby obtaining all the functional paths included in the business model.
[0022] In a possible implementation manner, determining the target test coverage according to the target functional path and all functional paths included in the business model, and determining an untested functional path among all functional paths includes:
[0023] Determining the target test coverage according to the ratio of the number of the target functional paths to the total number of all functional paths;
[0024] Among all the functional paths, other functional paths except the target functional path are determined as the untested functional paths.
[0025] In a possible implementation manner, the functional path is represented by a character string; each character in the character string represents a node.
[0026] In a second aspect, an embodiment of the present application provides a test coverage determination device, comprising:
[0027] An acquisition module, used to acquire the business transaction data to be tested and determine the business model corresponding to the business transaction data;
[0028] A first determination module, used to determine the node configuration information corresponding to the business model;
[0029] A generation module, used to traverse the node configuration information and generate all functional paths included in the business model;
[0030] A second determination module is used to obtain test case data corresponding to the business transaction data, and determine a target functional path according to the test case data; the target functional path is a functional path for which a test case exists in the business model;
[0031] The third determination module is used to determine the target test coverage according to the target functional path and all functional paths included in the business model, and to determine the untested functional paths among all the functional paths.
[0032] In a possible implementation manner, the acquisition module is specifically configured to:
[0033] Determine a plurality of nodes included in the business transaction data; the plurality of nodes include a start node, an end node, a branch node, and a function node;
[0034] A business model corresponding to the business transaction data is determined according to the multiple nodes and the execution processes corresponding to the business transaction data.
[0035] In a possible implementation manner, the first determining module is specifically configured to:
[0036] According to the execution process of the business model, determine the successor node corresponding to each node in the business model, and obtain the node association information corresponding to each node;
[0037] Node configuration information corresponding to the business model is generated according to the node identifiers of the respective nodes and the node association information.
[0038] In a possible implementation manner, the generating module is specifically used to:
[0039] Searching for a starting node in the node configuration information;
[0040] Determining a first successor node corresponding to the starting node according to the node association information of the starting node;
[0041] Generate a target number of functional paths according to the target number of the first successor nodes, and add the first successor nodes to the functional paths;
[0042] For each of the functional paths, the second successor node is continuously searched according to the node configuration information until the functional path includes a termination node, thereby obtaining all the functional paths included in the business model.
[0043] In a possible implementation manner, the third determining module is specifically configured to:
[0044] Determining the target test coverage according to the ratio of the number of the target functional paths to the total number of all functional paths;
[0045] Among all the functional paths, other functional paths except the target functional path are determined as the untested functional paths.
[0046] In a possible implementation manner, the functional path is represented by a character string; each character in the character string represents a node.
[0047] In a third aspect, an embodiment of the present application provides a test coverage determination device, including: a memory, a processor;
[0048] The memory stores computer-executable instructions;
[0049] The processor executes the computer-executable instructions stored in the memory, so that the processor performs the test coverage determination method as described in any one of the first aspects above.
[0050] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer execution instructions, and when the computer execution instructions are executed by a processor, they are used to implement the test coverage determination method as described in any one of the first aspects above.
[0051] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the test coverage determination method as described in any one of the first aspects above.
[0052] The test coverage determination method, device, equipment, storage medium and program product provided in the embodiment of the present application obtain business transaction data to be tested, and determine the business model corresponding to the business transaction data; determine the node configuration information corresponding to the business model; traverse the node configuration information to generate all functional paths included in the business model; obtain the test case data corresponding to the business transaction data, and determine the target functional path according to the test case data; the target functional path is the functional path for which the test case exists in the business model; determine the target test coverage according to the target functional path and all functional paths included in the business model, and determine the untested functional path in all functional paths. In the present application, the electronic device determines the business model of the business transaction data, and further determines the node configuration information corresponding to the business model, and then traverses the node configuration information to determine all functional paths included in the business model, and then determines the target functional path for which the corresponding test case exists according to the test case data, and finally determines the target test coverage and the untested functional path according to the target functional path and all functional paths included in the business model. In this way, the electronic equipment can achieve accurate analysis of the target test coverage. Combined with the automatic determination process of untested functional paths, it can provide effective reminders to testers, ensure the comprehensiveness and reliability of the test, and thus ensure the stability of the business functions during actual operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0054] Figure 1 A flowchart of a method for determining test coverage provided in an embodiment of the present application;
[0055] Figure 2 A flowchart of another test coverage determination method provided in an embodiment of the present application;
[0056] Figure 3 A schematic diagram of a business model provided for an exemplary embodiment of the present application;
[0057] Figure 4 A schematic diagram of the architecture of a test coverage determination system provided for an exemplary embodiment of the present application;
[0058] Figure 5 A schematic diagram of the structure of a test coverage determination device provided in an embodiment of the present application;
[0059] Figure 6 A structural schematic diagram of a test coverage determination device provided in an embodiment of the present application.
[0060] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0061] In order to enable those skilled in the art to better understand the technical solution of the present application, the present application is further described in detail below in conjunction with the drawings and embodiments. It should be understood that the specific embodiments and drawings described herein are only used to explain the present application, and are not intended to limit the present application.
[0062] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation portals for users to choose to authorize or refuse. In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of user data information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good customs.
[0063] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0064] It should be noted that the test coverage determination method, device, equipment, storage medium and program product of the present application can be used in the field of big data technology, and can also be used in any field outside the field of big data technology. The present application does not limit the specific application field of the test coverage determination method, device, equipment, storage medium and program product.
[0065] First, the terms involved in this application are explained:
[0066] Testing coverage: Testing coverage is an evaluation of the completeness of testing. Testing coverage is represented by the coverage of test requirements and test cases or the coverage of executed code. Coverage is a means of measuring test completeness and a measure of test effectiveness.
[0067] Path coverage: Path coverage refers to designing several test cases and running the program under test so that each possible path of the program is executed at least once. Path coverage is the coverage technique with the highest coverage rate.
[0068] White box testing: White box testing is also called structural testing, transparent box testing, logic-driven testing or code-based testing. White box testing is a test case design method. The box refers to the software being tested, and the white box means that the box is visible, that is, it is clear what is inside the box and how it works. White box testing specifically refers to a comprehensive understanding of the internal logical structure of the program and testing all logical paths. White box testing is an exhaustive path test. When using this white box test, the tester needs to check the internal structure of the program, starting from checking the logic of the program to obtain test data. The number of independent paths through the program is large.
[0069] Black box testing: Black box testing is to test whether each function can be used normally through testing. In black box testing, the tester regards the program as a black box that cannot be opened. Without considering the internal structure and internal characteristics of the program, the test is conducted on the program interface. It only checks whether the program functions are used normally according to the requirements specification and whether the program can properly receive input data and generate correct output information. Black box testing focuses on the external structure of the program, without considering the internal logical structure, and mainly tests the software interface and software functions. Black box testing is conducted from the user's perspective, starting from the correspondence between input data and output data.
[0070] In the actual testing process, the path coverage testing method is theoretically a white box test, which is used for coverage testing of program paths. It is implemented by developers who have a clear understanding of the program processing logic. Since the number of paths after the branch logic combination in a complex program is huge, it is unlikely to be fully covered by test cases, so the feasibility of using the path coverage method in white box testing is not high.
[0071] In the related art, the test for business transactions is usually functional testing, which belongs to black box testing. Testers write cases for testing based on their understanding of business functions. However, due to the relatively complex operation logic of business functions and the existence of multiple logical branches, some business logic branches are usually not covered in the actual testing process, resulting in low coverage of test cases, low comprehensiveness of business function testing, and inability to effectively discover program vulnerabilities (bugs), which in turn leads to low stability in the actual operation process of business functions, i.e., the production process.
[0072] In order to solve the above problems, the present application provides a test coverage determination method, device, equipment, storage medium and program product. The electronic device obtains the business transaction data to be tested, first determines the business model of the business transaction data, and then determines the node configuration information corresponding to the business model; then traverses the node configuration information to determine all functional paths included in the business model; then, based on the test case data, determines the target functional path for which the corresponding test case exists, and finally determines the target test coverage and untested functional paths based on the target functional path and all functional paths included in the business model. In this way, the electronic device realizes the accurate analysis of the target test coverage, and at the same time, combined with the automatic determination process of the untested functional path, it can realize effective reminders for testers, ensure the comprehensiveness and reliability of the test, and thus ensure the stability of the actual operation of the business function.
[0073] The scheme shown in the present application is described in detail below through specific embodiments. It should be noted that the following embodiments can exist independently or in combination with each other, and the same or similar contents will not be described repeatedly in different embodiments.
[0074] Figure 1 A flowchart of a test coverage determination method provided in an embodiment of the present application. Figure 1 , the test coverage determination method may include:
[0075] S101. Acquire business transaction data to be tested, and determine a business model corresponding to the business transaction data.
[0076] The execution subject of the embodiment of the present application can be an electronic device, such as a mobile phone, a computer, etc., and can be a test coverage determination system installed in the electronic device, or a test coverage determination device set in the electronic device. The test coverage determination device can be implemented by software, or by a combination of software and hardware. For ease of understanding, the following description will be given by taking the execution subject as an electronic device as an example.
[0077] In the embodiment of the present application, business transaction data refers to the business transaction to be tested, which can realize one or more business functions. The business transaction data may include the nodes involved in the business transaction, the connection relationship between the nodes, and the input and output data of the nodes. The business model may refer to the model corresponding to the business transaction data, and the business model may include nodes and business execution processes.
[0078] Specifically, the electronic device can obtain the business transaction data that needs to be tested, and then parse and process the business transaction data. Specifically, it can determine a series of independent functions included in the business transaction data through methods such as standard function points, and determine each node in the business transaction data and the execution process between each node based on the actual process and logical branches in the business transaction data, and finally convert the business transaction data into a business model composed of nodes and execution processes.
[0079] S102: Determine node configuration information corresponding to the business model.
[0080] In an embodiment of the present application, node configuration information may refer to the specific configuration information of each node in the business model, and the node configuration information may include a business transaction identifier, a node identifier, and node association information. Among them, the business transaction identifier may refer to the identification information corresponding to the business transaction data, that is, the identification information corresponding to the business model, and may specifically refer to the business model number, etc. The node identifier may refer to the specific identifier of the node, for example, it may refer to the node number (or sequence number) and the node name. Node association information refers to the association relationship between nodes, such as the association relationship between the current node and the successor node corresponding to the current node.
[0081] Specifically, after the electronic device determines the business model corresponding to the business transaction data, it can create a node configuration table, which may include fields such as business transaction identification and node configuration information. The electronic device can add the node name and node association information of each node to the node configuration table according to the nodes and execution processes in the business model, and finally generate the node configuration information corresponding to the business model.
[0082] S103: traverse the node configuration information to generate all functional paths included in the business model.
[0083] In an embodiment of the present application, a functional path may refer to a specific execution path of a business transaction function included in a business model, and the functional path may specifically be composed of a plurality of nodes arranged according to an execution process.
[0084] Specifically, after determining the node configuration information corresponding to the business model, the electronic device can traverse the node configuration information, calculate all functional paths included in the business model, and determine the total number of all functional paths of the business model.
[0085] S104. Acquire test case data corresponding to the business transaction data, and determine a target functional path according to the test case data; the target functional path is a functional path for which a test case exists in the business model.
[0086] In the embodiment of the present application, the test case data may refer to each test case corresponding to the business transaction data, and each test case may be used to test a functional path in the business model. The target functional path may refer to a functional path in the business model for which a corresponding test case exists.
[0087] In this step, the electronic device can obtain the test case data corresponding to the business transaction data, and then analyze and process the test case data, and determine the target functional path in the business model according to the correspondence between the test case data and the functional path.
[0088] S105. Determine the target test coverage according to the target functional path and all functional paths included in the business model, and determine the untested functional paths among all functional paths.
[0089] In the embodiment of the present application, the target test coverage may refer to the proportion of the target functional paths with corresponding test cases in all functional paths. The untested functional paths may refer to the functional paths without corresponding test cases and not covered by the functional tests.
[0090] In this step, the electronic device determines all functional paths of the business model, and after determining the target functional path in the business model, the target test coverage can be determined according to the number of target functional paths and the total number of all functional paths, and the untested functional paths can be determined according to the target functional paths and all functional paths. The electronic device can then output the target test coverage and the untested functional paths to provide timely and effective reminders to the testers, facilitating the testers to add test cases in a timely manner and ensuring the comprehensiveness and reliability of the functional test.
[0091] The test coverage determination method provided in the embodiment of the present application, the electronic device obtains the business transaction data to be tested, and determines the business model corresponding to the business transaction data; determines the node configuration information corresponding to the business model; traverses the node configuration information, and generates all functional paths included in the business model; obtains the test case data corresponding to the business transaction data, and determines the target functional path according to the test case data; the target functional path is the functional path with test cases in the business model; according to the target functional path and all functional paths included in the business model, the target test coverage is determined, and the untested functional path is determined in all functional paths. In the present application, the electronic device determines the business model of the business transaction data, and further determines the node configuration information corresponding to the business model, and then traverses the node configuration information to determine all functional paths included in the business model, and then determines the target functional path with corresponding test cases according to the test case data, and finally determines the target test coverage and the untested functional path according to the target functional path and all functional paths included in the business model. In this way, the electronic device realizes the accurate analysis of the target test coverage, and at the same time, combined with the automatic determination process of the untested functional path, it can realize the effective reminder for the tester, which can ensure the comprehensiveness and reliability of the test, and then ensure the stability of the actual operation of the business function.
[0092] Based on the above embodiments, Figure 2 A flowchart of another test coverage determination method provided in an embodiment of the present application. Figure 2 , the test coverage determination method may include:
[0093] S201. Acquire business transaction data to be tested, and determine multiple nodes included in the business transaction data; the multiple nodes include a start node, an end node, a branch node, and a function node.
[0094] S202: Determine a business model corresponding to the business transaction data according to the multiple nodes and the execution processes corresponding to the business transaction data.
[0095] In the embodiment of the present application, a node may refer to each processing unit in the business transaction data, and may specifically include types such as a start node, an end node, a branch node, and a function node. Among them, a start node may refer to an initial node in the business transaction data, which has no corresponding upstream node, and the start node may be represented by S; an end node may refer to an end node of each business function in the business transaction data, which has no corresponding downstream node, and the end node may be represented by E; a branch node may refer to a node with a logical branch in the business transaction data, which may correspond to one upstream node and multiple downstream nodes, and the branch node may be represented by letters such as Z, Y, X, and W. A function node may refer to a specific function processing unit in the business transaction data, which has one corresponding upstream node and one downstream node, and the function node may be represented by letters such as a, b, c, and d.
[0096] Specifically, after obtaining the business transaction data to be tested, the electronic device can determine a series of independent functions corresponding to the business transaction data based on analysis algorithms such as the standard function point method, and at the same time, combined with the execution process of the business transaction, convert the business transaction data into a business model composed of nodes and execution processes. Specifically, it can be based on the execution process. Connect various types of nodes in series to obtain a complete business model including multiple business function paths. In this way, by determining the business model corresponding to the business transaction data, the electronic device facilitates the subsequent digital expression of the business transaction data, which can ensure the simplicity of the data and thus improve the calculation efficiency of the target test coverage.
[0097] For example, Figure 3 A schematic diagram of a business model provided in an embodiment of the present application. Figure 3 As shown, the business model includes a start node S and an end node E, and also includes function nodes a, b, c, d, e, f, g, h and branch nodes Z and Y. Different types of nodes are connected in series according to the execution process of business transaction data.
[0098] In a possible implementation manner, the function path in the embodiment of the present application is represented by a string; each character in the string represents a node.
[0099] In the embodiment of the present application, the electronic device can represent the function path with a digitized string, and each character in the string represents a node. Specifically, the electronic device can represent the function path with a string composed of a series of nodes according to the execution process of the actual business logic. The string corresponding to a function path starts with the starting node S and ends with the ending node E. Figure 3As shown, the function path including function nodes a, b, c, and f in the business model can be represented by a string SabZcfE. In this way, the embodiment of the present application uses a string to represent the function path, which can realize the digital expression of the function path and ensure the efficiency of subsequent test coverage calculation.
[0100] S203. According to the execution process of the business model, determine the successor node corresponding to each node in the business model, and obtain the node association information corresponding to each node; according to the node identification and node association information of each node, generate the node configuration information corresponding to the business model.
[0101] In the embodiment of the present application, the successor node may refer to the next node adjacent to each node in the business model. The node association information may refer to the association relationship between the current node and the successor node. In this step, after determining the business model, the electronic device may determine the successor node corresponding to each node in the business model according to the execution process in the business model, determine the node association information corresponding to each node, and then generate the node configuration information corresponding to the business model according to the node identifier and the node association information.
[0102] In an embodiment of the present application, when determining the node configuration information corresponding to the business model, the electronic device may first create a node configuration table, which may include fields such as business transaction code, node serial number, node name, and node configuration. Afterwards, the electronic device may start with the starting node S of the business model, configure each node one by one, and add the node name and node association information of each node to the node configuration table. For example, the electronic device may add the node association information Z (c, d, e) of the branch node Z to the node configuration field, and the node in the brackets identifies the successor node of the branch node Z, and the electronic device may add the node name Z of the branch node Z to the node name field. By analogy, the electronic device configures the nodes one by one until the termination node E of the business model is configured, and finally a complete node configuration table corresponding to the business model can be obtained. The information in the node configuration table is the node configuration information corresponding to the business model.
[0103] Exemplarily, Table 1 shows a complete node configuration table including node configuration information. Figure 3 The business models shown correspond to the following:
[0104] Business transaction code Node number Node Name Node Configuration 1001 1 S S(a) 1001 2 a a(b) 1001 3 b b(Z) 1001 4 Z Z(c,d,e) 1001 5 c c(f) 1001 6 d d(E) 1001 7 e e(Y) 1001 8 f f(E) 1001 9 Y Y(g,h) 1001 10 g g(E) 1001 11 h h(E)
[0105] In an embodiment of the present application, the electronic device generates node configuration information corresponding to the business model by creating a node configuration table and adding the node identifier and node association information in the business model to the node configuration table. The flexible configuration capability for each node in the functional path is the basis for the digital processing of the functional path. The electronic device configures each node to determine the node configuration information including each node, which can facilitate the flexible processing of the program, and can also realize flexible changes through the node configuration information when the functional path changes due to changes in the business processing logic. In addition, it can also facilitate the subsequent statistics of the number of functional paths.
[0106] S204, searching for a start node in the node configuration information; and determining a first successor node corresponding to the start node according to the node association information of the start node.
[0107] S205 . Generate a target number of functional paths according to the target number of the first successor node, and add the first successor node to the functional path.
[0108] S206. For each functional path, continue to search for a second successor node according to the node configuration information until the functional path includes a termination node, thereby obtaining all functional paths included in the business model.
[0109] In the embodiment of the present application, the first successor node refers to the successor node corresponding to the start node; the second successor node may refer to the successor node corresponding to the last node in the function path. The target number may refer to the number of successor nodes corresponding to each node.
[0110] In this step, the electronic device can calculate all functional paths of the business model by traversing the node configuration information. Since the expression and configuration of the functional path are digitalized, the electronic device can calculate all functional paths of a certain business model by accessing and processing the node configuration table. Specifically, the electronic device can first find the starting node S in the node configuration information, and then the electronic device can use S as the initial string; then the first successor node corresponding to the starting node and the target number of the first successor node can be determined according to the node association information of the starting node. If the target number is 1, the electronic device can splice the node name of the first successor node at the end of the initial string; if the target number is greater than 1, the electronic device can copy the initial string, generate a target number of strings to represent the target number of functional paths, and splice the node names of the first successor nodes at the end of the target number of strings.
[0111] By analogy, the electronic device can use the last character of each string as the node name, search for the second successor node corresponding to the node name, and perform similar processing of the above steps according to the number of the second successor nodes, until each string includes the termination node E. At this time, the electronic device can determine that the traversal of the functional path in the node configuration information is completed, and finally the electronic device can obtain multiple strings with the first character S and the last character E, each of which can represent a functional path, so as to determine all functional paths in the business model.
[0112] Combination Figure 3 As shown in Table 1, the electronic device can specifically traverse the node configuration information in the following manner to obtain all functional paths in the business model:
[0113] (1) For the initial string S, find the first successor node of S through S(a) in the node configuration information, and then concatenate a to S to generate the string Sa.
[0114] (2) Find the node configuration information a(b) of a through a, and then concatenate b to Sa to generate the string Sab.
[0115] (3) Find the b node configuration information b(Z) through the last character b of the string, and then concatenate Z to generate the string SabZ.
[0116] (4) By finding the Z node configuration information Z(c, d, e) through Z, we know that Z has multiple successor nodes. Therefore, we copy three strings according to the target number of its successor nodes, and concatenate c, d, and e in sequence, thus generating the strings SabZc, SabZd, and SabZe.
[0117] (5) According to the last character of each of the three strings, obtain the successor node information of c, d, and e, and generate the strings SabZcf, SabZdE, and SabZeY.
[0118] (6) Similarly, the electronic device finally generates the character strings SabZcfE, SabZdE, SabZeYgE, and SabZeYhE, and obtains four functional paths, which are all the functional paths in the business model.
[0119] It should be noted that the specific forms of the above characters and character strings are merely examples, and electronic devices may also use other encoding methods to represent functional paths, which may have other corresponding representation forms, and may be flexibly set based on actual needs, and the embodiments of the present application do not limit this.
[0120] S207. Acquire test case data corresponding to the business transaction data, and determine a target functional path according to the test case data; the target functional path is a functional path for which a test case exists in the business model.
[0121] S208. Determine the target test coverage according to the ratio of the number of target functional paths to the total number of all functional paths; among all functional paths, determine other functional paths except the target functional paths as untested functional paths.
[0122] In the embodiment of the present application, the electronic device can obtain the test case data, and then use the business transaction identifier and the function path as the primary key to number the test cases in the test case data, and can register and store them in the test case database. After the electronic device determines all the function paths corresponding to the business model, it can determine the string set of all the function paths and the total number of all the function paths, and the string set of all the function paths can be expressed as A{function path}.
[0123] Afterwards, the electronic device can determine the target functional path with test cases in the business model, obtain the character string set of the target functional path and the number of the target functional paths, and the character string set of the target functional path can be expressed as B{target functional path}. Afterwards, the electronic device can determine the ratio of the number of target functional paths to the total number of all functional paths in the business model as the target test coverage, and at the same time, other functional paths except the target functional path in all functional paths can be regarded as untested functional paths, that is, untested functional paths = A{all functional paths}-B{target functional paths}. In this way, the electronic device determines the target functional path with test cases in the business model, and determines the target test coverage corresponding to the business transaction data based on all functional paths of the business model, and at the same time can determine the untested functional path, which can realize accurate analysis of test coverage and automatic and accurate identification of untested functional paths.
[0124] If the target test coverage of business transaction data is not equal to 100%, the electronic device can determine that there are functional paths in the business transaction data that have not been tested, that is, the test cases corresponding to the business transaction data are incomplete, and some logical branches have not been effectively tested. Based on the digital static analysis of business transaction data, the electronic device can quickly determine the target test coverage of business transaction data, quickly identify untested functional paths, and provide effective reminders and guidance for testers to add test cases, which can ensure the comprehensiveness and reliability of the test, and thus ensure the stability of the actual operation of business functions.
[0125] Based on the above embodiments, the test coverage determination method in the embodiments of the present application can be implemented by a test coverage determination system. The test coverage system may include a business model conversion unit, a node configuration unit, a function path traversal unit, and a static analysis unit. For example, Figure 4 An architectural diagram of a test coverage determination system provided for an embodiment of the present application. As shown in Figure 4, the electronic device can convert the acquired business transaction data model into a business model based on the business model conversion unit. Then, the electronic device can determine the node configuration information corresponding to the business model through the node configuration unit; then determine all functional paths in the business model through the functional path traversal unit; then determine the target functional path in the business model based on the test case data through the static analysis unit, determine the target test coverage and untested functional paths based on the target functional path and all functional paths, and provide reminders and guidance to testers. Testers can add test cases for untested functional paths, enrich test case data, and ensure the comprehensiveness and reliability of the test.
[0126] In an embodiment of the present application, based on the small number of logical branch combinations in the business transaction data, the electronic device uses the path coverage method used in the white-box test in the functional testing phase of the black-box test through digital expression and digital configuration, performs effective static analysis of the test coverage, outputs the target test coverage and untested functional paths, and reminds the testers to quickly supplement the test cases to ensure the comprehensiveness of the business transaction data testing.
[0127] In an embodiment of the present application, the electronic device realizes the digital expression of the functional path based on the business model corresponding to the business transaction data by digitally representing the nodes in the business model, and realizes the target test coverage analysis of the business transaction test through the node configuration unit, the functional path traversal unit and the static analysis unit, timely discovers the functional path of the incomplete test, realizes effective reminder to the tester, and can improve the reliability and comprehensiveness of the test.
[0128] Figure 5 A schematic diagram of a test coverage determination device provided in an embodiment of the present application. Figure 5 , the test coverage determination device 50 may include:
[0129] The acquisition module 51 is used to acquire the business transaction data to be tested and determine the business model corresponding to the business transaction data;
[0130] A first determination module 52, used to determine node configuration information corresponding to the business model;
[0131] A generating module 53, used to traverse the node configuration information and generate all functional paths included in the business model;
[0132] The second determination module 54 is used to obtain the test case data corresponding to the business transaction data, and determine the target functional path according to the test case data; the target functional path is the functional path for which the test case exists in the business model;
[0133] The third determination module 55 is used to determine the target test coverage according to the target functional path and all functional paths included in the business model, and to determine the untested functional paths among all functional paths.
[0134] In a possible implementation, the acquisition module 51 is specifically configured to:
[0135] Determine a plurality of nodes included in the business transaction data; the plurality of nodes include a start node, an end node, a branch node, and a function node;
[0136] According to the execution processes corresponding to the multiple nodes and the business transaction data, a business model corresponding to the business transaction data is determined.
[0137] In a possible implementation manner, the first determining module 52 is specifically configured to:
[0138] According to the execution process of the business model, the successor nodes corresponding to each node in the business model are determined, and the node association information corresponding to each node is obtained;
[0139] Node configuration information corresponding to the business model is generated according to the node identification and node association information of each node.
[0140] In a possible implementation, the generating module 53 is specifically configured to:
[0141] Find the starting node in the node configuration information;
[0142] Determine the first successor node corresponding to the starting node according to the node association information of the starting node;
[0143] According to the target number of the first successor node, generate a target number of functional paths, and add the first successor node to the functional path;
[0144] For each functional path, the second successor node is continuously searched according to the node configuration information until the functional path includes the termination node, thereby obtaining all functional paths included in the business model.
[0145] In a possible implementation manner, the third determining module 54 is specifically configured to:
[0146] Determine the target test coverage based on the ratio of the number of target functional paths to the total number of all functional paths;
[0147] Among all functional paths, other functional paths except the target functional path are determined as untested functional paths.
[0148] In a possible implementation, the function path is represented by a string; each character in the string represents a node.
[0149] The test coverage determination device 50 provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0150] Figure 6 A schematic diagram of a test coverage determination device provided in an embodiment of the present application. Figure 6 The test coverage determination device 60 may include: a memory 61 and a processor 62. Exemplarily, the memory 61 and the processor 62 are interconnected via a bus 63.
[0151] The memory 61 is used to store program instructions;
[0152] The processor 62 is used to execute the program instructions stored in the memory to implement the test coverage determination method shown in the above embodiment.
[0153] Figure 6 The test coverage determination device 60 shown can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0154] An embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the above-mentioned test coverage determination method.
[0155] An embodiment of the present application may also provide a computer program product, including a computer program, which, when executed by a processor, can implement the above-mentioned test coverage determination method.
[0156] It should be noted that the processor mentioned in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0157] It should be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct RAM bus random access memory (DR RAM). It should be noted that when the processor is a general purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, the memory (storage module) is integrated in the processor. It should be noted that the memory described herein is intended to include but is not limited to these and any other suitable types of memory.
[0158] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0159] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0160] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0161] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0162] Regarding the various modules / units contained in the various devices and products described in the above embodiments, they may be software modules / units, or hardware modules / units, or they may be partially software modules / units and partially hardware modules / units. Each device and product may be applied to or integrated in a chip, a chip module or a terminal device. Exemplarily, for each device and product applied to or integrated in a chip, each module / chip contained therein may be implemented in the form of hardware such as circuits, or at least some modules / units may be implemented in the form of software programs, which run on a processor integrated inside the chip, and the remaining modules / units may be implemented in the form of hardware such as circuits.
[0163] In the present application, the term "include" and its variations may refer to non-restrictive inclusion; the term "or" and its variations may refer to "and / or". The terms "first", "second", etc. in the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. In the present application, "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previously associated objects are in an "or" relationship.
[0164] The above are only some embodiments of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for determining test coverage, characterized in that: include: Acquire business transaction data to be tested, and determine the business model corresponding to the business transaction data; Determine node configuration information corresponding to the business model; Traversing the node configuration information to generate all functional paths included in the business model; Acquire test case data corresponding to the business transaction data, and determine a target functional path according to the test case data; the target functional path is a functional path for which a test case exists in the business model; According to the target functional path and all functional paths included in the business model, a target test coverage is determined, and untested functional paths are determined among all the functional paths.
2. The method according to claim 1, characterized in that The determining the business model corresponding to the business transaction data includes: Determine a plurality of nodes included in the business transaction data; the plurality of nodes include a start node, an end node, a branch node, and a function node; A business model corresponding to the business transaction data is determined according to the multiple nodes and the execution processes corresponding to the business transaction data.
3. The method according to claim 1, characterized in that The determining the node configuration information corresponding to the business model includes: According to the execution process of the business model, determine the successor node corresponding to each node in the business model, and obtain the node association information corresponding to each node; Node configuration information corresponding to the business model is generated according to the node identifiers of the respective nodes and the node association information.
4. The method according to claim 3, characterized in that The traversing the node configuration information to generate all functional paths included in the business model includes: Searching for a starting node in the node configuration information; Determining a first successor node corresponding to the starting node according to the node association information of the starting node; Generate a target number of functional paths according to the target number of the first successor nodes, and add the first successor nodes to the functional paths; For each of the functional paths, the second successor node is continuously searched according to the node configuration information until the functional path includes a termination node, thereby obtaining all the functional paths included in the business model.
5. The method according to claim 1, characterized in that The step of determining target test coverage according to the target functional path and all functional paths included in the business model, and determining untested functional paths among all functional paths, includes: Determining the target test coverage according to the ratio of the number of the target functional paths to the total number of all functional paths; Among all the functional paths, other functional paths except the target functional path are determined as the untested functional paths.
6. The method according to any one of claims 1 to 5, characterized in that: The function path is represented by a character string; each character in the character string represents a node.
7. A test coverage determination device, characterized in that: include: An acquisition module, used to acquire the business transaction data to be tested and determine the business model corresponding to the business transaction data; A first determination module, used to determine the node configuration information corresponding to the business model; A generation module, used to traverse the node configuration information and generate all functional paths included in the business model; A second determination module is used to obtain test case data corresponding to the business transaction data, and determine a target functional path according to the test case data; the target functional path is a functional path for which a test case exists in the business model; The third determination module is used to determine the target test coverage according to the target functional path and all functional paths included in the business model, and to determine the untested functional paths among all the functional paths.
8. A test coverage determination device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the test coverage determination method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the test coverage determination method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, which implements the test coverage determination method according to any one of claims 1 to 6 when executed by a processor.