Test case generation methods, devices, electronic devices, and storage media

By generating rule constraint graphs for the decision engine and automatically generating test cases, the problem of low test case generation efficiency in existing technologies is solved, and automated test case generation and verification are achieved, thereby improving the testing efficiency of the decision engine strategy configuration package.

CN123114977APending Publication Date: 2026-11-17TONGDUN NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611431609.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-15
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In existing technologies, the generation efficiency of policy execution configuration package test cases for decision engines is low, mainly relying on manual writing and manual verification, resulting in low efficiency.

Method used

By acquiring the strategy configuration document of the decision engine, a rule constraint graph is generated, and test cases are automatically generated based on the rule constraint graph, including pattern matching and condition tree construction. Single judgment conditions and logical combination relationships are identified, test cases are generated and compared with expected results to determine the verification status.

Benefits of technology

It improves the efficiency of test case generation, realizes automated test case generation and verification, reduces manual intervention, and improves the testing efficiency of the decision engine strategy configuration package.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123114977A_ABST
    Figure CN123114977A_ABST
Patent Text Reader

Abstract

The test case generation method, apparatus, electronic device, storage medium, and computer program product provided in this disclosure relate to the field of computer technology. The method provided in this disclosure can generate a rule constraint graph of a target decision engine based on a strategy configuration document, and then automatically generate test cases based on the rule constraint graph, thereby improving the efficiency of test case generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Decision engines are widely used in business scenarios such as financial risk control, insurance underwriting, and credit approval. They are responsible for making real-time judgments and decisions on business requests based on pre-configured policy rules. As business rules are continuously updated, the policy configuration of the decision engine becomes increasingly complex, thus placing higher demands on the testing and verification of the policy execution configuration package loaded by the decision engine.

[0003] Currently, the verification testing of policy execution configuration packages mainly relies on manually writing test cases and manually executing them for verification. Testers need to understand the rule logic line by line based on the policy configuration document (including policies and rules), manually construct test cases, and then submit them one by one to the decision engine for execution and manually compare the output results. However, this method of generating test cases is inefficient. Therefore, how to improve the efficiency of test case generation has become an urgent technical problem to be solved.

[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] The purpose of this disclosure is to provide a test case generation method, apparatus, electronic device, storage medium, and computer program product that can improve the efficiency of test case generation.

[0006] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part by practice of this disclosure.

[0007] According to one aspect of this disclosure, a test case generation method is provided, comprising: obtaining a strategy configuration document of a target decision engine; generating a rule constraint graph of the target decision engine based on the strategy configuration document; and generating test cases based on the rule constraint graph.

[0008] Optionally, generating test cases based on the rule constraint graph includes: performing pattern matching on the rule expressions in the rule constraint graph to identify single judgment conditions and logical combination relationships; constructing a condition tree based on the single judgment conditions and logical combination relationships; and generating test cases based on the condition tree.

[0009] Optionally, the method further includes: obtaining the test results output by the target decision engine after executing the test cases, wherein the target decision engine loads a strategy execution configuration package, and the strategy execution configuration package is generated based on the strategy configuration document; comparing the test results with the expected test results to obtain a comparison result; and determining the verification status of the strategy execution configuration package based on the comparison result.

[0010] Optionally, comparing the test results with the expected test results to obtain a comparison result includes: performing a semantic comparison between the test results and the expected test results to obtain a semantic comparison result; Determining the verification status of the policy execution configuration package based on the comparison results includes: determining the verification status of the policy execution configuration package based on the semantic comparison results.

[0011] Optionally, before obtaining the test results output by the target decision engine after executing the test cases, the method further includes: detecting whether the verification fingerprint of the policy execution configuration package matches the verification fingerprint of the policy configuration document; if they match, sending the test cases to the target decision engine so that the target decision engine can execute the test cases.

