On May 14, 2006, at 12:27 AM, Sy Ali wrote:

> No, not teardown.. I want to have some code executed after all testing
> has concluded.
>
> You'd think it'd be a matter of running it all at the end of the .rb
> file, but this is not true.. everything is run and _then_ the test
> cases are run.
>
> I suppose I could wrap the entire test in another ruby file.. it just
> seems strange to need to do this.

You can setup your test runner manually:

require 'test/unit'
require 'test/unit/ui/console/testrunner'

class TestBlah < Test::Unit::TestCase
   def test_asdf
   end
end

puts "start"
Test::Unit::UI::Console::TestRunner.run(TestBlah)
puts "finish"

You could do the same with a suite. See the [Test::Unit docs][1] on  
how to create a test suite manually.

If you are using the rake test task, then you could something like (I  
didn't test this out):

class MyTestTask < Rake::TestTask
   def define
     super()
     # ... code you need here
   end
end

Why exactly do you need this code to be run at the end of your test?

[1]: http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/

-- Daniel