hello,
I’d like to be able to run one or two testroutines from a
Test::Unit::TestCase-object. Is that possible?
For example:
in test.rb:
class TC_fe < Test::Unit::TestCase
def test_plus
assert_equal( 1+5, 6)
end
def test_minus
assert_equal( 1-5, 6)
end
end
==============
in do_it:
#!/usr/bin/ruby1.8
require ‘test’
===================
Now all testroutines from TC_fe are run. Is it possible only to run
test_minus? Or the routines with the names I collect via command line
arguments?
thanks in advance!
Ruud
This should work
ruby test.rb -n test_minus
Farrel
no. no succes.
The point is that my do_it script in the mail is simplified a bit. It
is more like
#!/usr/bin/ruby1.8
require ‘getoptlong’
require ‘test’
opts = GetoptLong.new(
#[ “–name”, “-n”, GetoptLong::REQUIRED_ARGUMENT ],
[ “-h”, GetoptLong::NO_ARGUMENT ],
[ “-d”, GetoptLong::NO_ARGUMENT ],
[ “-v”, GetoptLong::NO_ARGUMENT ]
)
It either runs all tests (when I define the -n option which is
commented out above), or it complains that -n is an invalid option.
I am afraid that I have to code some things the Test-objects do
magically when nothing is specified.
But I have no single clue as to what it should be.
Any ideas?
tia, Ruud
On Tue, Aug 5, 2008 at 10:48, ruud grosmann [email protected]
wrote:
opts = GetoptLong.new(
magically when nothing is specified.
But I have no single clue as to what it should be.
Any ideas?
tia, Ruud
Lookup test\unit\autorunner.rb and see how it does its stuff.
Copy&paste the part that starts only single thread.
Or delegate to its command line parser.
Jano