Class ExplorationSessionRunner

java.lang.Object
io.github.jspinak.brobot.tools.testing.exploration.ExplorationSessionRunner

@Component public class ExplorationSessionRunner extends Object
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

  1. Initialize test session with unique ID
  2. Start video recording for visual documentation
  3. Log initial application state
  4. Execute state transition to target destination
  5. Capture performance metrics
  6. Log results and any errors
  7. 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:

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 Details

  • Method Details

    • runTest

      public void runTest(String destination)
      Executes a test run to navigate to a specified destination state.

      This method orchestrates a complete test execution cycle including:

      1. Session initialization with unique identifier
      2. Video recording for visual documentation
      3. Initial state capture and logging
      4. State transition execution with timing
      5. Result verification and error handling
      6. Performance metrics collection
      7. 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: