FW_TestStepDataCollector Class Flow
Test step data flow from execution to CSV storage
Overview
This sequence diagram illustrates the complete flow of test step data collection in the automation framework, from test completion through to CSV file persistence.
Sequence Diagram
sequenceDiagram
participant Test as Test Step
participant CA as FW_CustomAssertJU
participant DC as FW_TestStepDataCollector
participant DPR as FW_TestStepDataProcessor
participant CSV as CSV File
Test->>CA: autoPass/autoFail()
CA->>CA: Capture test step data
CA->>CA: Take screenshot (if enabled)
CA->>DC: add(testStepData)
DC->>DC: Add to pendingSteps queue
DC->>DC: Check batch size threshold
alt Batch size reached
DC->>DC: Trigger batch processing
DC->>DPR: processBatch(pendingSteps)
DPR->>DPR: Format test step records
DPR->>CSV: Write batch to CSV file
CSV-->>DPR: Confirmation
DPR-->>DC: Processing complete
DC->>DC: Clear processed steps
end
DC-->>CA: Data queued successfully
CA-->>Test: Assertion complete
Note over DC,DPR: Batch processing occurs periodically<br/>based on queue size
Key Features
Data Collection Strategy
- Asynchronous Collection: Test steps are queued without blocking test execution
- Batch Processing: Data is written to CSV in configurable batch sizes
- Thread-Safe Operations: Concurrent test execution supported via synchronized collections
- Memory Efficient: Automatic flush prevents memory overflow on long test runs
CSV File Management
- Automatic File Creation: CSV file created on first data write
- Header Management: Column headers written once at file creation
- Append Mode: New data appended to existing file during test run
- UTF-8 Encoding: Ensures proper character encoding for international characters
Processing Thresholds
- Default Batch Size: 100 test steps
- Configurable Threshold: Adjustable via testConfig.properties
- Forced Flush: Manual flush available for immediate persistence
- Final Flush: Automatic flush on test suite completion
Data Flow Stages
- Test Step Completion: autoPass/autoFail methods capture test results
- Screenshot Capture: Optional screenshot taken for visual validation
- Queue Addition: Test step data added to pending queue
- Threshold Check: Batch size evaluated for processing trigger
- Batch Processing: Pending steps formatted and written as CSV records
- File Persistence: Data appended to CSV file with proper encoding
- Queue Cleanup: Processed steps removed from memory
CSV Output Schema
The generated CSV file includes the following columns:
| Column | Description |
|---|---|
| Test Run ID | Unique identifier for the test run |
| Test Suite Name | Name of the test suite class |
| Test Case Name | Name of the test method |
| Test Step Number | Sequential step number within test case |
| Step Description | Human-readable description of the step |
| Pass/Fail Status | Result status (PASS, FAIL, SKIP) |
| Execution Timestamp | UTC timestamp of step execution |
| Duration | Step duration in milliseconds |
| Screenshot Path | Path to screenshot file (if captured) |
| Error Message | Error details (if failed) |
Related Components
- FW_CustomAssertJU: Entry point for test step data collection
- FW_TestStepDataCollector: Manages queuing and batch coordination
- FW_TestStepDataProcessor: Handles CSV formatting and file I/O
- FW_TestStep: Data object containing step metadata and results
- FW_CSVUtils: Utility methods for CSV file operations
Performance Considerations
- Memory Usage: Queue size directly impacts memory footprint
- I/O Operations: Batch writing reduces file system overhead
- Thread Safety: Synchronized operations ensure data integrity
- Immediate Persistence: CSV data written immediately vs. held until test completion
- Data Persistence: All test steps are eventually written to CSV for data lake ingestion
Related Diagrams
| Document | Description |
|---|---|
| Architecture Overview | Framework layers |
| Maven to First Test Case | Test execution flow |
| Test Completion to BigQuery | Cloud upload process |