Test path coverage evaluation method and device, electronic equipment and storage medium

By constructing a directed graph of the business and assigning edge weights, test trajectories are generated, which solves the problem of misalignment between coverage assessment and business scenarios in existing technologies. It realizes the visualization of coverage blind spots and the objective determination of historical baselines, and provides a quantitative assessment of coverage adequacy.

CN123178263APending Publication Date: 2026-11-27QI AN XIN TECHNOLOGY GROUP INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611312866.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-27
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing technologies, coverage assessment methods cannot reflect the true coverage status of end-to-end business scenarios, lack visualization and historical comparison benchmarks, making it difficult for testers to judge coverage blind spots and coverage adequacy.

Method used

By constructing a directed graph of the business, assigning weights to each edge, generating test trajectories based on the step text of the test cases, calculating weighted path coverage, and evaluating it in conjunction with coverage heatmap values ​​and historical baselines.

Benefits of technology

It achieves semantic alignment between coverage assessment and business scenarios, can visually locate coverage blind spots, and makes objective judgments based on historical baselines, providing quantitative evidence of coverage adequacy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178263A_ABST
    Figure CN123178263A_ABST
Patent Text Reader

Abstract

The present disclosure provides a test path coverage evaluation method and device, electronic equipment and storage medium, wherein the method comprises: constructing a business directed graph according to a business scenario, wherein the business directed graph takes a business step as a node, a flow relationship between the business steps as a directed edge, and assigns a weight to each directed edge; determining a test track corresponding to a test case based on step text of the test case, wherein the test track is a sequence of nodes in the business directed graph mapped by the step text of the test case; and determining path coverage corresponding to the test case based on the test track and the weight of each directed edge in the business directed graph. By taking a continuous path in the business directed graph as a modeling unit for coverage evaluation and combining with differentiated weights, quantitative evaluation of coverage evaluation and business scenario semantic alignment is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of software testing quality measurement technology, specifically to a test path coverage evaluation method, apparatus, electronic device, and storage medium. Background Technology

[0002] In the field of software testing, test coverage assessment is typically the core method for measuring test adequacy. Related technologies mainly include code-based coverage assessment (such as white-box testing metrics like statement coverage, branch coverage, condition coverage, and path coverage), parameter / interface combination-based coverage assessment (such as paired combination tests and orthogonal array coverage), and requirement traceability matrix-based coverage assessment.

[0003] The coverage assessment methods in related technologies have the following technical problems: there is a semantic mismatch between the operational granularity of coverage assessment and the actual user usage scenarios. Lines of code, branches, or parameter combinations are discrete low-level measurement units that cannot reflect the actual coverage status of end-to-end business scenarios; the coverage rate indicators output by coverage assessment are mostly single percentage values, lacking a visual representation of the spatial distribution of coverage blind spots, making it difficult for testers to intuitively judge which business paths are overtested, which are shallowly covered, and which are coverage blind spots; the coverage assessment indicators are isolated absolute values, lacking a benchmark for comparison with historical test results of similar products, making it impossible for testers to judge whether the coverage is sufficient.

[0004] Therefore, there is an urgent need to provide a test path coverage evaluation scheme that can solve at least one of the above technical problems. Summary of the Invention

[0005] This disclosure provides at least one test path coverage evaluation scheme.

[0006] Firstly, this disclosure provides a method for evaluating test path coverage, including: A business directed graph is constructed based on the business scenario, wherein the business directed graph uses business steps as nodes, the flow relationship between the business steps as directed edges, and assigns a weight to each directed edge; Based on the step text of the test case, the test trajectory corresponding to the test case is determined, wherein the test trajectory is a sequence of the step text of the test case mapped to the nodes in the business directed graph; Based on the test trajectory and the weights of each directed edge in the directed graph of the business, the path coverage corresponding to the test case is determined.

[0007] In some embodiments of this disclosure, the step of constructing a directed business graph based on a business scenario includes: extracting business steps from a business scenario description and mapping each business step to a node in the directed business graph, wherein the node includes a start node, an intermediate operation node, a branch judgment node, and a termination node; and constructing directed edges of the directed business graph according to the legal flow rules between the business steps.

[0008] In some embodiments of this disclosure, assigning weights to each directed edge includes: assigning a first weight to critical path edges, assigning a second weight to regular path edges, and assigning a third weight to edge path edges, wherein the first weight is greater than the second weight, and the second weight is greater than the third weight.

[0009] In some embodiments of this disclosure, determining the test trajectory corresponding to the test case based on the step text of the test case includes: performing word segmentation on the step text of the test case to extract keyword features describing business operations; performing semantic similarity matching between the keyword features and the semantic tags of each node in the business directed graph; and arranging the matched nodes in order to generate the test trajectory.

[0010] In some embodiments of this disclosure, the step of performing semantic similarity matching between the keyword features and the semantic labels of each node in the directed graph of the business includes: calculating the cosine similarity between the keyword features and the semantic labels of each node; determining the node with the highest cosine similarity exceeding a preset threshold as the matching node; and marking the node corresponding to the step text of the test case as a potential coverage blind spot node when the maximum cosine similarity is lower than the preset threshold, and treating the directed edge corresponding to the potential coverage blind spot node as uncovered in the path coverage calculation.

