From: Eric Hodel Date: 2006-03-10T07:42:26+09:00 Subject: Re: Test Harness? On Mar 9, 2006, at 8:56 AM, Troy Denkinger wrote: > I'm starting to feel my way around in Ruby after having been a > Perler for a > very long time. I'm trying to figure out how to write a proper > test harness > in Ruby and so far I'm running up against a brick wall. All my > classes have > good unit tests using Test::Unit. However, I want to create a > harness that > I can use to run all of the unit tests at a go and give me a > success/failure > report across all tests. Every time I make a significant change I > have to > remember to run all my unit tests, which is error prone. > > I have written test harnesses in Perl using Test::Harness::Straps > that does > exactly what I want - for Perl. Is there a similar library for > Ruby? If > so, I have yet to find it. testrb (which comes with Ruby and Test::Unit) does this for you. You only need to specify a directory and have your test files named properly (which is test_*.rb). $ ls test/ $ ls test test_one.rb test_two.rb $ testrb test Loaded suite test Started .. Finished in 0.003477 seconds. 2 tests, 2 assertions, 0 failures, 0 errors $ If you named your tests wrong you can use the -p argument: $ ls test one_test.rb two_test.rb $ testrb test -p /_test.rb/ Loaded suite test Started .. Finished in 0.002296 seconds. 2 tests, 2 assertions, 0 failures, 0 errors -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com