Unit Test Execution Order via Dependency Graph Segmentation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing unit testing methods face challenges in independently testing software units due to dependencies, parallel execution issues, and indeterministic failures, especially in client-server applications where widespread failures occur and integration tests often fail due to unavailable servers.
Innovation Solution
A computer-implemented method that analyzes units to determine a dependency graph, determines an execution order based on this graph, and executes unit tests accordingly, allowing for parallel testing where safe and skipping tests for units with errors or incomplete prerequisites, while displaying a visual representation of the dependency graph for user input and annotation modification.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If unit tests are executed in parallel threads to improve testing speed, then productivity increases, but collisions and indeterministic failures occur reducing reliability
Solution Approach 1:
The patent segments the test execution process by dividing units into independent test groups based on dependency analysis. Units are segmented into levels where level 1 units have no dependencies and can be tested in parallel, while level 2+ units wait for their dependencies to complete. This segmentation enables safe parallel execution without collisions.
Solution Approach 2:
The patent performs preliminary dependency analysis before test execution to build a dependency graph and determine execution levels. This preliminary action identifies which units can be safely executed in parallel and which must wait, preventing collisions before they occur during test execution.
2Measurement precision
If dependent units are tested together to improve coverage, then measurement precision improves, but errors propagate causing widespread failures
Solution Approach 1:
The patent performs preliminary dependency analysis to build a dependency graph that maps relationships between units. This preliminary action enables the system to understand which units must be tested before others, allowing comprehensive coverage while isolating errors through ordered execution.
Solution Approach 2:
The patent implements dynamic test execution where the testing order adapts based on dependency relationships. Units are executed dynamically in levels, where level 1 units execute first, then level 2 units wait for level 1 to complete, and so on. This dynamic approach ensures comprehensive coverage while preventing error propagation.
3Reliability
If all units are tested to improve completeness, then productivity decreases due to time-consuming parallel execution, but skipping tests reduces completeness
Solution Approach 1:
The patent segments units into execution levels based on dependencies, allowing the system to test only the necessary number of units in each level without redundant testing. This segmentation enables efficient parallel execution while maintaining completeness by ensuring all units are tested in the correct order.
Solution Approach 2:
The patent implements dynamic test selection where units are executed in levels based on their dependencies. This dynamic approach ensures all units are tested (completeness) while avoiding redundant tests by waiting for dependencies to resolve, improving overall testing efficiency.
Data Source
AI summary
Implementations of the present disclosure provide methods including analyzing a plurality of units of a software application to determine a dependency graph defining that at least a first unit depends on a second unit. Each unit includes executable instructions. An execution order is determined for the units based on the dependency graph, wherein the execution order specifies execution of the second unit before the first unit. Unit tests are executed for the units according to the execution order, including executing a unit test of the second unit before the first unit. Executing a unit test for a unit comprises executing the executable instructions of the unit and comparing a resulting value to an expected value.


