From: Warren Brown Date: 2003-01-29T01:21:15+09:00 Subject: Re: Test::Unit -> order of tests? > > There might be an issue with doing this, though - after > > a little IRB'ing here, it appears that including a module > > will not trigger #method_added for each method of the > > module. But perhaps there's a way around that, too :-) > > Ooh, yeah, yuck. The included module won't have a list of > methods in declaration order anyway. You'd have to a > method_added hook on Object or Module and track all classes > just in case they are included in a TestCase -- not pretty. I'll mention right off the bat that I'm a Ruby newbie, but based on an example I saw in the Pickaxe book, it seems like you could simply put a hook in Module that would attach an (autoincremented) 'testcasenumber' attribute to any method whose name =~ /^test_/ when that method is defined. Then collect all of the test cases when you are ready to run them (like you currently do), but sort on the 'testcasenumber' attribute before running them. Any methods not involved in testing would (theoretically) not be hindered by the additional attribute. - Warren Brown