Module: Evilution::Integration::TestUnit::Dispatcher

Defined in:
lib/evilution/integration/test_unit/dispatcher.rb

Overview

Builds a Test::Unit::TestSuite from a list of TestCase subclasses and runs it via the console runner with output captured to a StringIO. Owning this responsibility separately keeps the runner library require + suite assembly in one place — used by both the baseline path (Evilution::Integration::TestUnit .run_baseline_test_file) and the per-mutation path (#run_tests).

Class Method Summary collapse

Class Method Details

.call(test_case_classes, name: "evilution") ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/evilution/integration/test_unit/dispatcher.rb', line 14

def call(test_case_classes, name: "evilution")
  require "test/unit/ui/console/testrunner"
  suite = ::Test::Unit::TestSuite.new(name)
  test_case_classes.each { |klass| suite << klass.suite }
  out = StringIO.new
  runner = ::Test::Unit::UI::Console::TestRunner.new(suite, output: out)
  runner.start
end

.test_method_count(test_case_classes) ⇒ Object



23
24
25
# File 'lib/evilution/integration/test_unit/dispatcher.rb', line 23

def test_method_count(test_case_classes)
  test_case_classes.sum { |klass| klass.suite.tests.length }
end