A testing method and platform based on dynamic execution tracing and intelligent test case selection

By employing dynamic execution tracing and intelligent test case selection, this testing method addresses the issues of high cost and low efficiency in regression testing. It achieves efficient path-level coverage and risk identification, reduces regression testing costs, improves testing efficiency, and supports test optimization in multi-language environments.

CN122132309APending Publication Date: 2026-06-02WUHAN ZBANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUHAN ZBANK CO LTD
Filing Date
2026-02-26
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In modern software development, frequent iterations have led to a sharp increase in regression testing costs. Traditional regression testing is redundant and inefficient. Existing tools cannot accurately reflect the true scope of impact. Machine learning defect prediction modules have not effectively integrated dynamic test feedback data. The challenges of unified instrumentation and coverage data standardization across language systems have not been resolved.

Method used

This paper presents a testing method based on dynamic execution tracing and intelligent test case selection. It obtains the original execution event flow through language type matching instrumentation strategy, constructs a control flow graph and maps coverage data, uses a graph database to store the mapping relationship, parses code changes to perform risk assessment, generates the optimal regression set and verifies it, and finally generates test results.

Benefits of technology

Improve testing efficiency, reduce regression costs, achieve path-level dynamic tracing, reduce redundant test cases by 30%~45%, detect high-risk defects early, support seamless multi-language adaptation, have self-evolution capabilities, and form a quality assurance closed loop.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122132309A_ABST
    Figure CN122132309A_ABST
Patent Text Reader

Abstract

This invention provides a testing method and platform based on dynamic execution tracing and intelligent test case selection. The method includes: matching instrumentation strategies according to the language type of the program under test to obtain the original execution event flow; constructing a control flow graph for each function based on the source code, mapping the original execution events onto the control flow graph to obtain structured coverage data; extracting entities and relationships from the structured coverage data and storing the mapping relationship between execution events and code elements in the form of a graph database; when code changes occur, parsing the changes, performing risk probability assessment, and generating an optimal regression set; and performing verification on the optimal regression set to obtain the final test results. This method can improve testing efficiency and reduce regression costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software testing and quality assurance technology, and particularly to a testing method and platform based on dynamic execution tracing and intelligent test case selection. Background Technology

[0002] In modern software development, frequent iterations lead to a sharp increase in regression testing costs. Traditional regression testing typically executes all historical test cases, resulting in significant redundancy and low testing efficiency. While existing coverage tools (such as JaCoCo and Istanbul) can provide statement or branch coverage statistics, they lack the ability to dynamically capture execution paths and cannot establish fine-grained mappings with test cases. Furthermore, test selection methods based on static dependency analysis (such as call graph slicing) ignore runtime behavior and fail to accurately reflect the true scope of impact.

[0003] In recent years, some studies have attempted to introduce machine learning to predict defects, but these have mostly relied on static code metrics and have not effectively integrated dynamic test feedback data. Meanwhile, unified instrumentation and coverage data standardization across language systems remain technical challenges. Summary of the Invention

[0004] This invention provides a testing method and platform based on dynamic execution tracing and intelligent test case selection, which can improve testing efficiency and reduce regression costs.

