class Tryouts::TestBatch

def initialize(testrun, **options)

def initialize(testrun, **options)
  @testrun         = testrun
  @container       = Object.new
  @options         = options
  @formatter       = Tryouts::CLI::FormatterFactory.create_formatter(options)
  @output_manager  = options[:output_manager]
  @global_tally    = options[:global_tally]
  @failed_count    = 0
  @status          = :pending
  @results         = []
  @start_time      = nil
  @test_case_count = 0
  @setup_failed    = false
  # Setup container for fresh context mode - preserves @instance_variables from setup
  @setup_container = nil
  # Circuit breaker for batch-level failure protection
  @consecutive_failures     = 0
  @max_consecutive_failures = options[:max_consecutive_failures] || 10
  @circuit_breaker_active   = false
  # Expose context objects for testing - different strategies for each mode
  @shared_context = if options[:shared_context]
                      @container  # Shared mode: single container reused across tests
                    else
                      FreshContextFactory.new  # Fresh mode: factory that creates new containers
                    end
end