Class: FlakyTester::TestRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/flaky_tester/test_runner.rb,
lib/flaky_tester/test_runner/errors/rspec_error.rb

Defined Under Namespace

Classes: Errors

Instance Method Summary collapse

Constructor Details

#initialize(command_options) ⇒ TestRunner

Returns a new instance of TestRunner.



7
8
9
10
# File 'lib/flaky_tester/test_runner.rb', line 7

def initialize(command_options)
  @command_options = command_options
  @results_file = build_results_file
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/flaky_tester/test_runner.rb', line 12

def run
  total_runs = @command_options[:times]

  for current_run in (1..total_runs)
    print("Running #{current_run}/#{total_runs}...\r")

    command_succeeded = system(command)

    raise(Errors::RspecError) unless command_succeeded
  end

  @results_file
end