Class: Test::Unit::UI::GTK::TestRunner

Inherits:
Object
  • Object
show all
Extended by:
TestRunnerUtilities
Defined in:
lib/test/unit/ui/gtk/testrunner.rb

Overview

Runs a Test::Unit::TestSuite in a Gtk UI. Obviously, this one requires you to have Gtk (www.gtk.org/) and the Ruby Gtk extension (ruby-gnome.sourceforge.net/) installed.

Instance Method Summary collapse

Methods included from TestRunnerUtilities

run, start_command_line_test

Constructor Details

#initialize(suite, output_level = NORMAL) ⇒ TestRunner

Creates a new TestRunner for running the passed suite.



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

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

  @runner = Thread.current
  @restart_signal = Class.new(Exception)
  @viewer = Thread.start do
    @runner.join rescue @runner.run
    Gtk.main
  end
  @viewer.join rescue nil # wait deadlock to handshake
end

Instance Method Details

#startObject

Begins the test run.



43
44
45
46
47
48
49
# File 'lib/test/unit/ui/gtk/testrunner.rb', line 43

def start
  setup_mediator
  setup_ui
  attach_to_mediator
  start_ui
  @result
end