From: Robert Feldt Date: 2001-11-29T20:08:41+09:00 Subject: [ruby-talk:26882] Re: Small RubyUnit extension On Thu, 29 Nov 2001, Dave Thomas wrote: > I got sick of typing all the housekeeping when creating a new RubyUnit > test class, so I wrote something to make it simpler. Now I just say: > Good that someone tries to get a solution to this into the RubyUnit distr; I guess there are quite a few solutions out there among us lazy programmers... ;-) Nice that you can simply require all your test files in an alltests.rb file and then run them all by running it. While we're at it I'd like to see that one can choose individual test methods by giving a Regexp at command line and allow this even if multiple test classes available. Here's a quick change to your END section: END { suite = RUNIT::TestSuite.new if ARGV.size == 0 RUNIT::TEST_CLASSES.each {|klass| suite.add(klass.suite)} else ARGV.each do |testmethod| RUNIT::TEST_CLASSES.each do |cls| if testmethod[0] == ?/ && testmethod[-1] == ?/ && Regexp === (re = eval(testmethod)) testmethods = cls.public_instance_methods.select{|m| /^test/ =~ m && re =~ m} else testmethods = [testmethod] end testmethods.sort.each {|method| suite.add(cls.new(method))} end end end RUNIT::CUI::TestRunner.run(suite) } Regards, Robert