From: Bret Pettichord Date: 2006-05-23T06:47:44+09:00 Subject: Re: Test::Unit Patch that allows test methods to be executed sequentially ------=_Part_46120_8525417.1148334461735 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 5/22/06, Eric Hodel wrote: > > http://wiki.openqa.org/display/WTR/Test-Unit+Patch > > I don't see a patch there. Click "Download Patch." Or click the attachments tab. I also just added a link at the bottom of the page. I have been updating the code on this page based on comments that i get. Here's the current version of the code: require 'test/unit' module Test module Unit class TestCase @@order =3D :alphabetically class << self attr_accessor :test_methods, :order def test_methods @test_methods ||=3D [] end def order @order || @@order end def default_order=3D order @@order =3D order end def sorted_test_methods case order when :alphabetically: test_methods.sort when :sequentially: test_methods when :reversed_sequentially: test_methods.reverse when :reversed_alphabetically: test_methods.sort.reverse else raise ArgumentError, "Execute option not supported: #{@order}" end end def suite suite =3D TestSuite.new(name) sorted_test_methods.each do |test| catch :invalid_test do suite << new(test) end end if (suite.empty?) catch :invalid_test do suite << new(:default_test) end end return suite end def method_added id name =3D id.id2name test_methods << name if name =3D~ /^test./ end def execute order @order =3D order end end end end end ------=_Part_46120_8525417.1148334461735--