[0011] In some embodiments of this disclosure, determining the path coverage corresponding to the test case based on the test trajectory and the weights of each directed edge in the directed graph of the business includes: traversing all test trajectories to determine whether each directed edge is traversed by at least one test trajectory; and determining the weighted path coverage rate as the ratio of the sum of the weights of the covered directed edges to the sum of the weights of all directed edges.

[0012] In some embodiments of this disclosure, the method further includes: counting the number of times each node in the directed service graph is traversed by the test trajectory to obtain the coverage heat value of each node; and counting the number of times each directed edge in the directed service graph is traversed by the test trajectory to obtain the coverage heat value of each directed edge.

[0013] In some embodiments of this disclosure, the method further includes: dividing the nodes and edges in the service directed graph into four coverage levels—uncovered, shallow coverage, medium coverage, and deep coverage—based on the coverage heatmap value; and coloring and rendering the service directed graph based on the coverage level to generate a coverage heatmap.

[0014] In some embodiments of this disclosure, the method further includes: obtaining a historical coverage baseline corresponding to the service directed graph; and comparing the current coverage heat distribution with the historical heat distribution corresponding to the historical coverage baseline to obtain a heat distribution similarity.

[0015] In some embodiments of this disclosure, the method further includes: determining a coverage compliance judgment result based on the path coverage, the coverage blind zone ratio, and the heat distribution similarity, wherein the coverage blind zone ratio is the proportion of edges in the directed service graph that have not been traversed by any test trajectory.

[0016] Secondly, this disclosure provides a test path coverage evaluation device, comprising: A directed graph construction module is used to construct a business directed graph based on a business scenario. The business directed graph uses business steps as nodes and the flow relationship between the business steps as directed edges, and assigns a weight to each directed edge. The test trajectory determination module is used to determine the test trajectory corresponding to the test case based on the step text of the test case, wherein the test trajectory is a sequence of the step text of the test case mapped to the nodes in the business directed graph; The path coverage determination module is used to determine the path coverage corresponding to the test case based on the test trajectory and the weights of each directed edge in the business directed graph.

[0017] Thirdly, embodiments of this disclosure provide an electronic device, including: a memory and a processor, wherein the memory and the processor are connected; Memory, used to store computer programs; A processor is used to invoke a computer program stored in memory to perform any of the above methods.

[0018] Fourthly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when run by a computer, performs any of the methods described above.

[0019] The test path coverage evaluation method provided in this disclosure uses continuous paths in the business directed graph as the modeling unit for coverage evaluation and combines them with differentiated weights. This is beneficial for achieving quantitative evaluation that aligns coverage evaluation with the semantics of the business scenario in software testing scenarios, and for realizing the visual location of coverage blind spots and the objective determination of coverage adequacy based on historical baselines.

[0020] 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

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

[0022] Figure 1 A flowchart illustrating a test path coverage evaluation method provided in an embodiment of this disclosure; Figure 2 A schematic diagram of a service-directed graph provided in an embodiment of this disclosure; Figure 3 A schematic diagram of a coverage heatmap provided in an embodiment of this disclosure; Figure 4 This is a schematic diagram of a test path coverage evaluation device provided in an embodiment of the present disclosure. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this disclosure clearer, the technical solutions of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0024] The terms “first,” “second,” etc., used in this disclosure are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this disclosure can be implemented in orders other than those illustrated or described herein, and that the objects distinguished by “first,” “second,” etc., are generally of the same class.

[0025] The disclosed solution will be explained and illustrated through specific embodiments below.

[0026] In the description of the following embodiments, the following terms are used: A Business DiGraph (BDG) is a directed graph model G=(V,E) constructed with business steps as nodes and the flow relationships between these business steps as directed edges. Where V = {v1, v2, ..., v n} indicates the business status or operation node. E={e1,e2,…,e m} represents a valid jump relationship between nodes. A scenario path is a complete path P = (v0→v1→…→v) from the start node to the end node in a directed graph of business operations. k This represents a complete end-to-end business scenario.

[0027] A test trace is a sequence of node matching T=[vᵢ,vⱼ,…,v] on a directed graph of business logic, generated after natural language processing analysis of a single test case. k ] may correspond to a complete scene path or its sub-path.

[0028] Path coverage is an indicator that reflects the degree to which a test case set covers the edges or paths in a directed graph of business. This disclosure adopts a weighted model: Path coverage = Σ(weight of covered edges) / Σ(weight of all edges in the graph).

[0029] Coverage heat value is the cumulative number of times a node or edge is traversed by the trajectory of a test case. It is used to quantify test density. The higher the coverage heat value, the more thoroughly the business process is tested. A coverage heat value of 0 indicates a coverage blind spot.

[0030] The historical coverage baseline is the path coverage statistics (including the average heat value distribution of each node) accumulated by similar products or similar functional modules in historical iterations, which serves as a reference benchmark for judging the coverage compliance of the current version.

[0031] The thermal distribution similarity is a measure of the probability distribution difference between the current test thermal distribution and the historical baseline thermal distribution, calculated based on the Jensen-Shannon divergence (JS divergence). The value ranges from [0,1], and the smaller the value, the more consistent the test force distribution pattern is with historical experience.

[0032] The compliance assessment is based on three dimensions: comprehensive weighted path coverage, blind spot ratio, and heat map distribution similarity. The assessment results are automatically generated after multi-dimensional comparison with historical baselines.

[0033] One embodiment of this disclosure provides a test path coverage evaluation method, such as... Figure 1 As shown, the method includes steps 101 to 103.

