class Test::Unit::UI::TestRunnerMediator

Provides an interface to write any given UI against, hopefully making it easy to write new UIs.

Constants

FINISHED
RESET
STARTED

Public Class Methods

new(suite) click to toggle source

Creates a new TestRunnerMediator initialized to run the passed suite.

# File test-unit-3.5.5/lib/test/unit/ui/testrunnermediator.rb, line 25
def initialize(suite)
  @suite = suite
end

Public Instance Methods

run() click to toggle source

Runs the suite the TestRunnerMediator was created with.

# File test-unit-3.5.5/lib/test/unit/ui/testrunnermediator.rb, line 31
def run
  AutoRunner.need_auto_run = false

  result = create_result

  Test::Unit.run_at_start_hooks
  start_time = Time.now
  begin
    catch do |stop_tag|
      result.stop_tag = stop_tag
      with_listener(result) do
        notify_listeners(RESET, @suite.size)
        notify_listeners(STARTED, result)

        run_suite(result)
      end
    end
  ensure
    elapsed_time = Time.now - start_time
    notify_listeners(FINISHED, elapsed_time)
  end
  Test::Unit.run_at_exit_hooks

  result
end
run_suite(result=nil) click to toggle source

Just for backward compatibility for NetBeans. NetBeans should not use monkey patching. NetBeans should use runner change public API.

See GitHub#38

https://github.com/test-unit/test-unit/issues/38
# File test-unit-3.5.5/lib/test/unit/ui/testrunnermediator.rb, line 63
def run_suite(result=nil)
  if result.nil?
    run
  else
    @suite.run(result) do |channel, value|
      notify_listeners(channel, value)
    end
  end
end