[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution: This invention provides a testing method based on dynamic execution tracing and intelligent test case filtering, comprising: The instrumentation strategy is matched according to the language type of the program under test to obtain the original execution event flow; A control flow graph is constructed for each function based on the source code, and the original execution events are mapped onto the control flow graph to obtain structured coverage data. Entities and relationships are extracted from the structured coverage data and stored in the form of a graph database to represent the mapping between execution events and code elements. When the code changes, the changes are parsed, a risk probability assessment is performed, and an optimal regression set is generated. Validation is performed on the optimal regression set to obtain the final test results.

[0006] Furthermore, based on the aforementioned testing method using dynamic execution tracing and intelligent test case filtering, the instrumentation strategy is matched according to the language type of the program under test to obtain the original execution event flow, including: For JVM languages, the ASM framework is used to inject lightweight probes during class loading to record method entry points, branch jumps, and basic block execution sequences, generating raw execution event streams. For JavaScript or TypeScript languages, the Abstract Syntax Tree (AST) transformation generates the raw execution event stream; For the Python language, the source file is parsed, the source code is converted into an abstract syntax tree (AST), static instrumentation is performed based on the AST, and dynamic tracing is performed to generate the original execution event stream; For C, C++, or Go languages, compiler instrumentation is used to generate raw execution event streams.

[0007] Furthermore, based on the aforementioned testing method using dynamic execution tracing and intelligent test case filtering, a control flow graph is constructed for each function based on the source code, and the original execution events are mapped onto the control flow graph to obtain structured coverage data, including: Based on the parsed source code, a control flow graph is constructed for each function; the control flow graph includes nodes and edges, with basic blocks as nodes and the jump relationships between basic blocks as edges. During the dynamic execution of the program, the sequence of basic blocks actually traversed by each function is recorded to obtain the set of executed paths; Based on the static analysis of the control flow graph, all theoretically reachable execution paths are obtained, and the uncovered paths are obtained by subtracting the reachable execution path set from the executed path set. Furthermore, according to the above-described testing method based on dynamic execution tracing and intelligent test case selection, entities and relationships are extracted from the structured coverage data, and the mapping relationship between execution events and code elements is stored in the form of a graph database, including: Each event stream is processed according to preset rules to establish the association between code elements and test cases; Persist the relationships to the graph database; The forward mapping relationships are stored in the mapping library, and the reverse index structure is automatically built.

[0008] Furthermore, based on the aforementioned testing method using dynamic execution tracing and intelligent test case selection, when code changes occur, the changes are parsed, risk probability assessment is performed, and a minimal regression test set is generated, including: When code changes, analyze the changes and deduce the scope of impact. A risk score is obtained based on static features and dynamic test feedback; Based on risk scoring, defect detection capability, and execution efficiency, the optimal regression set is selected from all candidate use cases.

[0009] Furthermore, based on the aforementioned testing method using dynamic execution tracing and intelligent test case selection, the validation is performed on the minimum regression test set to obtain the final test results, including: The optimal regression set is executed to obtain new coverage data. The mapping relationship is updated based on the new coverage data. The optimal regression set is then input into the intelligent regression test filter to obtain new test results.

[0010] This invention also provides a testing platform based on dynamic execution tracing and intelligent test case filtering, comprising: The dynamic instrumentation and execution tracing module is used to match the instrumentation strategy according to the language type of the program under test and obtain the original execution event flow; The coverage analysis module is used to construct a control flow graph for each function based on the source code, and map the original execution events onto the control flow graph to obtain structured coverage data. The mapping module is used to extract entities and relationships from the structured coverage data and store the mapping relationship between execution events and code elements in the form of a graph database; The intelligent regression test filter is used to parse the changes to the code, assess the risk probability, and generate the optimal regression set when the code is modified. The validation module is used to perform validation on the optimal regression set and obtain the final test results.

[0011] Furthermore, according to the aforementioned test platform based on dynamic execution tracing and intelligent test case filtering, the intelligent regression test filter includes: The Change Impact Analysis submodule is used to parse the changes made to the code and deduce the scope of the impact of the code changes; The high-risk identification submodule is used to obtain a risk score based on static features and the execution time series of test cases covering the code; The optimal use case recommendation submodule is used to select the optimal regression set from all candidate use cases based on the scope of change impact, high-risk code areas, and mapping relationships stored in the mapping library.

[0012] The present invention also provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute any of the above-described test methods based on dynamic execution tracing and intelligent use case selection.

[0013] The present invention also provides an electronic device, including a processor and a memory, wherein the processor is electrically connected to the memory, the memory is used to store instructions and data, and the processor is used in the steps of the test method based on dynamic execution tracing and intelligent use case screening described in any of the preceding claims.

[0014] This invention provides a testing method and platform based on dynamic execution tracing and intelligent test case selection. By integrating multi-language code instrumentation, fine-grained path coverage analysis, and machine learning-driven high-risk module identification, this invention achieves efficient allocation of testing resources and proactive prevention of missed test risks. It offers the following advantages: Improved test completeness: Path-level dynamic tracing exposes uncovered logic; Significantly reduced regression costs: Real-world testing shows an average reduction of 30%~45% of redundant test cases; Early detection of high-risk defects: The ML model's Top-20% recommended test cases cover over 75% of regression defects; Unified cross-language support: The adaptive instrumentation architecture seamlessly adapts to heterogeneous technology stacks such as Java, JS, Python, and Go; The platform possesses self-evolution capabilities: Test feedback drives continuous optimization of the model and mapping library, forming a closed loop for quality assurance. Attached Figure Description

[0015] The technical solution and other beneficial effects of the present invention will become apparent from the following detailed description of specific embodiments of the invention, in conjunction with the accompanying drawings.

[0016] Figure 1 A flowchart illustrating a testing method based on dynamic execution tracing and intelligent test case selection, provided for an embodiment of the present invention.

[0017] Figure 2 This is a schematic diagram of the structure of a test platform based on dynamic execution tracing and intelligent test case filtering, provided in an embodiment of the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0019] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of the invention described below can be combined with each other as long as they do not conflict with each other.