[0012] Optionally, the method further includes: establishing a multi-layered verification evidence model based on the target decision engine, the multi-layered verification evidence model including multiple verification evidence layers; the test results including test sub-results collected by each verification evidence layer; the expected test results including expected test sub-results corresponding to each verification evidence layer; comparing the test results with the expected test results to obtain comparison results, including: comparing multiple test sub-results with multiple expected test sub-results to obtain multiple comparison sub-results; determining the verification status of the strategy execution configuration package based on the comparison results, including: determining the verification status of the strategy execution configuration package based on the multiple comparison sub-results.

[0013] According to another aspect of this disclosure, a test case generation apparatus is provided, comprising: an acquisition module for acquiring a strategy configuration document of a target decision engine; a first generation module for generating a rule constraint graph of the target decision engine based on the strategy configuration document; and a second generation module for generating test cases based on the rule constraint graph.

[0014] According to another aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any of the aforementioned test case generation methods by executing the executable instructions.

[0015] According to another aspect of this disclosure, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that the computer program, when executed by a processor, implements any of the aforementioned test case generation methods.

[0016] According to another aspect of this disclosure, a computer program product is provided, which, when executed by a processor, implements any of the aforementioned test case generation methods.

[0017] The test case generation method, apparatus, electronic device, storage medium, and computer program product provided in this disclosure relate to the field of computer technology. The method provided in this disclosure can generate a rule constraint graph of a target decision engine based on a strategy configuration document, and then automatically generate test cases based on the rule constraint graph, thereby improving the efficiency of test case generation.

[0018] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0020] Figure 1 A flowchart illustrating a test case generation method according to an embodiment of this disclosure is shown. Figure 2 A flowchart illustrating another test case generation method in an embodiment of this disclosure is shown. Figure 3 This diagram illustrates a flowchart of a method for determining the verification status of a policy execution configuration package according to an embodiment of the present disclosure. Figure 4 This diagram illustrates the structure of a test case generation device according to an embodiment of the present disclosure. Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation

[0021] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0022] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0023] In related technologies, the verification testing of the policy execution configuration package loaded by the decision engine mainly relies on manually writing test cases and manually executing them. Testers need to understand the rule logic line by line according to the policy configuration document (including policies and rules), manually construct test cases, and then submit them to the decision engine for execution one by one, manually comparing the output results. However, this method of generating test cases is inefficient. Therefore, how to improve the efficiency of test case generation has become an urgent technical problem to be solved.

[0024] Therefore, embodiments of this disclosure provide a test case generation method, apparatus, electronic device, and storage medium, which can improve the efficiency of test case generation.

[0025] The test case generation method provided in this disclosure will be described in detail below with reference to the accompanying drawings and through some embodiments and application scenarios. The test case generation method provided in this disclosure is applied to electronic devices, such as mobile phones, tablets, laptops, PDAs, netbooks, or servers, etc., and this disclosure does not impose specific limitations on them. Figure 1 This diagram illustrates a flowchart of a test case generation method according to an embodiment of the present disclosure, including the following steps: S102, Obtain the strategy configuration document for the target decision engine.

[0026] In this step, the strategy configuration document can be a document that describes the strategy rules, conditional expressions, scoring functions, routing paths, data interface call relationships, and the correspondence between business scenarios and strategy versions in the target decision engine.

[0027] Policy configuration documents can originate from the target decision engine's policy management platform, version release system, rule configuration system, etc. Methods for obtaining policy configuration documents include reading them online from the policy management platform, retrieving the configuration file corresponding to the current release version from the version release system, and reading exported policy configuration files from local or remote storage.

[0028] After obtaining the policy configuration document, it can be standardized to ensure that the rule definitions, field names, conditional expressions, scoring functions, routing paths, and business scenario descriptions conform to a preset parsing format. Standardization can include unifying field naming formats, conditional expression syntax, scoring function parameter formats, routing path descriptions, and normalizing business semantic descriptions from different sources or versions of policy configuration documents into standard semantic identifiers.

[0029] After standardization, the policy rules, conditional branches, scoring functions, routing paths, and business scenario information in the policy configuration document can be uniformly parsed in subsequent steps to construct a rule constraint graph.

[0030] S104, Generate the rule constraint graph of the target decision engine according to the strategy configuration document.

[0031] The core of this step is to construct a structured rule constraint graph based on the acquired and standardized policy configuration document through parsing and association.

