From: jonathan gold Date: 2006-02-14T07:31:46+09:00 Subject: more restrictive options for test/unit/autorunner.rb ? is there a way, or interest in creating a way, to add switches to autorunner to match only tests with a certain name *and* in a certain test case? i've got a bunch of classes that extend Test::Unit::TestCase (so far, so good), and some of which extend each other, which is good, because i can reuse a lot of common assertion, setup, and teardown logic, and do it in a consistent way across tests. further, one of the things i want to test is that a SubFoo passes all tests of a regular Foo, as well as those specific to a SubFoo, and so it makes sense to have SubFooTestCase < FooTestCase. the issue is that autorunner.rb (which is invoked when running tests from the command line, for instance), allows one to run all tests matching a given method name (ie, --name test_foo_bar), or to run all tests in a given test case (ie, --testcase FooTestCase or --testcase SubFooTestCase), but not to run all tests matching some pattern AND in a given subclass of TestCase. this means that if i want to run test_foo_bar in SubFooTestCase, i'm also obligated to run it in FooTestCase (if i use --name), or to run all tests in SubFooTestCase (if i use --testcase). for nightly builds or continuous builds, this is fine, but it's disruptive when i'm in a development loop edit/test/edit/test/.... i can't see a way to do this currently, but i poked around autorunner.sh and added a --fqname option which behaves just like the regular --name option, but matches against the fully-qualified classname as well. that is, i'll specify ... --fqname SomePackage::SubFooTestCase#test_foo_bar are the owners of the unit test stuff opposed to adding (or letting me add) this option to autorunner.rb? i basically just cloned the current logic for --name, but had the regex/string match proceed against the string ( t.class_to_s + '#' + t.method_name ) instead. another option might be to add a switch that says something like '--match-style=AND', so that i can say --testcase and --name and have the filter logic apply an AND, whereas it currently is an OR (and that could be the default for 'match-style'). jon