"Nathaniel Talbott" <nathaniel / talbott.ws> writes: > Here's an idea (if I can make it work): what if the implementation of > #set_up (or whatever it's called) in TestCase takes in a block like > you're proposing? Those who want to do things the new, cool way can use > it as proposed above, and those who would rather stick with the old > xUnit nomenclature (or are porting older code) can still use old > faithful. Yes! I like that. No, on to the overall setup issue. One of my big gripes with JUnit is that fact it's such a pita to to per-suite initialization. If I want a database connection for all my tests, I either have to write a singleton (with the attendant leak) or dig out a template to work out how to do the stupid decorator trick. All I really was to say is "before running any of the tests oin this class, do X, and after finishing the last, do Y". As such, I think the overall setup and overall teardown are really just attributes of the test case, and so logically belong in there with the tests. It also seems to make good sense from a packaging point of view: require 'test/unit' class MyTests < Test::Case before_all_tests do @conn = DB.get_connection end before_each_test do @conn.reset end after_each_test do @conn.rollback end def test_one stmt = @conn.prepare(...) ... end def test_two stmt = @conn.select(...) ... end after_all_tests do @conn.close end end For me, that's all I'd want to specify for a set of tests. It seems easy to remember, and there's no extra crud to insert. The above file would be literally all you type to get some tests up and running. However, I'm sure I'm missing a heap of implementation problems. Cheers Dave