[0032] First, structured information of different dimensions can be extracted from multiple data pages (e.g., sheet pages) of the strategy configuration document (e.g., an Excel file). Extracted content can include strategies, sub-strategies, rule sets, rules, functions, fields, and third-party data interfaces. Specifically, strategy identifiers and business types can be extracted from the "Scenario Strategy" page; rule set definitions and routing conditions from the "Rule Set" page; rule expressions and input parameter fields from the "Rule" page; calculation logic from the "Function" page; the mapping between field names and system codes from the "Field Management" page; and external data interfaces and ETL (Extract-Transform-Load) logic from the "Third-Party Data" page. During the extraction process, automatic header row detection can be performed on each data page, using a keyword matching scoring mechanism to determine the header, adapting to different document formats.

[0033] After extracting information from each dimension, cross-dimensional relationships between them are automatically established. This includes mapping Chinese field names referenced in rule expressions to field codes within the system; establishing dependencies between the input fields of rules and the output fields of third-party data interfaces; and establishing mapping relationships between rule sets and the routing conditions of their respective policies.

[0034] Finally, by integrating the above nodes and relationships, a structured directed graph model, namely the rule constraint graph, is output. The nodes in the rule constraint graph include policies, sub-policies, rule sets, rules, functions, fields, and third-party data interfaces, while the edges in the rule constraint graph represent constraints such as route affiliation, conditional references, field dependencies, and data flow.

[0035] S106, Generate test cases based on the rule constraint diagram.

[0036] In this step, the rule constraint graph generated in step S104 can be used as direct input to generate multiple test cases (i.e., test case sets) through a series of automated processes.

[0037] First, all nodes (such as rules, functions, and fields) and edges (such as dependencies and routing relationships) in the rule constraint graph can be traversed to create a complete test case generation context for each rule to be tested. This context includes all necessary information such as the rule expression, field information, preconditions, associated functions, and dependent third-party data interfaces.

[0038] Next, the regular expression is normalized, for example, by unifying full-width / half-width characters, whitespace characters, and comparison operators. Then, the expression is parsed into a condition tree according to the precedence of logical operations (parentheses, NOT, AND, OR), and different patterns such as comparison, enumeration, and time windows are identified.

[0039] Based on the parsed condition tree, the system can automatically generate test cases. For conditions such as "greater than" and "equal to", it can generate values ​​that meet the rule, values ​​that do not meet the rule, and boundary values ​​(such as the threshold itself, the threshold plus or minus one). For compound conditions connected by "AND", it can generate test cases that satisfy all conditions (i.e., positive cases) and test cases that only satisfy one condition at a time (i.e., negative cases). For compound conditions connected by "OR", it can generate test cases that satisfy only one branch, satisfy multiple branches simultaneously, and satisfy none of the branches.

[0040] Subsequently, based on the field dependencies (mapping and referencing relationships between fields and data sources) established in the rule constraint diagram, the necessary data is automatically completed for the derived test values. For example, it determines whether a certain value should be written into the main request parameter or as a simulated response from a third-party data interface. At the same time, it supplements each test case with required common parameters such as business serial number and customer number, and generates a unique test identifier.

[0041] Based on the generation of independent test cases, the system can identify the overall architecture of the strategy (such as layered, flat, or hybrid architecture) and generate combined test cases covering different business routes and scenarios accordingly. For example, for a layered architecture, it ensures that each reachable route has corresponding test case coverage.

[0042] For each generated test case, the system can independently calculate its expected execution result, i.e., the expected test result (i.e., the test oracle), based on the locked strategy configuration and rule constraint graph. This process will sequentially simulate the truth or falsehood of a single condition, the hit status of a rule, the output of a function, the risk level, and finally the final decision.

[0043] Finally, all generated candidate test cases are deduplicated and converged. The system will build a coverage target matrix, prioritizing the retention of test cases that can cover new scenarios (such as new routing branches and boundary conditions), merging or deleting duplicate test cases that do not add new coverage targets, and finally forming a concise and efficient test case set.

