Class: Test::Unit::UI::Tk::TestRunner

Inherits:
Object
  • Object
show all
Extended by:
Test::Unit::UI::TestRunnerUtilities
Defined in:
lib/test/unit/ui/tk/testrunner.rb

Overview

Runs a Test::Unit::TestSuite in a Tk UI. Obviously, this one requires you to have Tk and the Ruby Tk extension installed.

Instance Method Summary collapse

Methods included from Test::Unit::UI::TestRunnerUtilities

run, start_command_line_test

Constructor Details

#initialize(suite, output_level = NORMAL) ⇒ TestRunner

Creates a new TestRunner for running the passed suite.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/test/unit/ui/tk/testrunner.rb', line 26

def initialize(suite, output_level = NORMAL)
  if (suite.respond_to?(:suite))
    @suite = suite.suite
  else
    @suite = suite
  end
  @result = nil

  @red = false
  @fault_detail_list = []
  @runner = Thread.current
  @restart_signal = Class.new(Exception)
  @viewer = Thread.start do
    @runner.join rescue @runner.run
    ::Tk.mainloop
  end
  @viewer.join rescue nil # wait deadlock to handshake
end

Instance Method Details

#startObject

Begins the test run.



46
47
48
49
50
51
52
# File 'lib/test/unit/ui/tk/testrunner.rb', line 46

def start
  setup_ui
  setup_mediator
  attach_to_mediator
  start_ui
  @result
end