From: Phlip Date: 2006-09-05T10:25:06+09:00 Subject: run only one test case? Rubies: Here's a normal example of running a Ruby/Unit suite: aTestSuite = Test::Unit::TestSuite.new("MRW") aTestSuite << a bunch of suites got = runner.run(aTestSuite) The above code runs all test cases. I want to run only one of them. A "test suite" is (generally) a list of test cases. Here, it is a list of lists of test cases. Running only one *.rb file would run all cases in that file's suites. I want to run only one test case. Here are three test cases: class SomeSuite < Test::Unit::TestCase def test_runThisCase() #... end def test_dontRunThis() #... end def test_orThis() #... end end Running SomeSuite is trivial. Now how to augment that so if a caller has supplied one case name (perhaps via command line arguments and ARGV[]), and then only run that one case? Suppose I only want to run test_runThisCase. If I had invented Ruby/Unit, we could run it like this: got = runner.run(aTestSuite, 'test_readMyPost') Unfortunately, the test.rb files (like many Ruby library files) are write-only, and I generally can't read them well enough to understand how to apply that syntax. Is such a feature available through these objects? Alternately, could I loop thru aTestSuite's cases, find it, and run it? (I'm not asking how to run test suites, or how to parse command line arguments here!) -- Phlip http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!