[0034] Step 101: Construct a business directed graph based on the business scenario, wherein the business directed graph uses business steps as nodes, the flow relationship between the business steps as directed edges, and assigns a weight to each directed edge.

[0035] Specifically, a business-directed graph (BDG) G=(V,E,W) is constructed using a business scenario description document or process definition as input.

[0036] The node identification and extraction process is as follows: extract business steps from business requirement documents or scenario descriptions, and map each business step to a node in a directed business graph. Node types include start node, intermediate operation node, branch judgment node, and termination node.

[0037] The edge construction process is as follows: construct directed edges according to the legal flow rules between business steps. If step A can legally flow to step B after execution, then add a directed edge e (A→B) in the business directed graph.

[0038] The weight assignment process is as follows: Each directed edge eᵢ is assigned a weight wᵢ. Preferably, the weight of critical path edges (affecting core functions or security features) is 1.0, the weight of regular path edges (normal business processes) is 0.6, and the weight of edge path edges (low-frequency / abnormal branches) is 0.3. The weight vector can be represented as W=[w1,w2,…,w m ], which corresponds to the m directed edges in E.

[0039] For example, taking the "security policy configuration" scenario of a network security device as an example, its business directed graph is as follows: Figure 2 As shown, the key edges (weight 1.0) include S→A and F→G, the regular edges (weight 0.6) include A→B, B→D, D→E, E→F, A→C, and C→B, and the edge edges (weight 0.3) include A→H, H→G, F→I, I→D, I→J, and J→A.

[0040] Step 102: Based on the step text of the test case, determine the test trajectory corresponding to the test case, wherein the test trajectory is a sequence of the step text of the test case mapped to the nodes in the business directed graph.

[0041] Specifically, natural language processing (NLP) technology is used to automatically map test cases to nodes in a directed business graph. The input consists of the test case step text and a set of semantic tags for the directed business graph nodes. The output is the test trajectory T=[vᵢ,vⱼ,…,v] for each test case. k ].

[0042] First, the test case steps are segmented and keywords are extracted: a pre-trained Chinese domain language model (such as the BERT model fine-tuned based on cybersecurity domain corpus) is used to segment the text of each step of the test case, and verb-object phrases describing business operations are extracted as keyword features.

[0043] Then, semantic similarity matching is performed: the extracted keyword feature vectors are compared with the semantic labels (pre-configured node operation descriptions) of each node in the business directed graph, and the node with the highest similarity and exceeding the preset threshold (e.g., the threshold is 0.75) is taken as the matching result; if the maximum similarity is lower than the threshold, this step is marked as "not matched", and the semantically closest node is marked as a "potential coverage blind spot node", and the corresponding directed edge is automatically regarded as not covered in the path coverage calculation.

[0044] Finally, trajectory generation and trajectory merging are performed: the matching nodes of each step of the test case are arranged in order to form the test trajectory. If the test case contains multiple branch execution paths, each branch is mapped to an independent sub-trajectory, and the above processing is performed on all test cases to obtain the trajectory set.

[0045] Step 103: Based on the test trajectory and the weights of each directed edge in the business directed graph, determine the path coverage corresponding to the test case.

[0046] Specifically, the input is a set of trajectories and a directed graph of business BDG=(V,E,W), and the output is the weighted path coverage and edge-level coverage details.

[0047] The edge coverage statistics process is as follows: traverse all trajectories in the trajectory set, and count whether each directed edge eᵢ is traversed by at least one trajectory. If a trajectory traverses the edge, mark Covered(eᵢ) = 1; otherwise, Covered(eᵢ) = 0. The weighted path coverage calculation process is as follows: the ratio of the sum of the weights of covered directed edges to the sum of the weights of all directed edges is determined as the weighted path coverage rate, i.e., ... Path coverage = Σᵢ =1 ᵐ[Covered(eᵢ)×w(eᵢ)] / Σᵢ =1 ᵐw(eᵢ), where m is the total number of directed edges and w(eᵢ) is the weight of edge eᵢ.

[0048] This calculation method ensures that: when the critical edge is covered, the path coverage rate increases significantly (the critical edge has a high weight), and when only the edge path is covered, the path coverage rate increases slowly. The path coverage rate ranges from [0,1], and the closer it is to 1, the more sufficient the business path coverage is.

[0049] In this embodiment, by constructing a business directed graph based on business scenarios and mapping the step text of test cases to test trajectories in the business directed graph based on semantic matching, the modeling unit for coverage evaluation is switched from discrete lines of code, branches, or parameter combinations to continuous end-to-end paths in the business directed graph, aligning the granularity of coverage evaluation with real user scenarios. On this basis, by assigning differentiated weights to each directed edge, the core business process occupies a higher proportion in the coverage calculation, so that the coverage evaluation results can reflect both the scale of test coverage of business paths and the quality of coverage of core business links, providing testers with a quantitative basis for coverage sufficiency that is aligned with business semantics and takes into account both the "quantity" and "quality" of coverage.

[0050] In some possible implementations, constructing a directed business graph based on a business scenario includes: extracting business steps from a business scenario description and mapping each business step to a node in the directed business graph, wherein the node includes a start node, intermediate operation nodes, branch judgment nodes, and termination nodes; and constructing directed edges of the directed business graph according to the legal flow rules between the business steps.

