Test Assets Scanner
Test suite discovery and metrics collection process
Description
This document illustrates the workflow for the TestAssetsScanner within the automation framework. It includes a detailed diagram using Mermaid syntax to represent the flow of actions and interactions between different components involved in the test asset scanning process.
Purpose and Function
The TestAssetsScanner performs the following critical functions:
- Discovery: Identifies all test suite files in the project
- Validation: Verifies test file structure and accessibility
- Initialization: Prepares test suite metadata and configurations
- Metrics: Calculates test counts and complexity metrics
- Reporting: Generates pre-execution test inventory reports
Workflow Diagram
flowchart TD
subgraph POM["Maven POM Configuration"]
P1[maven-antrun-plugin<br/>run-test-manager]
end
subgraph FW_TestRunManager["Test Run Manager"]
P1 --> TRM1[main method]
TRM1 <--> TRM2[getInstance<br/>Singleton]
TRM1 <--> TRM3[prepareTestRun]
TRM1 --> TRM4[printTestRunMetrics]
end
subgraph FW_ReportUtils["Report Utilities"]
TRM4 --> RU1[printTestRunMetrics<br/>Console output]
end
subgraph FW_TestSuite["Test Suite Processor"]
TRM3 <--> TS1[getTestSuitesCollection]
TS1 <--> TS2[getTestSuiteFiles<br/>Scan for *_JUnit.java]
TS1 <--> TS3[processTestSuites]
TS3 <--> processTestSuite
subgraph processTestSuite["Process Individual Test Suite"]
TS_PTS1[new FW_TestSuite instance] --> TS_PTS2
TS_PTS2[pathPresentProject<br/>Verify project path] --> TS_PTS3
TS_PTS3[fileExists<br/>Validate file presence] --> TS_PTS4
TS_PTS4[Initialize test suite details<br/>Extract metadata] --> TS_PTS5
TS_PTS5[Start Methods Loop<br/>Process @Test methods] --> TS_PTS6
TS_PTS6[Extract test cases] --> TS_PTS7
TS_PTS7[Count test steps] --> TS_PTS8
TS_PTS8[Calculate metrics]
end
end
subgraph FW_FileDirUtils["File & Directory Utilities"]
TS2 <--> FDU1[findFiles<br/>Pattern matching]
TS3 <--> FDU2[getFileName<br/>Extract name]
TS_PTS3 <--> FDU3[fileExists<br/>Validation]
end
subgraph FW_SystemUtils["System Utilities"]
TS_PTS2 <--> SU1[pathPresentProject<br/>Project root resolution]
end
Process Flow Steps
- Maven Trigger: Antrun plugin executes during pre-test phase
- Manager Initialization: TestRunManager singleton created
- Test Discovery: Scans for all files matching test suite pattern
- Suite Processing: Each suite file is validated and parsed
- Method Analysis: Extracts @Test, @BeforeAll, @BeforeEach annotations
- Metrics Collection: Counts tests, steps, and complexity
- Report Generation: Outputs comprehensive test inventory
Key Components
FW_TestRunManager
Singleton pattern for test run coordination. Manages test suite collection lifecycle. Aggregates metrics across all test suites.
FW_TestSuite
Represents individual test suite metadata. Processes Java reflection for test discovery. Calculates suite-level metrics.
Utility Classes
- FW_FileDirUtils: File system operations and pattern matching
- FW_SystemUtils: Project path resolution and system properties
- FW_ReportUtils: Formatted console and file output
Output Metrics
The scanner produces the following metrics:
- Total test suites discovered
- Total test cases per suite
- Total test steps estimated
- Parameterized test counts
- Disabled test identification
- Execution time estimates
Related Documentation
| Document | Description |
|---|---|
| Maven to Test Case Flow | Complete test execution flow |
| Architecture Overview | Framework layers |
| Test Development Guide | Writing tests |