From: Alin Popa Date: 2007-10-03T00:56:03+09:00 Subject: Re: Unit testing add extra command line parameters 7stud -- wrote: > Alin Popa wrote: >> class TestSomeClass < Test::Unit::TestCase >> def setup >> # some setup >> end >> def test_01_firstTest >> # some assertion >> end >> def test_02_secondTest >> # some other assertion >> end >> end >> >> But I want to display (yes, just to display) my available tests from a >> testcase. >> Is this possible ? >> > > Is this what you are after: > > > require "test/unit" > > class TestSomeClass < Test::Unit::TestCase > def setup > # some setup > end > def test_01_firstTest > # some assertion > end > def test_02_secondTest > # some other assertion > end > end > > method_names = TestSomeClass.public_instance_methods > test_methods = method_names.find_all do |method_name| > method_name.index("test") == 0 > end > > > puts test_methods > > --output:-- > test_01_firstTest > test_02_secondTest > Loaded suite r3test > Started > .. > Finished in 0.00037 seconds. > > 2 tests, 0 assertions, 0 failures, 0 errors Hi, Thanks for your reply. The problem wasn't really how to display methods. "If not, how there is possible to add extra parameters to command line in order to display all tests ?" I want to add extra command line arguments to my script, but in an elegant way. Arguments like -n, -t, -v, etc. that already exists in TestCase. Thanks. Alin -- Posted via http://www.ruby-forum.com/.