Ryan Davis
4/3/2007 8:44:00 AM
On Apr 2, 2007, at 18:35 , Brett Schuchert wrote:
> Am I missing something when using Test::Unit in Eclipse? I am used to
> using JUnit and/or NUnit and being able to select a project and run
> all
> of the tests. I don't see this feature and I suspect I'm just blind.
>
> I've come up with the following "automated" suite script that seems to
> get the job done. I had to do this in JUnit 5 years ago when the JUnit
> eclipse 2.x plugin didn't support this:
>
> require 'test/unit'
> require 'find'
>
> def allFiles
> files = Array.new
> Find.find('./') { |f|
> if(f =~ /_test/)
> f = f.sub(/\.\//, "").sub(/\.rb$/,"")
> files.push(f)
> end
> }
> files
> end
As far as eclipse goes, I cannot help you. Generically, there are
many ways to go about it.
+ Use testrb:
% testrb test/**/*_test.rb
[...]
Finished in 5.562656 seconds.
297 tests, 886 assertions, 0 failures, 0 errors
+ Here is a much more concise version of what you wrote:
(%w(test/unit) + Dir['**/*_test.rb']).each { |f| require f }
+ And then there is autotest:
% autotest
# and happily leave it running all day
+ And probably many more.