Class ExplorationSessionRunner
java.lang.Object
io.github.jspinak.brobot.tools.testing.exploration.ExplorationSessionRunner
Executes individual test runs with comprehensive logging and monitoring capabilities.
ExplorationSessionRunner is responsible for executing specific test scenarios, typically involving navigation to a particular state and verification of the transition. It provides:
- Session-based test execution with unique identifiers
- Comprehensive logging of test steps and results
- Performance metrics collection
- Error handling with screenshot capture on failures
- Video recording of test sessions
Test Execution Flow
- Initialize test session with unique ID
- Start video recording for visual documentation
- Log initial application state
- Execute state transition to target destination
- Capture performance metrics
- Log results and any errors
- Stop recording and finalize session
Error Handling
The runner implements robust error handling:
- Captures screenshots on transition failures
- Logs detailed error information with context
- Ensures video recording is stopped even on exceptions
- Records performance metrics regardless of success/failure
Performance Monitoring
Tracks and logs:
- Individual transition duration
- Total test execution time
- Success/failure rates
Integration with Test Framework
Works as part of the larger testing exploration framework:
ExplorationOrchestrator
orchestrates multiple test runsStateTraversalService
uses this for individual state visits-
invalid reference
ActionLogger
Example Usage
// Execute a test to navigate to the login state
explorationSessionRunner.runTest("LoginState");
// The runner will:
// 1. Start recording
// 2. Log current state
// 3. Attempt transition to LoginState
// 4. Capture results and metrics
// 5. Stop recording
- Author:
- jspinak
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionExplorationSessionRunner
(StateNavigator stateTransitionsManagement, StateMemory stateMemory, StateService allStatesInProjectService, ScreenshotCapture captureScreenshot, Action action) -
Method Summary
-
Constructor Details
-
Method Details
-
runTest
Executes a test run to navigate to a specified destination state.This method orchestrates a complete test execution cycle including:
- Session initialization with unique identifier
- Video recording for visual documentation
- Initial state capture and logging
- State transition execution with timing
- Result verification and error handling
- Performance metrics collection
- Session cleanup and finalization
The test execution is fully instrumented with logging at each step, providing complete visibility into the test process. Screenshots are automatically captured on failures for debugging purposes.
Performance metrics tracked include:
- Transition duration - time to navigate to destination
- Total test duration - complete execution time
- Parameters:
destination
- the name of the target state to navigate to. Must be a valid state name registered in the state service.- Throws:
RuntimeException
- if the destination state is not found in the project- See Also:
-