Here is some code that runs tests in source code order. I pretty certain Bret
posted how to do this ( by overriding the suite method) but he didnt provide
any code.
This only works if there is one class that does tests in the file, but Im sure
someone can figure out how to fix that
#
# Example of how to override the suite method of Testcase to run tests in
source order
#
# Only works if there is one class that runs tests
require 'test/unit'
module Test
module Unit
class TestCase
def self.suite
lines = IO.readlines(__FILE__)
tests = lines.grep(/^ *(def test)/){ |line| line.strip.gsub('def '
, '') }
suite = TestSuite.new(name)
tests.each do |this_test|
puts "Adding test " + this_test
catch(:invalid_test) do
suite << new(this_test)
end
end
if (suite.empty?)
catch(:invalid_test) do
suite << new(:default_test)
end
end
return suite
end
end
end
end
class Tester <Test::Unit::TestCase
def test_020
puts "020"
end
def test_030
puts "030"
end
def test_100
puts "100"
end
def test_010
puts "010"
end
end
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general