[0051] Specifically, the business scenario description document or process definition serves as input. During node identification and extraction, business steps are extracted from the business requirement document or scenario description, and each business step is mapped to a node in a directed business graph. Node types include start nodes, intermediate operation nodes, branch decision nodes, and termination nodes. During edge construction, directed edges are constructed according to the legal flow rules between business steps. If step A can legally flow to step B after execution, a directed edge e(A→B) is added to the directed business graph.

[0052] In this embodiment, by abstracting business steps into directed graph nodes and the flow rules between business steps into directed edges, the business scenario is standardized and transformed into a structured directed graph model. This directed graph uses continuous end-to-end business paths as the basic analysis unit, which enables the modeling unit for coverage assessment to switch from discrete lines of code, branches, or parameter combinations to continuous business paths, thereby providing a unified graph model foundation that is semantically aligned with the business scenario for subsequent path-level coverage assessment.

[0053] In some possible implementations, assigning weights to each directed edge includes: assigning a first weight to critical path edges, a second weight to regular path edges, and a third weight to edge path edges, wherein the first weight is greater than the second weight, and the second weight is greater than the third weight.

[0054] Specifically, each directed edge eᵢ is assigned a weight wᵢ, with the weight ranging from [0,1]. Among them, critical path edges are those that affect core functions or security features, regular path edges are those that are part of normal business processes, and edge path edges are those that are low-frequency or abnormal branches.

[0055] Preferably, the first weight of the critical path edge is 1.0, the second weight of the regular path edge is 0.6, and the third weight of the edge path edge is 0.3. The weight vector can be represented as W=[w1,w2,…,w…]. m ], which corresponds to the m directed edges in E.

[0056] For example, taking the "security policy configuration" scenario of network security equipment as an example, the critical edge (weight 1.0) includes S→A, F→G (core operation chain), the regular edge (weight 0.6) includes A→B, B→D, D→E, E→F, A→C, C→B, and the edge edge (weight 0.3) includes A→H, H→G, F→I, I→D, I→J, J→A.

[0057] In this embodiment, by assigning progressively decreasing weights to critical path edges, regular path edges, and edge path edges, different proportions of business processes of varying importance are given to different aspects in the path coverage calculation. When the core business process (critical path edge) is covered, the path coverage rate increases significantly, while when only low-frequency or abnormal branches (edge ​​path edges) are covered, the path coverage rate increases slowly. This allows the coverage index to distinguish the coverage of different business importance, avoiding situations where high coverage can be obtained by only covering edge paths, and achieving an accurate representation of the adequacy of core business coverage.

[0058] In some possible implementations, determining the test trajectory corresponding to the test case based on the step text of the test case includes: performing word segmentation on the step text of the test case to extract keyword features describing business operations; performing semantic similarity matching between the keyword features and the semantic labels of each node in the business directed graph; and arranging the matched nodes in order to generate the test trajectory.

[0059] Specifically, during the word segmentation process, a pre-trained Chinese domain-specific language model (such as a BERT model fine-tuned based on cybersecurity corpus) is used to segment the text of each step in the test cases, and verb-object phrases describing business operations are extracted as keyword features. For example, for the test case step "Log in to the firewall management page, click the security policy menu, and create a new policy rule", the extracted keyword set is {login, management page, security policy, create, policy rule}.

[0060] During the semantic similarity matching process, the extracted keyword feature vectors are compared with the semantic labels (pre-configured node operation descriptions) of each node in the business directed graph to calculate the cosine similarity. The node with the highest similarity and exceeding the preset threshold is taken as the matching result.

[0061] During trajectory generation, the matching nodes of each step of the test case are arranged in sequence to form the test trajectory of the test case. If the test case contains multiple branch execution paths (such as "return to modification if policy conflict"), each branch is mapped to an independent sub-trajectory. Furthermore, the above processing is performed on all test cases to obtain a trajectory set as input for subsequent coverage calculation.

[0062] In this embodiment, through word segmentation, keyword feature extraction, and semantic similarity matching, the step text of the test case is automatically mapped into a node sequence in the business directed graph, without the need for manual annotation or maintenance of node labels. Since this mapping process is executed automatically by a computer program, the generation of test trajectories can be completed in batches and reusably on a large scale of test cases, thereby realizing the automated and large-scale generation of test trajectories, reducing the human cost of coverage assessment, and reducing the subjective bias introduced by manual annotation.

[0063] In some possible implementations, the step of performing semantic similarity matching between the keyword features and the semantic labels of each node in the business directed graph includes: calculating the cosine similarity between the keyword features and the semantic labels of each node; determining the node with the highest cosine similarity exceeding a preset threshold as the matching node; and marking the node corresponding to the step text of the test case as a potential coverage blind spot node when the maximum cosine similarity is lower than the preset threshold, and treating the directed edges corresponding to the potential coverage blind spot node as uncovered in the path coverage calculation.

[0064] Specifically, the cosine similarity between keyword features and node semantic labels is calculated, i.e. sim(step_k, v_j)=cos(Embed(step_k), Embed(label_v_j)), Where Embed(step_k) represents the feature vector of the step keyword, and Embed(label_v_j) represents the feature vector of the node semantic label.

[0065] The node with the highest cosine similarity that exceeds a preset threshold (e.g., the preset threshold is 0.75) is selected as the matching result. If the maximum cosine similarity is lower than the preset threshold, this step is marked as "not matched", and the node with the closest semantics (i.e., the node with the highest cosine similarity but lower than the preset threshold) is marked as a "potential coverage blind spot node", which is included in the subsequent coverage gap report. In the path coverage calculation, the directed edge corresponding to the potential coverage blind spot node is automatically regarded as uncovered (i.e., Covered(e)=0).