[0020] The terms "first," "second," "third," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, platform, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0021] This invention provides a testing method, platform, storage medium, and electronic device based on dynamic execution tracing and intelligent test case filtering. The testing platform based on dynamic execution tracing and intelligent test case filtering provided by this invention can be integrated into an electronic device, such as a terminal or server. The terminal can include tablet computers, laptops, personal computers (PCs), microprocessor boxes, or other devices.

[0022] Please see Figure 1 , Figure 1 The flowchart illustrates a testing method based on dynamic execution tracing and intelligent test case filtering provided in this embodiment of the invention. This method, applied to electronic devices, includes the following steps: S1: Match the instrumentation strategy according to the language type of the program under test to obtain the original execution event stream.

[0023] In one embodiment, step S1 includes the following steps: S11, for JVM languages ​​(Java / Scala / Kotlin), uses the ASM framework to inject lightweight probes during class loading to record method entry points, branch jumps, and basic block execution sequences, generating raw execution event streams.

[0024] At test startup, a custom Agent (tracer-agent.jar) is loaded via the `-javaagent` parameter. The Agent registers a `ClassFileTransformer` to intercept each class file before the JVM loads it. The ASM framework is used to traverse the class bytecode, inserting lightweight probe call instructions before and after method entry points (`visitCode`) and conditional jump instructions (`IFEQ`, `IFNE`, etc.). The probe calls a runtime support library (also imported by the Agent) to record events such as method entry / exit, branch direction (true / false), and basic block sequences in a memory queue.

[0025] S12, for JavaScript or TypeScript languages, performs an Abstract Syntax Tree (AST) transformation to generate a raw execution event stream.

[0026] The specific process is as follows: (1) Plugin registration: During the test build phase, inject babel-plugin-test-tracer (a custom Babel plugin) into the Babel configuration (such as .babelrc or babel.config.js).

[0027] (2) AST traversal and probe injection: The plugin traverses the AST nodes to identify function declarations, arrow functions, conditional statements, loops, and asynchronous expressions.

[0028] (3) Insert a unique identifier probe for each function entry point (format: ); (4) Inject directional probes (e.g., ...) into the true / false paths of each branch condition (e.g., if (cond)). ); (5) Rewrite the import() dynamic import statement to ensure that lazy-loaded modules are also recursively instrumented at runtime.

[0029] (6) Runtime support library: Inject a lightweight global object __trace__, providing methods such as enter(), branch(), markAsync(), etc., to record execution events and cache them in a memory queue.

[0030] (7) Data output: Before the test ends, call the __trace__.flush() function to send the event stream to the coverage analysis engine in a standardized JSON format (including type, ID, file, line number, and timestamp).

[0031] (8) Compatibility guarantee: Retain TypeScript type annotations and generate Source Map to map back to the original source code to ensure the readability of coverage reports.

[0032] S13, for the Python language, parses the source file, converts the source code into an abstract syntax tree (AST), performs static instrumentation based on the AST, performs dynamic tracing, and generates the original execution event stream.