[0044] Compared to manually generating test cases, the embodiments of this disclosure can generate a rule constraint graph of the target decision engine based on the strategy configuration document, and then automatically generate test cases based on the rule constraint graph, thereby improving the efficiency of test case generation.

[0045] In some embodiments of this disclosure, such as Figure 2 As shown, step S106 may include the following sub-steps: S1062, perform pattern matching on the rule expressions in the rule constraint graph to identify single judgment conditions and logical combination relationships.

[0046] This step first normalizes the regular expression, then performs pattern matching on the normalized expression using a pattern registry, identifying various single judgment conditions such as comparison patterns, range patterns, enumeration patterns, Boolean patterns, compound condition patterns (AND / OR), negative threshold patterns, and time window patterns. Simultaneously, it identifies the logical combinations between these single judgment conditions, including AND, OR, NOT, and nested parentheses. When multiple patterns match simultaneously, conflicts are resolved based on field type consistency, contextual integrity, and pattern priority, ultimately outputting each single judgment condition and its logical combination structure.

[0047] S1064, Based on the single judgment condition and the logical combination relationship, construct a condition tree.

[0048] This step parses the expression into a condition tree according to the priority of logical operations, namely parentheses, NOT, AND, and OR. The condition tree consists of logical nodes and single-condition nodes. Logical nodes record AND, OR, or NOT types, while single-condition nodes record field codes, comparison operators, and threshold information. Based on this, for each single-condition in the condition tree, the hit value that makes the condition true, the miss value that makes it false, and the boundary value are derived. For discrete integer thresholds, boundary values ​​are generated using N, N-1, or N+1. For continuous numerical values, a minimum offset is generated according to the field precision, and the expected difference between ">" and ">=" at the critical point is strictly distinguished.

[0049] S1066, Generate test cases based on the condition tree.

[0050] This step combines the test values ​​of each individual decision condition based on the logical combination relationships in the condition tree. For compound conditions connected by AND, it generates positive cases where all conditions are satisfied, and negative cases where only one condition is not satisfied each time. For compound conditions connected by OR, it generates test cases where only one branch is satisfied, multiple branches are satisfied, and none of the branches are satisfied. After combination, for each test case, its expected execution result, i.e., the expected test result, is calculated independently based solely on the locked strategy configuration and rule constraint graph. This calculation process sequentially simulates the truth or falsity of individual decision conditions, the hit status of rules, the output of functions, the risk level, and finally the final decision, binding the expected test results with the corresponding test cases, ultimately forming a test case set carrying the expected test results.

[0051] In some embodiments of this disclosure, such as Figure 3 As shown, the method may further include: S108, Obtain the test results output by the target decision engine after executing the test cases. The target decision engine has a strategy execution configuration package loaded, which is generated based on the strategy configuration document.

[0052] In this step, the target decision engine is the runtime execution framework. After loading the strategy execution configuration package, it receives test cases as input, executes them step by step according to the decision flow, rules and functions defined in the strategy execution configuration package, and finally outputs the test results.

[0053] The strategy execution configuration package is generated based on the strategy configuration document, which describes the dependencies and constraints between strategy rules. After being orchestrated and packaged, the strategy execution configuration package is deployed to the decision engine for execution.

[0054] S110, compare the test results with the expected test results to obtain a comparison result.

[0055] In this step, the actual test results output by the target decision engine are compared with the expected test results carried in the test cases. The comparison results indicate whether the two are consistent.

[0056] S112, Based on the comparison results, determine the verification status of the strategy execution configuration package.

[0057] In this step, the verification status of the policy execution configuration package can be determined based on the comparison results. If the test results match the expected test results, it means that the rules in the configuration package are configured correctly, and the verification passes. If they do not match, it means that there are rule configuration errors in the configuration package, and the verification fails.

[0058] The verification status of a strategy execution configuration package is "verification passed" when all test cases included in the package pass the comparison. If any test case fails the comparison, the verification status of the package is marked as "verification failed."