[0066] In this embodiment, by calculating cosine similarity and setting a preset threshold, it is possible to distinguish between semantic matching and non-matching between test case steps and business nodes. When the maximum cosine similarity is lower than the preset threshold, the node corresponding to the step is marked as a potential coverage blind spot node and its corresponding directed edge is regarded as uncovered. This allows business links that cannot be effectively mapped at the semantic level to be automatically identified and included in the coverage gap, thereby realizing the automated discovery of coverage blind spots and providing a basis for subsequent targeted supplementary testing.

[0067] In some possible implementations, determining the path coverage corresponding to the test case based on the test trajectory and the weights of each directed edge in the directed graph of the business includes: traversing all test trajectories to determine whether each directed edge is traversed by at least one test trajectory; and determining the weighted path coverage rate as the ratio of the sum of the weights of the covered directed edges to the sum of the weights of all directed edges.

[0068] Specifically, in the edge coverage statistics process, all trajectories in the trajectory set are traversed, and it is checked whether each directed edge eᵢ is traversed by at least one trajectory. If a trajectory traverses the edge, the coverage flag Covered(eᵢ) = 1; otherwise, Covered(eᵢ) = 0. In the weighted path coverage calculation process, the ratio of the sum of the weights of covered directed edges to the sum of the weights of all directed edges is determined as the weighted path coverage rate, i.e. Path coverage = Σᵢ =1 ᵐ[Covered(eᵢ)×w(eᵢ)] / Σᵢ =1 ᵐw(eᵢ), Where m is the total number of directed edges, and w(eᵢ) is the weight of edge eᵢ. This calculation method ensures that: when critical edges are covered, the path coverage rate increases significantly (critical edges have high weights), and when only edge paths are covered, the path coverage rate increases slowly. The path coverage rate ranges from [0,1], and the closer it is to 1, the more sufficient the business path coverage.

[0069] In this embodiment, by statistically analyzing whether each directed edge is traversed by at least one test trajectory, and using the ratio of the sum of the weights of covered directed edges to the sum of the weights of all directed edges as the weighted path coverage rate, the coverage metric reflects the business importance of the edges while reflecting the coverage scale. Since the weight of critical edges is higher than that of edge edges, the contribution of covering core paths to the coverage rate is greater than that of covering edge paths. Thus, the coverage metric not only reflects the quantity of coverage but also the quality of coverage, enabling a more accurate measurement of the sufficiency of testing core business processes.

[0070] In some possible implementations, the method further includes: counting the number of times each node in the directed service graph is traversed by the test trajectory to obtain the coverage heat value of each node; and counting the number of times each directed edge in the directed service graph is traversed by the test trajectory to obtain the coverage heat value of each directed edge.

[0071] Specifically, the system iterates through all trajectories in the trajectory set, counting the total number of times each node vᵢ is traversed by each trajectory to obtain the node's coverage heat value. Simultaneously, it counts the number of times each edge eᵢ is traversed by each trajectory to obtain the edge's coverage heat value. The coverage heat value is the cumulative number of times a node or edge is traversed by test case trajectories, used to quantify test density. A higher heat value indicates that the business process has been tested more thoroughly; a heat value of 0 indicates a coverage blind spot.

[0072] Optionally, all scenario paths in the business directed graph can be enumerated (the entire path of the directed graph can be traversed using depth-first search) to calculate the percentage of covered scenario paths as path-level coverage; when the directed graph contains cycles, the path depth is pruned and limited, where the upper limit of depth can be adaptively determined according to the complexity of the business module.

[0073] In this embodiment, the coverage heat value is obtained by counting the cumulative number of times each node and each directed edge is traversed by the test trajectory. The coverage status is refined from a binary judgment of "whether it is covered" to a density quantification of "how many times it is covered". The link with a coverage heat value of 0 constitutes a coverage blind zone. The link with a higher heat value is tested more thoroughly. This provides a quantitative basis for the test density at the node and edge granularity for coverage assessment, and provides a data foundation for subsequent heat visualization and distribution similarity comparison.

[0074] In some possible implementations, the method further includes: dividing the nodes and edges in the service directed graph into four coverage levels—uncovered, shallow, medium, and deep—based on the coverage heatmap value; and coloring and rendering the service directed graph based on the coverage level to generate a coverage heatmap.

[0075] Specifically, during the heat mapping process, nodes and edges are divided into four coverage levels based on the coverage heat value: those with a coverage heat value of 0 are classified as uncovered (blind zone), those with a coverage heat value in the first interval (e.g., 1 to 2) are classified as shallow coverage, those with a coverage heat value in the second interval (e.g., 3 to 5) are classified as medium coverage, and those with a coverage heat value greater than or equal to a preset value (e.g., 6) are classified as deep coverage.

[0076] During the coloring and rendering process, the colors corresponding to the above coverage levels are mapped back to the corresponding nodes and edges in the business directed graph to generate a coverage heatmap. For example, no coverage (blind spots) is represented by red, light coverage by yellow, medium coverage by light green, and deep coverage by dark green. Furthermore, the colored directed graph is rendered and output as an interactive graphical interface, allowing testers to click on nodes to view detailed coverage frequencies and related test case lists. Nodes can also be sorted in descending order of coverage heatmap value, and a coverage heatmap (e.g., business nodes on the horizontal axis and coverage heatmap value on the vertical axis) can be generated. Figure 3 As shown in the figure, the distribution of coverage depth and the relative differences in the allocation of testing resources among nodes are presented intuitively.