[0033] The specific steps are as follows: (1) AST rewriting (static instrumentation): The source file is parsed using Python's `ast.parse()` module, and the AST is traversed; probe statements are inserted at the beginning of each function definition (`ast.FunctionDef`). For control structures such as if, while, and for, insert marker statements at the entry points of each branch; recompile the modified AST using compile() and replace the original module (using the exec or importlib mechanism).

[0034] (2) sys.settrace (dynamic tracing): Before starting the test, call sys.settrace(trace_function) to register a global tracing callback; The trace_function listens for call, return, and line events, capturing dynamic behaviors not covered by the AST (such as lambda, eval, and dynamic property access); combined with static probe data, it completes the function call stack and execution path.

[0035] (3) Data aggregation: All events are cached by __tracer__ and reported to the platform in an intermediate format at the end of the test.

[0036] S14, for C, C++, or Go languages, uses compiler instrumentation to generate raw execution event streams.

[0037] The specific steps are as follows: (1) For C / C++ (GCC / Clang): Add `-fprofile-arcs -ftest-coverage` (GCC) or `-fprofile-instr-generate -fcoverage-mapping` (Clang) during compilation; generate `.gcda` (execution count) and `.gcno` (control flow graph metadata) files; after the test runs, call the `gcov` or `llvm-cov` tool to export the line / branch coverage data.

[0038] (2) For Go: Use `go test -cover -coverpkg=. / ...` to automatically enable built-in instrumentation; the coverage data is output in coverprofile.out format, including package, file, start and end line numbers, and whether it was covered.

[0039] (3) Unified intermediate format conversion: The platform parses the above raw data and extracts the "file-line number-execution" triple; it performs structured processing on branch information (such as arc information in GCC) and maps it into the platform's general event format.

[0040] S2 constructs a control flow graph for each function based on the source code, maps the original execution events onto the control flow graph, and obtains structured coverage data.

[0041] In one embodiment, step S2 includes the following steps: S21. Based on the parsed source code, construct a control flow graph for each function. The control flow graph includes nodes and edges, with basic blocks as nodes and the jump relationships between basic blocks as edges.

[0042] First, depending on the programming language and compilation tool, the control flow information of the program is extracted from the intermediate files or metadata generated by the corresponding compiler. For GCC, the .gcno file is parsed to identify the basic blocks of each function and the jump successor relationships between them. For Clang, the edge information in the control flow graph is extracted by combining the .profraw runtime performance data file and the .covmap mapping file. For Go, the control flow structure of the program is constructed and derived using its Abstract Syntax Tree (AST) and Static Single Assignment (SSA) intermediate representation through the go / ssa package.

[0043] A separate directed graph structure is constructed for each function, called a control flow graph. Each node in the graph represents a basic block, which is a unit of code executed sequentially; each edge represents the jump relationship between basic blocks, such as conditional branches, loops, or unconditional jumps. The entry block corresponds to the function's starting statement, and the exit block corresponds to the function's return statement or exception throwing point.

[0044] S22, during the dynamic execution of the program, records the sequence of basic blocks that each function actually passes through, and obtains the set of executed paths.

[0045] During the dynamic execution of the program, the sequence of basic blocks actually traversed by each function is recorded, such as [BB0, BB2, BB5]. This sequence is then converted into a unique path identifier (path ID) using the SHA-256 hash algorithm. A Bloom filter or in-memory hash table is used to deduplicate the path IDs, thereby counting the number of unique paths encountered during execution, providing a basis for path coverage calculation.

[0046] S23. Based on the static analysis of the control flow graph, all theoretically reachable execution paths are obtained. The difference between the reachable execution path set and the already executed path set is used to obtain the uncovered path. Based on the static analysis of the control flow graph, the set of all theoretically reachable execution paths is determined. This set is then compared with the actual set of executed paths collected in step S22; the difference between the two sets represents the uncovered paths. The analysis engine highlights the uncovered code areas in the visualization interface and automatically generates supplementary test tasks, prompting testers to improve coverage.

[0047] S3 extracts entities and relationships from structured coverage data and stores the mapping between execution events and code elements in the form of a graph database.

[0048] In one embodiment, step S3 includes the following steps: S31 processes each event stream according to preset rules, establishing the association between code elements and test cases.