[0059] In a more specific implementation, during the comparison of test results and expected test results, a multi-dimensional comparison engine can normalize the test results and expected test results into a unified standard semantics before performing an equivalence determination to obtain a semantic comparison result. The multi-dimensional comparison engine supports four comparison strategies: alias group matching, version-limited unique alias matching, numerical tolerance matching, and direct matching. These strategies are configured according to strategy identifiers, strategy versions, and rule types. Each comparison rule can specify the applicable strategy combination and tolerance threshold. Only when the test result can be uniquely normalized to the same standard semantics as the expected test result can the semantic comparison result of that test case be considered passed. If there is no mapping, one-to-many mapping, or mapping conflicts, it is considered a failure.

[0060] Before step S108, the method may further include the following steps: detecting whether the verification fingerprint of the policy execution configuration package matches the verification fingerprint of the policy configuration document; if they match, sending the test case to the target decision engine so that the target decision engine can execute the test case.

[0061] The purpose of this step is to ensure, before executing the test, that the strategy configuration document on which the strategy execution configuration package actually loaded by the target decision engine is based is consistent with the strategy configuration document on which the test cases are generated, thereby avoiding invalid tests.

[0062] Specifically, a mapping between the verification fingerprint of the policy execution configuration package and the verification fingerprint of the policy configuration document can be established in advance. Before executing test cases, the verification fingerprints of the two can be obtained and compared.

[0063] When the two match (i.e., a correspondence exists), it can be determined that the policy configuration document upon which the policy execution configuration package currently loaded by the target decision engine is based is consistent with the policy configuration document upon which the test cases were generated. Therefore, test cases can be sent to the target decision engine. Conversely, if the two do not match, sending test cases can be stopped and an alarm can be output to avoid invalid testing.

[0064] In addition, verification fingerprints can be generated for test cases, thereby binding the test cases, the policy configuration documents on which the test cases are based, and the policy configuration documents on which the policy execution configuration package is based, thus avoiding invalid test results.

[0065] When executing a strategy, the target decision engine goes through multiple stages, including overall decision-making, route distribution, rule matching, and function computation. The strategy here refers to the content defined in the aforementioned strategy execution configuration package, including routing rules, sub-strategies, rule sets, and function configurations. Based on these execution stages, a multi-layered verification evidence model is established, dividing the verification perspective into an overall decision-making evidence layer, a routing and sub-strategy evidence layer, a rule execution evidence layer, a function computation evidence layer, and a full-link log evidence layer.

[0066] After test cases are input into the target decision engine, the engine executes them according to the rules defined in the strategy execution configuration package. Each verification evidence layer collects actual execution data from the corresponding stage of the target decision engine, forming the test sub-results for each layer. Specifically, the overall decision evidence layer collects the final risk level and decision conclusion; the routing and sub-strategy evidence layer collects the routing path and triggered sub-strategies; the rule execution evidence layer collects the rule set hit status; the function computation evidence layer collects the function input, output, and scoring results; and the full-link log evidence layer collects the call results and exception information in the full-link log. Each layer can record the test case number, execution record identifier, hierarchy code, node identifier, parent node identifier, expected result, actual result, verification conclusion, strategy version, build artifact verification fingerprint, and timestamp.

[0067] When generating test cases, the results that should be produced at each layer are derived in advance based on the rule logic in the rule constraint diagram, which serve as the expected test sub-results for each layer.

[0068] The verification process employs a lightweight-first, then heavy-weight query strategy. It prioritizes acquiring structured, lightweight evidence from the overall decision-making evidence layer, routing and sub-policy evidence layer, rule execution evidence layer, and function computation evidence layer. The test sub-results of each layer are compared layer by layer with the expected test sub-results of the corresponding layer, yielding multiple comparison sub-results. Only when verification fails or further troubleshooting is required is the full-link log evidence layer queried for in-depth diagnosis. Finally, a traceable chain of evidence is formed using test case numbers, execution record identifiers, and parent-child node relationships.

