Quoting Joe Van Dyk said:
Joe Van Dyk ha scritto:
Hi,
If I have a bunch of unit tests that all require 'test/unit', what'= s
the best way to run all those unit tests in a graphical test runner= ?
I think if you do
ruby testfile.rb --help
you shopuld be able to see some gui options, i.e. --fox or --gtk
HTH
Thanks, I'll try that out.
Currently, the file that runs all the unit tests looks something like
(from memory)
Dir["tests/*.rb].each { |file| require file }
=20
Can it really be that simple? I thought you'd have to do something like = this.
=20
# This runs a suite of unit tests.
# Copy it to some directory in $PATH such as $RUBY_HOME/bin.
# Run it from your project lib directory where the unit test files
# are in a sibling directory named 'test'.
# Usage: ruby suite.rb [gui]
=20
if ARGV[0] =3D=3D 'gui'
# Note: The one-click installer doesn't install Fox, GTK or GTK2.
require 'test/unit/ui/tk/testrunner'
$runner =3D Test::Unit::UI::Tk::TestRunner
else
require 'test/unit/ui/console/testrunner'
$runner =3D Test::Unit::UI::Console::TestRunner
end
=20
Dir.foreach('../test') do |filename|
next if not filename =3D~ /(\S*Test).rb$/
require "../test/#{filename}"
klass =3D Object.const_get($1)
$runner.run(klass)
end