module Attestify::TestExecutor

A TestExecutor is responsible for running and outputing the test reports. This module expects reporter and test_list to be implemented. The reporter method must return an Attestify::Reporter, while test_list must return an Attestify::TestList.

Attributes

exit_code[R]

Public Instance Methods

start() click to toggle source
# File lib/attestify/test_executor.rb, line 9
def start
  before_exec
  @exit_code = true
  timer = Attestify::Timer.time { run }
rescue StandardError => e
  @exit_code = 2
  STDERR.puts("Error running tests: #{e}\n  #{e.backtrace.join("\n  ")}")
ensure
  reporter.timer = timer
  reporter.report unless @ignore_reporting
  after_exec
end

Private Instance Methods

after_exec() click to toggle source
# File lib/attestify/test_executor.rb, line 39
def after_exec; end
after_run() click to toggle source
# File lib/attestify/test_executor.rb, line 35
def after_run; end
before_exec() click to toggle source
# File lib/attestify/test_executor.rb, line 37
def before_exec; end
before_run() click to toggle source
# File lib/attestify/test_executor.rb, line 33
def before_run; end
report?() click to toggle source
# File lib/attestify/test_executor.rb, line 41
def report?
  true
end
run() click to toggle source
# File lib/attestify/test_executor.rb, line 24
def run
  before_run
  Attestify::TestRunner.new(test_list, reporter).run
  @exit_code = 1 unless reporter.passed?
  after_run
end