[0069] The content collected and compared at each verification evidence layer, including routing rules, sub-policies, rule sets, and function configurations, all belong to the content defined by the policy execution configuration package. Therefore, based on multiple comparison sub-results, the verification status of the policy execution configuration package at each execution stage can be determined, pinpointing the fault to a specific stage within the policy execution configuration package. For example, if the comparison sub-results of the overall decision evidence layer indicate that the test result is inconsistent with the expected result, it indicates an anomaly in the overall decision configuration; if the comparison sub-results of the routing and sub-policy evidence layers indicate that the actual result is inconsistent with the expected result, it indicates an anomaly in the routing or sub-policy configuration; if the comparison sub-results of the rule execution evidence layer indicate that the actual result is inconsistent with the expected result, it indicates an anomaly in the rule configuration; and if the comparison sub-results of the function computation evidence layer indicate that the actual result is inconsistent with the expected result, it indicates an anomaly in the function computation configuration.

[0070] The system can employ an incremental generation mechanism to record and manage test execution results, forming the basis for layered execution evidence. Specifically, the system independently and incrementally writes the execution results of each test case into the execution details file without triggering a full reconstruction of the existing execution details.

[0071] The execution details file serves as an index for tiered execution evidence and coverage reports. The data structure it records includes, but is not limited to, the following fields: test case number, scenario, type, expected result, actual result, test status, execution time, execution record identifier, test data, and third-party data.

[0072] Through the incremental generation method described above, the system can efficiently persist test results during test execution or after execution interruption, ensuring data integrity and traceability, and providing accurate data indexes for subsequent coverage report generation.

[0073] Based on test cases and layered execution evidence, a structured coverage report can be generated. This step specifically includes: calculating rule coverage, function branch coverage, and decision flow branch coverage respectively; recording unreachable objects, manually confirmed objects, and other uncovered objects, and noting the reasons for their uncovering; and associating the above coverage results with test object binding record identifiers, build artifact verification fingerprints, and execution record identifiers to ensure the report's traceability.

[0074] In one optional implementation, the aforementioned layered execution evidence and coverage report can be encapsulated, and an independent controlled remediation service can be invoked to receive the verified remediation patch output by that service. Specifically, layered execution evidence, coverage report, expected test result version identifier, test object binding record identifier, and execution record identifier can be output to form an evidence package. The evidence package is sent to the controlled remediation service, which generates and verifies a remediation patch based on the evidence, and then returns a patch identifier, target use case, allowed test data or execution parameters, verification results, and handling status. The testing system re-verifies the returned patch, checking the patch target use case, test object binding record identifier, allowed field whitelist, differences before and after modification, integrity check value, and verification status. Only when all verifications pass and the patch does not modify the policy rules and the current expected test results is it applied to the test data, third-party data simulation configuration, or execution parameters, and proceeds to the next round of verification. If the application fails, it rolls back to the state before the patch. The core output of this embodiment is the layered execution evidence and coverage report. The internal problem classification, remediation action mapping, manual review access control, and multi-round convergence control of the controlled remediation service are implemented by an independent controlled remediation method.

[0075] In the specific implementation process, when transmitting test cases to the decision engine test interface, this embodiment of the disclosure can adopt a combination of session authentication management, batch submission, and breakpoint resumption for data transmission control. Specifically, before each submission operation is executed, the system extracts the current authentication token from the browser session or interface authentication context and verifies the login status and token validity. When an invalid token or expired session is detected, the system prompts the user to re-authenticate. Only after successful authentication can subsequent submission operations continue, thereby ensuring the legitimacy and security of interface access during transmission.

[0076] During the submission and execution phase, the system can fragment the set of test cases to be transmitted according to a configurable batch size and send them to the decision engine test interface in batches at configurable time intervals. By controlling the amount of data and the frequency of each request, the system effectively avoids interface conflicts and system overload caused by large-scale concurrent requests, thus improving the stability of the transmission process. If transmission is interrupted due to session expiration, network anomalies, or other unforeseen failures, the system automatically records the sequence number of the last successfully submitted test case as the breakpoint. After the user completes re-authentication or the network returns to normal, the system continues the transmission task from the next unsubmitted test case based on the recorded breakpoint, without needing to retransmit all submitted test cases. This significantly improves fault tolerance and execution efficiency in scenarios involving large-scale test case transmission. The three mechanisms—session authentication management, batch submission, and breakpoint resumption—work together to achieve secure authentication, orderly submission, and anomaly recovery of test cases during transmission, solving technical problems such as authentication failure, concurrency conflicts, and full reruns after interruption when transmitting large batches of test cases to the decision engine interface.

