B
Brett Schuchert
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
allFiles().each {|f| require f}
A comment:
This is simple, I know. I only recursively find files that match
*_test.rb from the current directory then I require the files and
Test::Unit automatically generates the suite method for me. For now this
is adequate.
So two questions:
1. Is the necessary or what am I missing (I've just started using Ruby a
few days ago).
2. I assume someone can suggest to me ways to shorten this up. I'm all
ears.
Thanks!
Brett
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
allFiles().each {|f| require f}
A comment:
This is simple, I know. I only recursively find files that match
*_test.rb from the current directory then I require the files and
Test::Unit automatically generates the suite method for me. For now this
is adequate.
So two questions:
1. Is the necessary or what am I missing (I've just started using Ruby a
few days ago).
2. I assume someone can suggest to me ways to shorten this up. I'm all
ears.
Thanks!
Brett