[0049] Receive a standardized test execution event stream. Each event contains the following elements: test case representation, time signature, code location, and timestamp.

[0050] Each event stream is processed according to preset rules to establish a correspondence between code elements and test cases: Use case-method mapping: When the enter("func:calculate@utils.go:42") event is detected, establish the association between test case T123 and the calculate method; Use case-branch mapping: When the branch("cond:x>0@utils.go:48:true") event is detected, establish the association between test case T123 and the conditional branch (true branch); Test case-path mapping: When the test execution is completed and the path fingerprint P_abc123 is generated, the association between test case T123 and the execution path is established.

[0051] S32 persists the relationships to the graph database.

[0052] First, create the node: TestCase node: Attributes include test case ID, creation time, test type, etc. Method node: Attributes include function signature, file name, code complexity, etc. Branch node: Attributes include conditional expression, position information, conditional complexity, etc. Path node: Attributes include path hash value, path length, coverage status, etc. Next, create the relationship: Create the (TestCase)-[:COVERS]->(Method / Branch / Path) relationship; Record the following attributes in the COVERS relationship: first coverage time, most recent coverage time, number of coverages, number of associated historical defects, etc.

[0053] S33 stores the forward mapping relationship in the mapping library and automatically builds the reverse index structure.

[0054] Specifically, while storing the forward mapping, an inverse index structure is automatically built to support fast reverse queries. This requires constructing an inverse linked list and maintaining a list of relationships between each code element node and the test case nodes that cover it. Furthermore, graph database indexes are created for frequently queried fields (such as method names, file paths, and condition locations) to accelerate queries.

[0055] Furthermore, a data update mechanism should be established to maintain the accuracy of the mapping relationship.

[0056] S4: When the code changes, parse the changes, perform a risk probability assessment, and generate the optimal regression set.

[0057] In one embodiment, step S4 includes the following steps: S41, When the code is changed, parse the changes and deduce the scope of the impact of the code changes.

[0058] Parse the Git repository's diff output to extract a list of changed files, the type of change (added, modified, deleted), and the specific lines of code. For each changed file, locate the boundaries of the affected functions, classes, or methods.

[0059] S42, based on static features and dynamic test feedback, yields a risk score.

[0060] Static features are extracted using static analysis tools, specifically including: Cyclic complexity and LOC: Use Lizard (multi-language) or CodeQL to measure changes to files; Change count in the last N days: Analyzing the Git log (git log --since="30 days ago" --) <file>) Count the number of submissions; Historical Defect Density: Query a defect management system (such as Jira) to count the number of defects / lines of code associated with this file / function in the past 90 days.

[0061] Dynamic test feedback is extracted based on the mapping relationship library and test history, specifically including: Recent M-day Coverage Test Case Count: Query the mapping library to count the number of unique test cases covering this code unit in the past 7 days; Number of test cases with historically detected defects: Link defect reports with test execution records to filter out test cases where defects were found in this unit; Test case execution stability: Calculate the failure rate (number of failures / total number of coverages) when the unit is covered.

[0062] Static features and dynamic test feedback are input into a dual-channel fusion neural network model to obtain the risk probability. .

[0063] Specifically, the dual-channel fusion neural network model includes: The first sub-network, the Multilayer Perceptron (MLP), consists of three fully connected layers (128→64→32 neurons) and is used to process static features (such as cyclomatic complexity, lines of code, and historical defect density). The second sub-network, Long Short-Term Memory (LSTM) network, has 50 hidden units and is used to process the test case execution time series (including test case ID, execution result, and coverage timestamp). The outputs of the two sub-networks are weighted and concatenated by an attention mechanism, and then a risk score is generated by the Sigmoid activation function. The dual-channel fusion neural network model is trained with Focal Loss to alleviate the imbalance between positive and negative samples and to support incremental learning updates based on new test feedback.

[0064] S43, based on risk scoring, defect detection capability, and execution efficiency, selects the optimal regression set from all candidate use cases.