[0077] To more clearly describe the principles of the embodiments of this disclosure, relevant examples are provided below.

[0078] First, the strategy configuration document can be parsed to extract "Example Rule 017" and its logical expression "the number of abnormal records in the last 30 days is not less than 3 and the application amount is greater than 500,000" from the "Rules" page. Then, the system code "apply_amount" corresponding to "application amount" and the calculated field "abnormal_count_30d" corresponding to "the number of abnormal records in the last 30 days" can be extracted from the "Field Management" page to form structured information.

[0079] Then, establish cross-dimensional relationships, including the conditional reference relationship between rules and fields, the data flow relationship between fields and data sources (e.g., "abnormal_count_30d" needs to call the "Example External Risk Data Interface" and be summarized by a 30-day window), and the routing affiliation relationship between rule sets and sub-policies (e.g., "Example Rule 017" belongs to the "Abnormal Information Verification" rule set, which is assigned to the "Enterprise Subject Sub-policy"), and generate a rule constraint diagram accordingly.

[0080] Subsequently, pattern matching is performed on the rule expressions in the rule constraint graph to identify the two single judgment conditions "abnormal_count_30d>=3" and "apply_amount>500000" and their "AND" logical combination relationship, and a condition tree is constructed based on this.

[0081] Finally, test cases are automatically generated based on the condition tree and rule constraint diagram. Specifically, this includes: decomposing the condition tree to derive boundary value combinations and calculating the expected test results. For example, for a boundary hit test case, setting "Number of anomalies = 3, Amount = 500,001", condition A (number of anomalies in the last 30 days is no less than 3) and condition B (application amount is greater than 500,000) are both met, the target rule is hit, and the expected test result is "Fail". For a test case where only condition A is not met, setting "Number of anomalies = 2, Amount = 500,001", condition A is not met but condition B is met. Because the logical combination relationship is "AND", the target rule is not hit, and the expected test result is "Pass". For a test case where only condition B is not met, setting "Number of anomalies = 3, Amount = 500,000", condition A is met but condition B is not met. Because the logical combination relationship is "AND", the target rule is not hit, and the expected test result is "Pass". For test cases where neither condition A nor condition B is met, setting "Number of exceptions = 2, Amount = 500,000" results in both condition A and condition B being false, the target rule not being hit, and the expected test result being "Pass". Through this method, the system automatically generates test cases covering all logical combinations based on the branches of the condition tree and independently calculates the expected test result for each test case, achieving automated generation of test cases and expected test results.

[0082] The following reference Figure 4 This describes a test case generation apparatus 4 according to such an embodiment of the present disclosure. Figure 4 The test case generation device 4 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments disclosed herein.

[0083] The test case generation device 4 can be represented as a software module. Components of the test case generation device 4 may include, but are not limited to: an acquisition module 402, used to acquire the strategy configuration document of the target decision engine; a first generation module 404, used to generate a rule constraint graph of the target decision engine based on the strategy configuration document; and a second generation module 406, used to generate test cases based on the rule constraint graph.

[0084] The following reference Figure 5 To describe an electronic device 5 according to such an embodiment of the present disclosure. Figure 5 The electronic device 5 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0085] like Figure 5As shown, the electronic device 5 is presented in the form of a general-purpose computing device. The components of the electronic device 5 may include, but are not limited to: at least one processing unit 501, at least one storage unit 502, and a bus 503 connecting different system components (including storage unit 502 and processing unit 501).

[0086] The storage unit stores program code that can be executed by the processing unit 501, causing the processing unit 501 to perform the steps described in the "Exemplary Methods" section above according to various exemplary embodiments of this disclosure.

[0087] Storage unit 502 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 5021 and / or a cache memory unit 5022, and may further include a read-only memory unit (ROM) 5023.