[0077] For example, taking the security policy configuration scenario, the v0 login node was covered a maximum of 12 times, while the v10 returned that the modified node was not covered 0 times. The two constitute a significant difference, which intuitively reflects the imbalance in the distribution of testing resources among nodes.

[0078] In this embodiment, by dividing the coverage heat value into four coverage levels and mapping it back to the service directed graph with different colors, the abstract coverage data is transformed into an intuitive visual image. Testers can directly observe which nodes and edges are in the red blind zone and which are in the dark green redundant zone without interpreting the numerical indicators. This allows them to locate coverage blind zones and test redundancy zones at a glance, achieving spatial positioning of coverage blind zones rather than overall numerical feedback, and providing an actionable improvement direction for accurate supplementary testing.

[0079] In some possible implementations, the method further includes: obtaining a historical coverage baseline corresponding to the directed graph of the service; comparing the current coverage heat distribution with the historical heat distribution corresponding to the historical coverage baseline to obtain a heat distribution similarity.

[0080] Specifically, during the historical coverage baseline retrieval process, historical test coverage data for functional modules with the same or similar functions as the current product are retrieved from the historical coverage baseline database. Retrieval dimensions include product lines (e.g., network security product lines), functional modules (e.g., security policies, interface configurations, DNS configurations, etc.), and version evolution relationships. During distribution normalization, the coverage heatmap vector of the current node is normalized to the current probability distribution, i.e., P_curr(i) = current heatmap vector(i) / Σ_j current heatmap vector(j). Similarly, the average heatmap vector of each node of the same module in the historical baseline database is normalized to the historical probability distribution P_hist. During similarity comparison, the heatmap distribution similarity is determined based on the divergence between the current probability distribution and the historical probability distribution. This divergence can be achieved using the Jensen-Shannon divergence (JS divergence). This involves first calculating the average distribution M = ½(P_curr + P_hist) of the current probability distribution and the historical probability distribution, then calculating the divergence between the current probability distribution, the historical probability distribution, and the average distribution, and averaging these to obtain the heatmap distribution similarity. D_JS(P_curr||P_hist)=½×KL(P_curr||M)+½×KL(P_hist||M), The divergence between two probability distributions P and Q is defined as... KL(P||Q)=ΣᵢP(i)×log2(P(i) / Q(i)), The range of thermal distribution similarity is [0,1]. The smaller the value, the more similar the two distributions are; the larger the value, the more inconsistent the test force distribution pattern is with historical experience.

[0081] Furthermore, the similarity of thermal distribution can be classified into different levels: D_JS≤0.05 indicates high consistency (the tested force distribution is almost identical to the historical normal pattern); 0.05-0.30 indicates high anomaly (the distribution pattern deviates significantly from the historical pattern, which may indicate testing strategy errors or coverage omissions).

[0082] In this embodiment, by comparing the similarity between the current coverage heat map distribution and the historical heat map distribution of the historical coverage baseline, coverage assessment introduces a distribution morphology dimension measurement in addition to the aggregation index. Since this similarity can characterize the deviation of the distribution pattern of testing resources among nodes from historical experience, even if the overall coverage rate meets the standard, distribution anomalies such as excessive concentration of testing resources on a few nodes while edge paths are ignored will be detected. This expands coverage assessment from a single "total quantity meets the standard" to a two-dimensional judgment of "total quantity + distribution," improving the completeness of coverage rationality assessment. The Jason-Shannon divergence, originally widely used in probability distribution comparisons in natural language processing and machine learning, is transferred across domains in this embodiment to the scenario of measuring the similarity between the test heat map distribution and the historical baseline distribution, thereby endowing test coverage assessment with the discriminative ability of the distribution morphology dimension.

[0083] In some possible implementations, the method further includes: determining the coverage compliance judgment result based on the path coverage, the coverage blind zone ratio, and the heat distribution similarity, wherein the coverage blind zone ratio is the proportion of edges in the directed graph of the service that have not been traversed by any test trajectory.

[0084] Specifically, the current data is compared with the historical baseline in multiple dimensions, including: weighted path coverage (comparing the current coverage with the historical average and historical P90; if the current coverage is not lower than the historical P90, it is considered excellent), number of uncovered edges (N_uncovered, compared with the historical average and historical P10; if N_uncovered is not higher than the historical P10, it is considered excellent), percentage of deeply covered nodes (R_deep, compared with the historical average and historical P50), percentage of nodes in coverage blind spots (R_blind, compared with the historical average and historical P90; if R_blind is higher than the historical P90, a warning is needed), and heat distribution similarity (D_JS, compared with the historical heat distribution P_hist).

[0085] Based on the above dimensions, a tiered judgment logic is adopted to output compliance judgment conclusions.

[0086] For example, the judgment criteria include: when the current coverage rate is not lower than the historical high level (e.g., historical P90) and the proportion of coverage blind zone nodes is not higher than the historical low level (e.g., historical P10) and the heat distribution similarity is high (e.g., D_JS does not exceed 0.15), it is judged as sufficient coverage (excellent); when the current coverage rate is not lower than the historical median level (e.g., historical P50) and the proportion of coverage blind zone nodes is not higher than the historical median level and D_JS does not exceed 0.30, it is judged as basic coverage (good); when D_JS exceeds 0.30, it is judged as abnormal coverage distribution (warning); when the proportion of coverage blind zone nodes exceeds the historical median level, it is judged as insufficient coverage (warning), and a list of coverage blind zone nodes or edges and suggested supplementary test scenario paths are output.