[0065] First, based on the risk score, the proportion of high-risk change areas covered by the test cases is calculated. Then, the number of defects found in the affected areas by the test cases is calculated. Finally, the execution efficiency of the test cases is calculated. Based on the risk score, defect detection capability, and execution efficiency, a comprehensive score is calculated, and the test cases with the highest comprehensive scores are selected as the optimal regression set.

[0066] S5 performs validation on the optimal regression set to obtain the final test results.

[0067] Specifically, the optimal regression set is driven to execute, new coverage data is obtained, the mapping relationship is updated based on the new coverage data, and the optimal regression set is input into the intelligent regression test filter to obtain new test results.

[0068] Based on the method described in the above embodiments, this embodiment will further describe it from the perspective of a test platform based on dynamic execution tracing and intelligent test case filtering. The test platform based on dynamic execution tracing and intelligent test case filtering can be implemented as an independent entity or integrated into an electronic device. The electronic device can be a terminal, server, or other device. The terminal can include a tablet computer, a laptop computer, a personal computer (PC), a microprocessor box, or other devices.

[0069] Please see Figure 2 , Figure 2 This invention specifically describes a test platform based on dynamic execution tracing and intelligent test case filtering, applied to electronic devices. This test platform may include: The dynamic instrumentation and execution tracing module is used to match the instrumentation strategy according to the language type of the program under test and obtain the original execution event flow; The coverage analysis module is used to construct a control flow graph for each function based on the source code, and map the original execution events onto the control flow graph to obtain structured coverage data. The mapping module is used to extract entities and relationships from the structured coverage data and store the mapping relationship between execution events and code elements in the form of a graph database; The intelligent regression test filter is used to parse the changes to the code, assess the risk probability, and generate the optimal regression set when the code is modified. The validation module is used to perform validation on the optimal regression set and obtain the final test results.

[0070] Furthermore, the intelligent regression test screener includes: The Change Impact Analysis submodule is used to parse the changes made to the code and deduce the scope of the impact of the code changes; The high-risk identification submodule is used to obtain a risk score based on static features and dynamic test feedback. The optimal use case recommendation submodule is used to select the optimal regression set from all candidate use cases based on risk scoring, defect detection capability, and execution efficiency.

[0071] In specific implementation, the above modules and / or units can be implemented as independent entities, or they can be arbitrarily combined and implemented as the same or several entities. For the specific implementation of the above modules and / or units, please refer to the previous method embodiments. For the specific beneficial effects that can be achieved, please refer to the beneficial effects in the previous platform embodiments, which will not be repeated here.

[0072] In addition, this embodiment of the invention also provides an electronic device, which may be a computer, tablet computer, or other similar device. This electronic device can implement the steps in any embodiment of the testing method based on dynamic execution tracing and intelligent test case filtering provided in this embodiment of the invention. Therefore, it can achieve the beneficial effects achievable by any testing method based on dynamic execution tracing and intelligent test case filtering provided in this embodiment of the invention, as detailed in the preceding embodiments, and will not be repeated here.

[0073] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. Therefore, embodiments of the present invention provide a storage medium storing multiple instructions that can be loaded by a processor to execute the steps of any embodiment of the testing method based on dynamic execution tracing and intelligent use case screening provided by the present invention.

[0074] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0075] Since the instructions stored in the storage medium can execute the steps in any embodiment of the test method based on dynamic execution tracing and intelligent test case filtering provided in the embodiments of the present invention, the beneficial effects that any test method based on dynamic execution tracing and intelligent test case filtering provided in the embodiments of the present invention can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.

[0076] The foregoing has provided a detailed description of a testing method, platform, storage medium, and electronic device based on dynamic execution tracing and intelligent test case filtering provided by embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.< / file>

Claims

1. A testing method based on dynamic execution tracing and intelligent test case selection, characterized in that, include: The instrumentation strategy is matched according to the language type of the program under test to obtain the original execution event flow; A control flow graph is constructed for each function based on the source code, and the original execution events are mapped onto the control flow graph to obtain structured coverage data. Entities and relationships are extracted from the structured coverage data and stored in the form of a graph database to represent the mapping between execution events and code elements. When the code changes, the changes are parsed, a risk probability assessment is performed, and an optimal regression set is generated. Validation is performed on the optimal regression set to obtain the final test results.

