A testing method, apparatus, and computer-readable medium for decision engines.
By intelligently selecting test case groups and performing regression testing, the problem of insufficient verification of decision paths in existing decision engine testing methods is solved, ensuring the stability and reliability of the decision engine in the production environment.
Patent Information
- Application Number
- CN202310330197.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2043-03-30
AI Technical Summary
Existing decision engine testing methods cannot effectively verify decision paths, and the selection of test case groups depends on human determination, which may result in some nodes in complex decision engines not being covered, leading to abnormal results in the production environment.
By intelligently selecting test case groups, generating test case groups and performing regression testing, and generating regression test results, the actual decision engine or test case groups are adjusted based on the results to cover all decision nodes and ensure the integrity and accuracy of the decision path.
This enabled full-coverage testing of the decision engine, improving the completeness and accuracy of the verification logic and reducing the failure rate in the production environment.
Smart Images

Figure CN116340176B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer technology, and in particular relates to a testing method, apparatus and computer-readable medium for decision engines. Background Technology
[0002] A decision engine is a component embedded in an application that separates business decisions from the application code, using predefined semantic modules to write these decisions. The decision engine accepts business data input and then outputs matching business decisions based on the business rules defined by the engine. It is commonly used in finance, information technology, and communications. A decision engine typically includes decision nodes such as decision trees, decision tables, scorecards, and rule sets, and implements complex business logic through combinations of one or more decision nodes.
[0003] Existing testing methods for decision engines involve manually creating several common sets of test data as input. After testing, the actual output is compared with the expected output to verify the correctness of the decision engine's actual execution path. This method has the following drawbacks: First, it only focuses on the correspondence between input and output, without verifying the decision engine's decision path, and it doesn't provide clear results regarding the actual execution path. Therefore, if rule changes cause anomalies during testing, it's impossible to compare the changed decision path with the original one, making troubleshooting difficult. Second, because the test case set selection is manual, the actual execution path of the decision engine is unknown. Therefore, for highly complex decision engines, test cases may not cover all decision nodes. Furthermore, in actual production environments with large input data, execution may reach unverified path branches, leading to recurring abnormal results. Summary of the Invention
[0004] To address the aforementioned problems in the existing technology, embodiments of the present invention provide a testing method, apparatus, and computer-readable medium for decision engines, which can intelligently select test case groups and test all decision nodes in the target decision engine, thereby reducing the failure rate of the target decision engine in a real production environment.
[0005] According to a first aspect of the present invention, a testing method for a decision engine is provided. The method includes: determining a test case group corresponding to a target decision engine; performing regression testing on the target decision engine based on the test case group to generate a first regression test result; the target decision engine being used to indicate the logic of implementing a specific business through a combination of one or more decision nodes; determining whether the first regression test result meets preset conditions; if so, adjusting the actual decision engine or the test case group based on the first regression test result to generate an adjustment result.
[0006] Optionally, determining the test case group corresponding to the target decision engine includes: adding all decision nodes of the target decision engine to the original node list; taking the first decision node in the original node list as the target node; querying the database for test cases matching the target node; adding the test cases matching the target node to the test case group, and removing the target node from the original node list to obtain an updated node list; detecting whether there are still decision nodes in the updated node list; if the detection result indicates that there are no decision nodes in the updated node list, then generating a test case group corresponding to the target decision engine.
[0007] Optionally, determining the test case group corresponding to the target decision engine further includes: if the detection result indicates that a decision node exists in the update node list, then the first decision node in the update node list is taken as the target node; querying the database for test cases that match the target node; adding the test cases that match the target node to the test case group, and removing the target node from the update node list; detecting whether there are still decision nodes in the update node list, until the detection result indicates that there are no decision nodes in the update node list, then generating a test case group corresponding to the target decision engine.
[0008] Optionally, the test case includes: basic information, test case input information, expected result information, and expected path information; wherein, the basic information includes: test case number, test case name, and test case description; the test case input information includes: input parameter variable name and variable value; the expected result information includes: result type and result value; the expected process path information includes: expected node execution path, expected node type, and expected node execution result.
[0009] Optionally, querying the database for test cases that match the target node includes: traversing the expected path information of test cases in the database; if the traversal result indicates that there is expected path information in the database that covers the target node, then the test cases corresponding to the expected path information are used as test cases that match the target node.
[0010] Optionally, the first regression test results include at least: the coverage of decision nodes in the target decision engine, and the actual decision engine execution results and actual decision engine execution paths corresponding to each test case;
[0011] The step of adjusting the actual decision engine based on the first regression test result and generating an adjustment result includes: for any test case in the test case group: based on the first regression test result, obtaining the expected node execution result and expected node execution path of the target decision engine corresponding to the test case; comparing the actual decision engine execution result corresponding to the test case with the expected node execution result; if the comparison result is inconsistent, adjusting the decision node on the actual decision engine path corresponding to the test case based on the expected node execution path corresponding to the test case; generating a first adjustment result; and generating an adjustment result based on the first adjustment results corresponding to several test cases.
[0012] Optionally, the first regression test results include at least: the coverage of decision nodes in the target decision engine, and the actual decision engine execution results and actual decision engine execution paths corresponding to each test case;
[0013] The step of adjusting the test case group based on the regression test results to generate adjustment results includes: for any test case in the test case group: based on the first regression test results, obtaining the expected node execution result and expected node execution path of the target decision engine corresponding to the test case; comparing the actual decision engine execution result corresponding to the test case with the expected node execution result; if the comparison results are inconsistent, determining the problem node of the actual decision engine based on the expected node execution path and the actual decision engine path corresponding to the test case; selecting replacement test cases corresponding to the problem node from the database, and replacing the test cases in the test case group with the replacement test cases; updating the test case group based on the replacement test cases corresponding to several test cases, and generating adjustment results.
[0014] Optionally, the testing method further includes: if the adjustment result indicates that the test case group has been updated, then based on the updated test case group, regression testing is performed on the target decision engine to generate a second regression test result; if the adjustment result indicates that the actual decision engine has been adjusted, then based on the test case group corresponding to the target decision engine, regression testing is performed on the adjusted actual decision engine to generate a second regression test result.
[0015] According to a second aspect of the present invention, a testing apparatus for a decision engine is provided. The testing apparatus includes: a determining module, configured to determine a test case group corresponding to a target decision engine; a first regression testing module, configured to perform regression testing on the target decision engine based on the test case group, and generate a first regression test result; the target decision engine is configured to indicate the logic of implementing a specific business through a combination of one or more decision nodes; a judging module, configured to judge whether the first regression test result meets preset conditions; and an adjusting module, configured to, if so, adjust the actual decision engine or the test case group based on the first regression test result, and generate an adjusting result.
[0016] According to a third aspect of the present invention, a computer-readable medium is also provided, on which a computer program is stored, wherein the program, when executed by a processor, implements the test method as described in the first aspect.
[0017] This invention provides a testing method, apparatus, and computer-readable medium for a decision engine. The method includes: first, determining a test case group corresponding to a target decision engine; second, performing regression testing on the target decision engine based on the test case group to generate a first regression test result; the target decision engine is used to indicate the logic of implementing a specific business through a combination of one or more decision nodes; then, determining whether the first regression test result meets preset conditions; finally, if so, adjusting the actual decision engine or the test case group based on the first regression test result to generate an adjustment result. This embodiment can intelligently select test case groups and adjust the actual decision engine or the test case group when regression testing fails; thus, it can cover all decision nodes of the decision engine based on the test case group, thereby achieving testing of all decision nodes in the decision engine and reducing the failure rate of the decision engine in the production environment. Attached Figure Description
[0018] The following sections will describe some specific embodiments of the invention in detail by way of example and not limitation, with reference to the accompanying drawings. The same reference numerals in the drawings denote the same or similar parts or portions. Those skilled in the art should understand that these drawings are not necessarily drawn to scale. In the drawings:
[0019] Figure 1 This is a flowchart illustrating a testing method for a decision engine in one embodiment of the present invention.
[0020] Figure 2 This is a flowchart illustrating the process of determining a test case group corresponding to the target decision engine in one embodiment of the present invention;
[0021] Figure 3 This is a flowchart illustrating a testing method for a decision engine in another embodiment of the present invention.
[0022] Figure 4 This is a flowchart illustrating a testing method for a decision engine in another embodiment of the present invention.
[0023] Figure 5 This is a schematic diagram of the structure of a test device for a decision engine in one embodiment of the present invention. Detailed Implementation
[0024] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0025] like Figure 1 The diagram shown is a flowchart illustrating a testing method for a decision engine in one embodiment of the present invention.
[0026] A testing method for a decision engine includes at least the following steps:
[0027] S101, Determine the test case group corresponding to the target decision engine;
[0028] S102, Based on the test case group, perform regression testing on the target decision engine and generate the first regression test result; the target decision engine is used to indicate the logic of implementing a specific business through a combination of one or more decision nodes;
[0029] S103, determine whether the results of the first regression test meet the preset conditions; if yes, proceed to S104; if no, proceed to step S105.
[0030] S104, based on the results of the first regression test, adjust the actual decision engine or test case group and generate the adjustment results.
[0031] S105, Operation terminated.
[0032] In S101, the target decision engine includes decision nodes such as a decision tree, decision table, scorecard, and rule set. The number and specific decision nodes of the target decision engine are determined by the business scenario it aims to implement. The coverage of the decision nodes in the target decision engine by the test case group corresponding to the target decision engine can be 100%, 90%, or other values; no specific limitation is made here. The test case group of this invention consists of several test cases intelligently selected by the testing system, maximizing the coverage of all decision nodes in the target decision engine; thereby ensuring the completeness and accuracy of the decision engine's verification logic; and further reducing the failure rate of the decision engine in a real production environment.
[0033] It should be noted that test cases include basic information, test case input information, expected result information, and expected path information. The basic information includes: test case number, test case name, and test case description. The test case input information includes: the names and values of the input parameters of the target decision engine. The expected result information includes: the test result type corresponding to the test case and the result value corresponding to that result type. The expected path information includes: the expected node execution path, the expected node type, and the expected node execution result. Therefore, this embodiment extends the definition of test cases by including the expected node execution path and the execution result of each expected node, which facilitates effective adjustments to the test case group or the actual decision engine based on regression test results in the later stages.
[0034] It's also worth noting that when test case verification fails due to changes in engine logic, regression test results can be used to examine the execution status of each decision node in the actual decision engine path, pinpointing the specific decision node where the problem occurred and thus improving the configuration of the actual decision engine logic. Furthermore, test cases are recorded in the testing system, allowing for repeated verification based on regression testing at any time, avoiding the need for manual re-entry of test cases during retesting, thereby significantly improving the verification efficiency of the decision engine.
[0035] In S102, the regression testing module of the testing system is used to perform regression testing on the target decision engine based on the test case group. Regression testing mainly compares the actual execution result of the decision engine corresponding to the test case with the expected execution result of the node to determine whether the test case passes the test, and adjusts the test case group or the actual decision engine when the test fails.
[0036] This embodiment uses a regression testing module to test the overall configuration of the target decision engine. The first regression test result includes at least node coverage, as well as the actual decision engine execution result and the actual decision engine execution path for each test case. The regression test result also includes information such as the number of test cases in this regression test and the overall test result of the test case group.
[0037] It should be noted that node coverage is used to indicate the ratio of the number of covered decision nodes in the test case group to the total number of decision nodes in the target decision engine.
[0038] In step S103, if the node coverage rate represented by the first regression test result is less than the preset node coverage rate, it indicates that the first regression test result meets the preset conditions. At this point, to meet the business requirements corresponding to the actual decision engine, the test case group is updated based on the first regression test result, thereby generating adjustment results. Alternatively, to meet the business requirements corresponding to the target decision engine, the decision nodes of the actual decision engine are adjusted based on the first regression test result, thereby generating adjustment results. If the node coverage rate represented by the first regression test result is not less than the preset node coverage rate, it indicates that the first regression test result does not meet the preset conditions; at this point, the test case has passed, and the test operation ends.
[0039] This embodiment uses the regression testing module of the testing system to perform regression testing on the test case group. Based on the regression test results, for any test case, the execution result of the actual decision engine corresponding to the test case is compared with the expected node execution result to determine whether the regression test for the test case has passed. Thus, the regression testing module performs full-process connectivity debugging of the target decision engine and displays the comparison between the actual decision engine path and the target decision path in the regression test results. By comparing the decision paths, problematic nodes in the actual decision engine can be quickly located, allowing for effective improvement of the decision path. This ensures that the test case group can cover all decision nodes of the target decision engine to the greatest extent, improving the completeness and accuracy of the target decision engine's verification logic; and consequently reducing the failure rate of the target decision engine in the actual production environment.
[0040] like Figure 2 The diagram shown is a flowchart illustrating the process of determining a test case group corresponding to the target decision engine in one embodiment of the present invention.
[0041] Determine the test case group corresponding to the target decision engine, including at least the following steps:
[0042] S201, add all decision nodes of the target decision engine to the original node list; and set the first decision node in the original node list as the target node;
[0043] S202, Query the database for test cases that match the target node;
[0044] S203: Add the test cases that match the target node to the test case group, and remove the target node from the original node list to obtain the updated node list;
[0045] S204, Check if there are still decision nodes in the updated node list;
[0046] S205, If the detection result characterization update node list does not contain a decision node, then generate a test case group corresponding to the target decision engine;
[0047] S206, if the detection result indicates that there is a decision node in the update node list, then the first decision node in the update node list is taken as the target node; then S202 is executed.
[0048] For example, querying the database for test cases that match the target node includes: traversing the expected path information of test cases in the database; if the traversal result indicates that there is expected path information in the database that covers the target node, then the test cases corresponding to the expected path information are used as test cases that match the target node.
[0049] For example, the specific algorithm defined in the test case group is as follows: All decision nodes of the target decision engine are added to the original node list to be matched. Starting from the first decision node in the original node list, based on the expected path information of the test case, a query is performed from the predefined test cases to find a test case that covers the first decision node. If a test case covering the first decision node is found, that test case is added to the test case group, and the first decision node in the original node list to be matched is removed from the original node list, resulting in an updated node list.
[0050] Next, the updated node list is checked. If the check result indicates that the updated node list is empty, meaning there are no decision nodes to match, the test case group is now defined. If the updated node list is not empty, starting from the first decision node in the updated node list, a recursive calculation is performed according to S202 to find matching test cases, which are then added to the test case group.
[0051] It should be noted that this embodiment determines the test case group corresponding to the target decision engine based on the test case management module of the testing system. In addition to providing operations for adding and configuring test cases within the test case group, the test case management module also provides operations for viewing and deleting test cases within the test case group.
[0052] In this embodiment, based on the expected path information of each test case and the decision nodes covered by the target decision engine, multiple test cases are selected through a recursive algorithm to define a test case group, so as to achieve maximum coverage of all decision nodes on the target decision path by the test case group.
[0053] This embodiment automatically determines the test case group corresponding to the target decision engine based on recursive calculation. Therefore, for target decision logic with high complexity, it can reduce the problem of some decision nodes corresponding to the target decision engine not being covered due to the selection of a few test cases by humans. Then, the target decision engine is verified based on the test case group with 100% node coverage, so that all decision nodes of the entire target decision engine can be tested. This ensures the completeness and accuracy of the decision engine verification logic, thereby reducing the failure rate of the decision engine in the actual production environment.
[0054] like Figure 3 The diagram shown is a flowchart illustrating a testing method for a decision engine in another embodiment of the present invention.
[0055] A testing method for a decision engine, the method comprising at least the following steps:
[0056] S301, Determine the test case group corresponding to the target decision engine;
[0057] S302, Based on the test case group, perform regression testing on the target decision engine and generate the first regression test result; the target decision engine is used to indicate the logic of implementing a specific business through a combination of one or more decision nodes; the first regression test result includes at least: the coverage of decision nodes in the target decision engine, and the actual decision engine execution result and actual decision engine execution path corresponding to each test case;
[0058] S303, determine whether the results of the first regression test meet the preset conditions; if yes, proceed to S304; if no, proceed to S306.
[0059] S304, for any test case in the test case group: based on the first regression test result, obtain the expected node execution result and expected node execution path of the target decision engine corresponding to the test case; compare the actual decision engine execution result corresponding to the test case with the expected node execution result; if the comparison result is inconsistent, adjust the decision node on the actual decision engine path corresponding to the test case based on the expected node execution path corresponding to the test case; generate the first adjustment result;
[0060] S305 generates adjustment results based on the first adjustment results corresponding to several test cases;
[0061] S306, Operation terminated.
[0062] Among them, step S301 and Figure 2 The implementation process is similar; steps S302 and S303 are similar to steps S102 and S103 respectively, and will not be repeated here.
[0063] In S304 to S306, the connectivity testing module of the test system performs adjustment operations on the decision nodes on the test cases or the actual decision engine paths. For any test case in the test case group: the connectivity testing module compares the execution result of the actual decision engine corresponding to the test case with the expected node execution result, and determines whether the test case passes based on the comparison result; if the test case fails, it obtains the expected node execution path and the actual decision engine path corresponding to the test case, and adjusts the decision nodes on the actual decision engine path corresponding to the test case based on the expected node execution path; if the test case passes, it means that the test case meets the test requirements.
[0064] For example, the actual decision engine execution result corresponding to a test case can be the node coverage rate corresponding to the test case.
[0065] For a test case in the test case group: the expected node execution result for this test case is 100% coverage; the actual decision engine execution result for this test case is 67% coverage. The expected node execution path for the test case is decision node 1 - decision node 2 - decision node 3. During the test, due to various reasons, the target decision engine parameters were adjusted, resulting in a difference between the actual decision engine path for the test case and the expected node execution path. The actual decision engine path for the test case is now decision node 1 - decision node 2 - decision node 4. Because the comparison between the actual decision engine execution result and the expected node execution result is inconsistent, decision node 4 in the actual decision engine path is adjusted to decision node 3. This achieves the adjustment of the decision nodes on the actual decision engine path for the test case, generating the first adjustment result. Similarly, the adjustment process for the actual decision engine paths for other test cases is as described above.
[0066] Finally, based on the first test results corresponding to several test cases in the test case group, adjustment results are generated.
[0067] It should be noted that not all decision nodes corresponding to all test cases in the test case group need to be adjusted; only some test cases that do not meet the testing requirements need to have their corresponding decision nodes on the actual decision engine path adjusted.
[0068] like Figure 4 The diagram shown is a flowchart illustrating a testing method for a decision engine in another embodiment of the present invention.
[0069] A testing method for a decision engine, the method comprising at least the following steps:
[0070] S401, Determine the test case group corresponding to the target decision engine;
[0071] S402, Based on the test case group, perform regression testing on the target decision engine and generate the first regression test result; the target decision engine is used to indicate the logic of implementing a specific business through a combination of one or more decision nodes;
[0072] S403, determine whether the results of the first regression test meet the preset conditions; if yes, proceed to S404; if no, proceed to S406.
[0073] S404, for any test case in the test case group: based on the first regression test result, obtain the expected node execution result and expected node execution path of the target decision engine corresponding to the test case; compare the actual decision engine execution result corresponding to the test case with the expected node execution result; if the comparison result is inconsistent, determine the problem node of the actual decision engine based on the expected node execution path and the actual decision engine path corresponding to the test case; select the replacement test case corresponding to the problem node from the database, and use the replacement test case to replace the test case in the test case group;
[0074] S405: Based on the replacement test cases corresponding to several test cases, update the test case group and generate the adjustment results;
[0075] S406, Operation terminated.
[0076] Specifically, in this embodiment, the connectivity testing module compares the actual decision engine execution result with the expected node execution result for each test case to determine whether the test case passes. Thus, the connectivity testing module enables full-process connectivity debugging of the decision engine, and displays a comparison between the actual decision engine path and the expected node execution path in the test results. Finally, by comparing the results, the specific decision node where the problem occurs in the actual decision engine can be quickly located, allowing for the updating of the corresponding test cases for that decision node. This ensures the completeness and accuracy of the actual decision engine's verification logic and reduces the failure rate of the actual decision engine in a real production environment.
[0077] In another preferred embodiment of this example, if the adjustment result indicates that the test case group has been updated, then regression testing is performed on the target decision engine based on the updated test case group to generate a second regression test result; if the adjustment result indicates that the actual decision engine has been adjusted, then regression testing is performed on the adjusted actual decision engine based on the test case group corresponding to the target decision engine to generate a second regression test result.
[0078] Therefore, this embodiment uses a second regression test to perform regression testing on the adjusted actual decision engine or the updated test case group, thereby improving the completeness of the decision engine verification and reducing the failure rate of the decision engine in the actual production environment.
[0079] The testing method for the decision engine in this embodiment will be described in detail below with reference to a specific application.
[0080] Add all decision nodes of the target decision engine to the original node list; and take the first decision node in the original node list as the target node; query the database for test cases that match the target node; add the test cases that match the target node to the test case group, and remove the target node from the original node list to obtain an updated node list; check whether there are still decision nodes in the updated node list; if the detection result indicates that there are no decision nodes in the updated node list, then generate a test case group corresponding to the target decision engine.
[0081] If the detection result indicates that a decision node exists in the update node list, then the first decision node in the update node list is taken as the target node; a test case matching the target node is queried from the database; the test case matching the target node is added to the test case group, and the target node is removed from the update node list; it is checked whether there are still decision nodes in the update node list, until the detection result indicates that there are no decision nodes in the update node list, then a test case group corresponding to the target decision engine is generated.
[0082] Based on the test case set, regression testing is performed on the target decision engine to generate a first regression test result. The target decision engine is used to indicate the logic of implementing a specific business through a combination of one or more decision nodes. It is determined whether the first regression test result meets preset conditions. If so, for any test case in the test case set: based on the first regression test result, the expected node execution result and expected node execution path of the target decision engine corresponding to the test case are obtained; the actual decision engine execution result corresponding to the test case is compared with the expected node execution result; if the comparison result is inconsistent, the decision nodes on the actual decision engine path corresponding to the test case are adjusted based on the expected node execution path; a first adjustment result is generated; based on the first adjustment results corresponding to several test cases, an adjustment result is generated. If the adjustment result indicates that the actual decision engine has been adjusted, regression testing is performed on the adjusted actual decision engine based on the test case set corresponding to the target decision engine to generate a second regression test result.
[0083] It should be noted that the adjusted actual decision engine has the same or similar path as the target decision engine. Therefore, regression testing can be performed on the adjusted actual decision engine based on the test case group corresponding to the target decision engine, thereby effectively verifying the decision path.
[0084] In this embodiment, when the first regression test result fails, the execution status of each step in the actual decision engine path can be viewed based on the first regression test result to locate the specific decision node in the actual decision engine where the problem occurred. This allows for effective adjustments to the actual decision engine to ensure the completeness and accuracy of the actual decision engine's verification logic, thereby reducing the failure rate of the actual decision engine in the actual production environment.
[0085] The testing method for the decision engine in this embodiment will be described in detail below with reference to another specific application.
[0086] Add all decision nodes of the target decision engine to the original node list; and take the first decision node in the original node list as the target node; query the database for test cases that match the target node; add the test cases that match the target node to the test case group, and remove the target node from the original node list to obtain an updated node list; check whether there are still decision nodes in the updated node list; if the detection result indicates that there are no decision nodes in the updated node list, then generate a test case group corresponding to the target decision engine.
[0087] If the detection result indicates that a decision node exists in the update node list, then the first decision node in the update node list is taken as the target node; a test case matching the target node is queried from the database; the test case matching the target node is added to the test case group, and the target node is removed from the update node list; it is checked whether there are still decision nodes in the update node list, until the detection result indicates that there are no decision nodes in the update node list, then a test case group corresponding to the target decision engine is generated.
[0088] Based on the test case set, regression testing is performed on the target decision engine to generate a first regression test result. The target decision engine is used to indicate the logic of implementing a specific business through a combination of one or more decision nodes. It is determined whether the first regression test result meets preset conditions. If so, for any test case in the test case set: based on the first regression test result, the expected node execution result and expected node execution path of the target decision engine corresponding to the test case are obtained; the actual decision engine execution result corresponding to the test case is compared with the expected node execution result; if the comparison result is inconsistent, the problem node of the actual decision engine is determined based on the expected node execution path and the actual decision engine path corresponding to the test case; a replacement test case corresponding to the problem node is selected from the database, and the replacement test case is used to replace the test case in the test case set; based on the replacement test cases corresponding to several test cases, the test case set is updated to generate an adjustment result. If the adjustment result indicates that the test case set has been updated, regression testing is performed on the target decision engine based on the updated test case set to generate a second regression test result.
[0089] In this embodiment, based on the expected decision path of each test case and the decision nodes covered on that path, the system recursively calculates and selects multiple test cases to define a test case group. This test case group ensures that it covers all nodes along the decision flow's process paths. Therefore, by verifying the entire test case group, testing of all component nodes of the entire engine can be achieved, thereby reducing the failure rate of the decision engine in a production environment.
[0090] The various embodiments of the present invention are implemented through programmed processing using a device with processor functionality. Therefore, in practical engineering, the technical solutions and functions of the various embodiments of the present invention can be encapsulated into various modules.
[0091] like Figure 5 The diagram shown is a structural schematic of a testing device for a decision engine in one embodiment of the present invention.
[0092] A testing apparatus for a decision engine, the apparatus 500 comprising: a determining module 501, configured to determine a test case group corresponding to a target decision engine; a first regression testing module 502, configured to perform regression testing on the target decision engine based on the test case group, and generate a first regression test result; the target decision engine being used to indicate the logic of implementing a specific business through a combination of one or more decision nodes; a judging module 503, configured to judge whether the first regression test result meets preset conditions; and an adjusting module 504, configured to, if so, adjust the actual decision engine or the test case group based on the first regression test result, and generate an adjustment result.
[0093] In a preferred embodiment, the determining module includes: a first adding unit, configured to add all decision nodes of the target decision engine to an original node list; and to designate the first decision node in the original node list as the target node; a querying unit, configured to query a database for test cases matching the target node; an obtaining unit, configured to add test cases matching the target node to a test case group, and remove the target node from the original node list to obtain an updated node list; a detection unit, configured to detect whether there are still decision nodes in the updated node list; and a first generating unit, configured to generate a test case group corresponding to the target decision engine if the detection result indicates that there are no decision nodes in the updated node list.
[0094] In a preferred embodiment, the determining module further includes: a determining unit, configured to, if the detection result indicates that a decision node exists in the update node list, take the first decision node in the update node list as the target node; a querying unit, further configured to, query a test case matching the target node from the database; an obtaining unit, further configured to, add the test case matching the target node to the test case group, and remove the target node from the update node list; and a detection unit, further configured to, detect whether there are still decision nodes in the update node list, until the detection result indicates that there are no decision nodes in the update node list, then generate a test case group corresponding to the target decision engine.
[0095] In a preferred embodiment, the test case includes: basic information, test case input information, expected result information, and expected path information; wherein, the basic information includes: test case number, test case name, and test case description; the test case input information includes: input parameter variable name and variable value; the expected result information includes: result type and result value; the expected process path information includes: expected node execution path, expected node type, and expected node execution result.
[0096] In a preferred embodiment, the query unit includes: a traversal subunit, used to traverse the expected path information of test cases in the database; and a determination subunit, used to determine the test cases corresponding to the expected path information as test cases matching the target node if the traversal result indicates that there is expected path information covering the target node in the database.
[0097] In a preferred embodiment, the first regression test result includes at least: the coverage of decision nodes in the target decision engine, and the actual decision engine execution result and actual decision engine execution path corresponding to each test case; the adjustment module includes: an acquisition unit, used for, for any test case in the test case group: based on the first regression test result, acquiring the expected node execution result and expected node execution path of the target decision engine corresponding to the test case; a comparison unit, used for comparing the actual decision engine execution result corresponding to the test case with the expected node execution result; an adjustment unit, used for, if the comparison results are inconsistent, adjusting the decision nodes on the actual decision engine path corresponding to the test case based on the expected node execution path corresponding to the test case; generating a first adjustment result; and a generation unit, used for generating an adjustment result based on the first adjustment result corresponding to several test cases.
[0098] In a preferred embodiment, the first regression test result includes at least: the coverage of decision nodes in the target decision engine, and the actual decision engine execution result and actual decision engine execution path corresponding to each test case; the adjustment module further includes: an acquisition unit, further configured to, for any test case in the test case group: based on the first regression test result, acquire the expected node execution result and expected node execution path of the target decision engine corresponding to the test case; a comparison unit, further configured to compare the actual decision engine execution result corresponding to the test case with the expected node execution result; a determination unit, further configured to, if the comparison results are inconsistent, determine the problem node of the actual decision engine based on the expected node execution path and actual decision engine path corresponding to the test case; a replacement unit, configured to select a replacement test case corresponding to the problem node from the database, and replace the test case in the test case group with the replacement test case; and an update unit, configured to update the test case group based on the replacement test cases corresponding to several test cases, and generate an adjustment result.
[0099] In a preferred embodiment, the apparatus further includes: a second regression testing module, configured to perform regression testing on the target decision engine based on the updated test case group if the adjustment result indicates that the test case group has been updated, and generate a second regression testing result; and a third regression testing module, configured to perform regression testing on the adjusted actual decision engine based on the test case group corresponding to the target decision engine if the adjustment result indicates that the actual decision engine has been adjusted, and generate a second regression testing result.
[0100] The above-described apparatus can execute the testing method for decision engines provided in an embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the testing method for decision engines. Technical details not described in detail in this embodiment can be found in the testing method for decision engines provided in an embodiment of the present invention.
[0101] The present invention also provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the testing method for decision engines described in the present invention.
[0102] In addition to the methods and apparatus described above, embodiments of this application may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps in the methods according to various embodiments of this application described in the "Exemplary Methods" section above.
[0103] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of this application. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0104] Furthermore, embodiments of this application may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps in the methods according to the following embodiments of this application described in the "Exemplary Methods" section above.
[0105] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.
[0106] The basic principles of this application have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this application are merely examples and not limitations, and should not be considered as essential features of each embodiment of this application. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the application to the necessity of employing the aforementioned specific details for implementation.
[0107] The block diagrams of devices, apparatuses, devices, and systems involved in this application are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.
[0108] It should also be noted that in the apparatus, equipment, and methods of this application, the components or steps can be disassembled and / or recombined. These disassemblies and / or recombinations should be considered as equivalent solutions of this application.
[0109] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein can be applied to other aspects without departing from the scope of this application. Therefore, this application is not intended to be limited to the aspects shown herein, but rather to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0110] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this application to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations thereof.
[0111] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.
[0112] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0113] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A testing method for decision engines, characterized in that, include: Identify the test case group corresponding to the target decision engine; Based on the test case group, regression testing is performed on the target decision engine to generate a first regression test result. The first regression test result includes at least: the decision node coverage rate in the target decision engine, and the actual decision engine execution result and actual decision engine execution path corresponding to each test case. The node coverage rate is used to indicate the ratio of the number of covered decision nodes in the test case group to the total number of decision nodes in the target decision engine. The target decision engine is used to indicate the logic for achieving a specific business through a combination of one or more decision nodes; Determine whether the first regression test result meets the preset conditions. If the node coverage rate represented by the first regression test result is less than the preset node coverage rate, it means that the first regression test result meets the preset conditions. If so, then based on the first regression test result, the actual decision engine or the test case group is adjusted to generate an adjustment result; The step of adjusting the actual decision engine based on the first regression test results to generate adjustment results includes: For any test case in the test case group: based on the first regression test result, obtain the expected node execution result and expected node execution path of the target decision engine corresponding to the test case; compare the actual decision engine execution result corresponding to the test case with the expected node execution result; If the comparison results are inconsistent, the decision nodes on the actual decision engine path corresponding to the test case are adjusted based on the expected node execution path corresponding to the test case; and a first adjustment result is generated. Based on the first adjustment results corresponding to several test cases, the adjustment results are generated.
2. The test method according to claim 1, characterized in that, The determination of the test case group corresponding to the target decision engine includes: Add all decision nodes of the target decision engine to the original node list; and set the first decision node in the original node list as the target node; Retrieve test cases from the database that match the target node; Add the test cases that match the target node to the test case group, and remove the target node from the original node list to obtain the updated node list; Check whether there are still decision nodes in the updated node list; If the detection results indicate that there is no decision node in the update node list, then a test case group corresponding to the target decision engine is generated.
3. The test method according to claim 2, characterized in that, Also includes: If the detection result indicates that there is a decision node in the updated node list, then the first decision node in the updated node list is taken as the target node. Add the test cases that match the target node to the test case group, and remove the target node from the update node list; Check whether there are still decision nodes in the update node list. Continue until the detection result indicates that there are no decision nodes in the update node list, then generate a test case group corresponding to the target decision engine.
4. The test method according to claim 2, characterized in that, The test cases include: basic information, test case input information, expected result information, and expected path information; wherein, the basic information includes: test case number, test case name, and test case description; the test case input information includes: input parameter variable name and variable value; the expected result information includes: result type and result value; the expected process path information includes: expected node execution path, expected node type, and expected node execution result.
5. The test method according to claim 4, characterized in that, The step of querying the database for test cases that match the target node includes: Traverse the database to find the expected path information of the test cases; If the traversal result indicates that there is expected path information covering the target node in the database, then the test cases corresponding to the expected path information are used as test cases matching the target node.
6. The test method according to claim 1, characterized in that, The step of adjusting the test case group based on the first regression test result and generating an adjustment result includes: For any test case in the test case group: Based on the first regression test result, obtain the expected node execution result and expected node execution path of the target decision engine corresponding to the test case; compare the actual decision engine execution result corresponding to the test case with the expected node execution result; if the comparison result is inconsistent, determine the problem node of the actual decision engine based on the expected node execution path and the actual decision engine path corresponding to the test case; select a replacement test case corresponding to the problem node from the database, and use the replacement test case to replace the test case in the test case group; Based on the replacement test cases corresponding to several test cases, the test case group is updated to generate adjustment results.
7. The test method according to claim 1, characterized in that, Also includes: If the adjustment result characterization updates the test case group, then based on the updated test case group, regression testing is performed on the target decision engine to generate a second regression test result; If the adjustment result indicates that the actual decision engine has been adjusted, then regression testing is performed on the adjusted actual decision engine based on the test case group corresponding to the target decision engine to generate a second regression test result.
8. A testing device for a decision engine, characterized in that, include: The determination module is used to determine the test case group corresponding to the target decision engine; The first regression testing module is used to perform regression testing on the target decision engine based on the test case group and generate the first regression test result. The first regression test result includes at least: the decision node coverage rate in the target decision engine, and the actual decision engine execution result and actual decision engine execution path corresponding to each test case. The node coverage rate is used to indicate the ratio of the number of covered decision nodes in the test case group to the total number of decision nodes in the target decision engine. The target decision engine is used to indicate the logic of implementing a specific business through a combination of one or more decision nodes. The judgment module is used to determine whether the first regression test result meets the preset conditions. If the node coverage rate of the first regression test result is less than the preset node coverage rate, it means that the first regression test result meets the preset conditions. An adjustment module is configured to, if so, adjust the actual decision engine or the test case group based on the first regression test result, and generate an adjustment result, wherein the adjustment of the actual decision engine based on the first regression test result and the generation of the adjustment result includes: For any test case in the test case group: based on the first regression test result, obtain the expected node execution result and expected node execution path of the target decision engine corresponding to the test case; compare the actual decision engine execution result corresponding to the test case with the expected node execution result; If the comparison results are inconsistent, the decision nodes on the actual decision engine path corresponding to the test case are adjusted based on the expected node execution path corresponding to the test case; and a first adjustment result is generated. Based on the first adjustment results corresponding to several test cases, the adjustment results are generated.
9. A computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the test method as described in any one of claims 1-7.
Citation Information
Patent Citations
Regression test method and device and computing equipment
CN111831564A