[0087] Furthermore, the standard usage procedure for the thermal distribution similarity index is as follows: After each test version is completed, the divergence between the current thermal distribution and the historical baseline distribution is automatically calculated. If D_JS ≤ 0.15 (highly consistent or slightly offset), it indicates that the test force allocation pattern is consistent with historical experience, and no additional action is required. If D_JS > 0.15 (significant deviation or highly abnormal), the system automatically marks the specific nodes of the distribution offset (i.e., the Top-K nodes with the largest difference between the current probability distribution and the historical probability distribution), and outputs a distribution offset report for the test manager to review and determine whether it is a reasonable bias in new feature testing or an omission of coverage for certain key nodes. This index, along with path coverage, blind spot ratio, and other indices, constitutes a multi-dimensional coverage evaluation matrix: path coverage answers "how much was tested," and thermal distribution similarity answers "whether the test was accurate."

[0088] Furthermore, when the compliance assessment result is a warning or note, the system automatically outputs a list of coverage blind spots nodes / edges and suggested test scenario paths to assist testers in conducting targeted supplementary testing.

[0089] In this embodiment, by integrating three dimensions—path coverage, coverage blind spot ratio, and thermal distribution similarity—and comparing them with historical baselines, the judgment of coverage adequacy is transformed into a quantifiable, hierarchical judgment process. When any dimension deviates from the historical benchmark, the system can automatically output corresponding warning conclusions, coverage blind spot nodes, edge lists, and supplementary test suggestions. This transforms the judgment of coverage adequacy from the test manager's personal experience into a data-driven objective decision, improving the consistency and reusability of the judgment results.

[0090] Figure 4 As shown, this disclosure provides a test path coverage evaluation apparatus, which can execute the test path coverage evaluation method of any embodiment of this disclosure. The apparatus may include a directed graph construction module 401, a test trajectory determination module 402, and a path coverage determination module 403. Wherein: The directed graph construction module 401 is used to construct a business directed graph based on the business scenario. The business directed graph uses business steps as nodes and the flow relationship between the business steps as directed edges, and assigns a weight to each directed edge. The test trajectory determination module 402 is used to determine the test trajectory corresponding to the test case based on the step text of the test case, wherein the test trajectory is a sequence of the step text of the test case mapped to the nodes in the business directed graph; The path coverage determination module 403 is used to determine the path coverage corresponding to the test case based on the test trajectory and the weight of each directed edge in the directed graph of the business.

[0091] Optionally, the step of constructing a directed business graph based on the business scenario includes: Business steps are extracted from the business scenario description, and each business step is mapped to a node in the business directed graph, wherein the node includes a start node, an intermediate operation node, a branch judgment node, and a termination node; and directed edges of the business directed graph are constructed according to the legal flow rules between the business steps.

[0092] Optionally, assigning weights to each of the directed edges includes: The critical path edges are assigned a first weight, the regular path edges are assigned a second weight, and the edge path edges are assigned a third weight, wherein the first weight is greater than the second weight, and the second weight is greater than the third weight.

[0093] Optionally, determining the test trajectory corresponding to the test case based on the test case's step text includes: The step text of the test case is segmented to extract keyword features describing the business operation; the keyword features are matched with the semantic labels of each node in the business directed graph for semantic similarity; the matched nodes are arranged in order to generate the test trajectory.

[0094] Optionally, the step of performing semantic similarity matching between the keyword features and the semantic labels of each node in the business directed graph includes: Calculate the cosine similarity between the keyword features and the semantic tags of each node; determine the node with the highest cosine similarity exceeding a preset threshold as the matching node; if the maximum cosine similarity is lower than the preset threshold, mark the node corresponding to the step text of the test case as a potential coverage blind zone node, and consider the directed edge corresponding to the potential coverage blind zone node as uncovered in the path coverage calculation.

[0095] Optionally, determining the path coverage corresponding to the test case based on the test trajectory and the weights of each directed edge in the directed graph of the business includes: Traverse all test trajectories to determine whether each directed edge is traversed by at least one test trajectory; the ratio of the sum of the weights of the covered directed edges to the sum of the weights of all directed edges is determined as the weighted path coverage rate.

[0096] Optionally, the device may also include a thermal statistics module for counting the number of times each node and each directed edge in the service directed graph is traversed by the test trajectory, thereby obtaining the coverage thermal value of each node and each directed edge.

[0097] Optionally, the device may further include a compliance determination module, which is used to obtain a historical coverage baseline corresponding to the service directed graph, compare the current coverage heat distribution with the historical heat distribution corresponding to the historical coverage baseline to obtain a heat distribution similarity, and determine the coverage compliance determination result based on the path coverage, the coverage blind spot ratio and the heat distribution similarity.

[0098] For the apparatus embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The apparatus embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of at least one embodiment of the present disclosure. Those skilled in the art can understand and implement this without creative effort.

[0099] On the other hand, embodiments of this disclosure provide an electronic device, including: a memory and a processor, wherein the memory and the processor are connected; Memory, used to store computer programs; A processor is used to invoke a computer program stored in memory to perform any of the above methods.