2. The testing method based on dynamic execution tracing and intelligent test case selection according to claim 1, characterized in that, Based on the language type of the program under test, an instrumentation strategy is matched to obtain the original execution event flow, including: For JVM languages, the ASM framework is used to inject lightweight probes during class loading to record method entry points, branch jumps, and basic block execution sequences, generating raw execution event streams. For JavaScript or TypeScript languages, the Abstract Syntax Tree (AST) transformation generates the raw execution event stream; For the Python language, the source file is parsed, the source code is converted into an abstract syntax tree (AST), static instrumentation is performed based on the AST, and dynamic tracing is performed to generate the original execution event stream; For C, C++, or Go languages, compiler instrumentation is used to generate raw execution event streams.

3. The testing method based on dynamic execution tracing and intelligent test case selection according to claim 1, characterized in that, A control flow graph is constructed for each function based on the source code. The original execution events are mapped onto the control flow graph to obtain structured coverage data, including: Based on the parsed source code, a control flow graph is constructed for each function; the control flow graph includes nodes and edges, with basic blocks as nodes and the jump relationships between basic blocks as edges. During the dynamic execution of the program, the sequence of basic blocks actually traversed by each function is recorded to obtain the set of executed paths; Based on the static analysis of the control flow graph, all theoretically reachable execution paths are obtained, and the uncovered paths are obtained by subtracting the reachable execution path set from the executed path set.

4. The testing method based on dynamic execution tracing and intelligent test case selection according to claim 1, characterized in that, Entities and relationships are extracted from the structured coverage data, and the mapping relationships between execution events and code elements are stored in the form of a graph database, including: Each event stream is processed according to preset rules to establish the association between code elements and test cases; Persist the relationships to the graph database; The forward mapping relationships are stored in the mapping library, and the reverse index structure is automatically built.

5. The testing method based on dynamic execution tracing and intelligent test case selection according to claim 1, characterized in that, When code changes, the changes are parsed, a risk probability assessment is performed, and a minimum regression test set is generated, including: When code changes, analyze the changes and deduce the scope of impact. A risk score is obtained based on static features and dynamic test feedback; Based on risk scoring, defect detection capability, and execution efficiency, the optimal regression set is selected from all candidate use cases.

6. The testing method based on dynamic execution tracing and intelligent test case selection according to claim 1, characterized in that, Validation is performed on the minimal regression test set to obtain the final test results, including: The optimal regression set is executed to obtain new coverage data. The mapping relationship is updated based on the new coverage data. The optimal regression set is then input into the intelligent regression test filter to obtain new test results.

7. A testing platform based on dynamic execution tracing and intelligent test case filtering, characterized in that, The dynamic instrumentation and execution tracing module is used to match the instrumentation strategy according to the language type of the program under test and obtain the original execution event flow; The coverage analysis module is used to construct a control flow graph for each function based on the source code, and map the original execution events onto the control flow graph to obtain structured coverage data. The mapping module is used to extract entities and relationships from the structured coverage data and store the mapping relationship between execution events and code elements in the form of a graph database; The intelligent regression test filter is used to parse the changes to the code, assess the risk probability, and generate the optimal regression set when the code is modified. The validation module is used to perform validation on the optimal regression set and obtain the final test results.

8. The test platform based on dynamic execution tracing and intelligent test case filtering according to claim 7, characterized in that, The intelligent regression test filter includes: The Change Impact Analysis submodule is used to parse the changes made to the code and deduce the scope of the impact of the code changes; The high-risk identification submodule is used to obtain a risk score based on static features and the execution time series of test cases covering the code; The optimal use case recommendation submodule is used to select the optimal regression set from all candidate use cases based on the scope of change impact, high-risk code areas, and mapping relationships stored in the mapping library.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to execute the test method based on dynamic execution tracing and intelligent use case screening as described in any one of claims 1 to 7.

10. An electronic device, characterized in that, It includes a processor and a memory, the processor being electrically connected to the memory, the memory being used to store instructions and data, and the processor being used to execute the steps in the test method based on dynamic execution tracing and intelligent use case screening as described in any one of claims 1 to 7.