[0088] Storage unit 502 may also include a program / utility 5024 having a set (at least one) program module 5025, such program module 5025 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0089] Bus 503 can represent one or more of several bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0090] Electronic device 5 can also communicate with one or more external devices 506 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 5, and / or with any device that enables electronic device 5 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed through input / output (I / O) interface 504. Furthermore, electronic device 5 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 505. Figure 5 As shown, network adapter 505 communicates with other modules of electronic device 5 via bus 503. It should be understood that, although... Figure 5 As not shown in the diagram, other hardware and / or software modules may be used in conjunction with electronic device 5, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0091] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or electronic device, etc.) to execute the method according to the embodiments of this disclosure.

[0092] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, having stored thereon a program product capable of implementing the methods described above. In some possible implementations, various aspects of this disclosure may also be implemented as a program product including program code that, when run on an electronic device, causes the electronic device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure.

[0093] The program product for implementing the above-described method according to embodiments of this disclosure may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on an electronic device, such as a personal computer. However, the program product of this disclosure is not limited thereto. In this document, the readable storage medium may be any tangible medium that includes or stores a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0094] The program product may employ 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, but not limited to, 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: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0095] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0096] The program code included on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, fiber optic, RF, etc., or any suitable combination thereof.

[0097] Program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute 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. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0098] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0099] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0100] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or electronic device, etc.) to execute the methods according to the embodiments of this disclosure.

[0101] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.

Claims

1. A test case generation method, characterized in that, include: Obtain the strategy configuration document for the target decision engine; Based on the strategy configuration document, generate the rule constraint graph of the target decision engine; Test cases are generated based on the rule constraint diagram.

2. The test case generation method according to claim 1, characterized in that, The step of generating test cases based on the rule constraint graph includes: Pattern matching is performed on the rule expressions in the rule constraint graph to identify single judgment conditions and logical combination relationships; Based on the single judgment condition and the logical combination relationship, construct a condition tree; Test cases are generated based on the condition tree.

3. The test case generation method according to claim 1, characterized in that, Also includes: Obtain the test results output by the target decision engine after executing the test cases. The target decision engine has loaded a strategy execution configuration package, which is generated based on the strategy configuration document. The test results are compared with the expected test results to obtain the comparison results; Based on the comparison results, the verification status of the strategy execution configuration package is determined.

4. The test case generation method according to claim 3, characterized in that, The step of comparing the test results with the expected test results to obtain comparison results includes: performing a semantic comparison between the test results and the expected test results to obtain semantic comparison results; Based on the comparison results, the verification status of the strategy execution configuration package is determined, including: Based on the semantic comparison results, the verification status of the policy execution configuration package is determined.

5. The test case generation method according to claim 3, characterized in that, Before obtaining the test results output by the target decision engine after executing the test cases, the method further includes: The system checks whether the verification fingerprint of the policy execution configuration package matches the verification fingerprint of the policy configuration document. If they match, the system sends the test case to the target decision engine so that the target decision engine can execute the test case.

6. The test case generation method according to claim 3, characterized in that, The method further includes: establishing a multi-layered verification evidence model based on the target decision engine, wherein the multi-layered verification evidence model includes multiple verification evidence layers; the test results include test sub-results collected by each verification evidence layer; and the expected test results include expected test sub-results corresponding to each verification evidence layer. The test results are compared with the expected test results to obtain comparison results, including: comparing multiple test sub-results with multiple expected test sub-results respectively to obtain multiple comparison sub-results; Determining the verification status of the policy execution configuration package based on the comparison results includes: determining the verification status of the policy execution configuration package based on multiple comparison sub-results.

7. A test case generation device, characterized in that, include: The acquisition module is used to acquire the strategy configuration document of the target decision engine; The first generation module is used to generate a rule constraint graph of the target decision engine based on the strategy configuration document. The second generation module is used to generate test cases based on the rule constraint graph.

8. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the test case generation method of any one of claims 1 to 6 by executing the executable instructions.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the test case generation method according to any one of claims 1 to 6.

10. A computer program product, characterized in that, When the computer program is executed by the processor, it implements the test case generation method according to any one of claims 1 to 6.