[0100] On the other hand, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when run by a computer, performs any of the methods described above.

[0101] The test path coverage evaluation method, apparatus, electronic device, and storage medium provided in this disclosure, by using continuous paths in the business directed graph as the modeling unit for coverage evaluation and combining them with differentiated weights, are conducive to achieving quantitative evaluation of coverage evaluation that is semantically aligned with the business scenario in software testing scenarios, and are also conducive to achieving visual positioning of coverage blind spots and objective determination of coverage adequacy based on historical baselines.

[0102] It should be noted that the content of the method embodiments and device embodiments provided in this disclosure corresponds one-to-one with each other. The content involved in any embodiment can be referenced or combined with other embodiments to form part of that embodiment. For ease of description, this disclosure focuses on explaining and illustrating the method embodiments. The description of the relevant technical features and solutions of the device, electronic device, and computer-readable storage medium embodiments can be referred to the relevant content in the method embodiments.

[0103] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, apparatus, systems, electronic devices, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.

[0104] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0105] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0106] Obviously, those skilled in the art can make various modifications and variations to this disclosure without departing from its spirit and scope. Therefore, if such modifications and variations fall within the scope of the claims of this disclosure and their equivalents, this disclosure is also intended to include such modifications and variations.

Claims

1. A method for evaluating test path coverage, characterized in that, include: A business directed graph is constructed based on the business scenario, wherein the business directed graph uses business steps as nodes, the flow relationship between the business steps as directed edges, and assigns a weight to each directed edge; Based on the step text of the test case, the test trajectory corresponding to the test case is determined, wherein the test trajectory is a sequence of the step text of the test case mapped to the nodes in the business directed graph; Based on the test trajectory and the weights of each directed edge in the directed graph of the business, the path coverage corresponding to the test case is determined.

2. The method according to claim 1, characterized in that, The construction of a directed graph based on business scenarios includes: Business steps are extracted from the business scenario description, and each business step is mapped to a node in the business directed graph, wherein the node includes a start node, an intermediate operation node, a branch judgment node, and a termination node. Based on the legal flow rules between the business steps, construct the directed edges of the business directed graph; Assigning weights to each directed edge includes: The critical path edges are assigned a first weight, the regular path edges are assigned a second weight, and the edge path edges are assigned a third weight, wherein the first weight is greater than the second weight, and the second weight is greater than the third weight.

3. The method according to claim 1, characterized in that, The step text based on the test case determines the test trajectory corresponding to the test case, including: The step text of the test cases is segmented into words to extract key features describing business operations; Perform semantic similarity matching between the keyword features and the semantic labels of each node in the business directed graph; The matched nodes are arranged in order to generate the test trajectory.

4. The method according to claim 3, characterized in that, The step of performing semantic similarity matching between the keyword features and the semantic labels of each node in the business directed graph includes: Calculate the cosine similarity between the keyword features and the semantic tags of each node; The node with the highest cosine similarity that exceeds a preset threshold is identified as the matching node; If the maximum cosine similarity is lower than the preset threshold, the node corresponding to the step text of the test case is marked as a potential coverage blind zone node, and the directed edge corresponding to the potential coverage blind zone node is regarded as uncovered in the path coverage calculation.

5. The method according to claim 1, characterized in that, The determination of path coverage corresponding to the test case based on the test trajectory and the weights of each directed edge in the directed graph of the business includes: Traverse all test paths to determine whether each directed edge is traversed by at least one test path; The weighted path coverage rate is determined by the ratio of the sum of the weights of the covered directed edges to the sum of the weights of all directed edges.

6. The method according to claim 1, characterized in that, The method further includes: The coverage heat value of each node is obtained by counting the number of times each node in the directed graph of the service is traversed by the test trajectory. The coverage heat value of each directed edge in the directed graph of the service is obtained by counting the number of times it is traversed by the test trajectory; and / or, The method further includes: Based on the coverage heat map value, the nodes and edges in the service directed graph are divided into four coverage levels: no coverage, shallow coverage, medium coverage, and deep coverage. Based on the coverage level, the directed graph of the service is colored and rendered to generate a coverage heatmap.

7. The method according to claim 6, characterized in that, The method further includes: Obtain the historical coverage baseline corresponding to the directed graph of the service; The current thermal distribution is compared with the historical thermal distribution corresponding to the historical coverage baseline to obtain the thermal distribution similarity; and / or, The method further includes: Based on the path coverage, the proportion of coverage blind spots, and the similarity of the heat distribution, the coverage compliance judgment result is determined, wherein the proportion of coverage blind spots is the proportion of edges in the directed graph of the service that have not been traversed by any test trajectory.

8. A test path coverage evaluation device, characterized in that, include: A directed graph construction module is used to construct a business directed graph based on a business scenario. The business directed graph uses business steps as nodes and the flow relationship between the business steps as directed edges, and assigns a weight to each directed edge. The test trajectory determination module is used to determine the test trajectory corresponding to the test case based on the step text of the test case, wherein the test trajectory is a sequence of the step text of the test case mapped to the nodes in the business directed graph; The path coverage determination module is used to determine the path coverage corresponding to the test case based on the test trajectory and the weights of each directed edge in the business directed graph.

9. An electronic device, characterized in that, include: Memory and processor, and the connection between memory and processor; Memory, used to store computer programs; A processor for invoking a computer program stored in memory to perform the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, It stores a computer program, which, when executed by a computer, performs the method as described in any one of claims 1 to 7.