From: "R. Mark Volkmann" Date: 2005-06-30T09:33:30+09:00 Subject: Re: running unit tests in graphical mode Quoting Joe Van Dyk : > On 6/29/05, gabriele renzi wrote: > > 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 } Can it really be that simple? I thought you'd have to do something like this. # 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] if ARGV[0] == 'gui' # Note: The one-click installer doesn't install Fox, GTK or GTK2. require 'test/unit/ui/tk/testrunner' $runner = Test::Unit::UI::Tk::TestRunner else require 'test/unit/ui/console/testrunner' $runner = Test::Unit::UI::Console::TestRunner end Dir.foreach('../test') do |filename| next if not filename =~ /(\S*Test).rb$/ require "../test/#{filename}" klass = Object.const_get($1) $runner.run(klass) end -- R. Mark Volkmann Partner, Object Computing, Inc.