Run tests by line number in Test::Unit, and more!
Presented at WNYRuby on April 11th, 2012.
ma bettertest-unitrunner@qrush
View Slide
i’m @qrush
@i live here
ci work at 37signals
stands formetalm
runs tests byline numberm
$ cat -n test/example_test.rb1 require 'test/unit'23 class ExampleTest < Test::Unit::TestCase4 def test_apple5 assert_equal 1, 16 end78 def test_banana9 assert_equal 1, 110 end11 endyou wrote:
$ m test/example_test.rb:4Run options: -n /test_apple/# Running tests:.Finished tests in 0.000525s,1904.7619 tests/s, 1904.7619 assertions/s.1 tests, 1 assertions, 0 failures, 0 errors,0 skipsrun one test:
$ m test/example_test.rb:2No tests found on line 2. Valid tests to run:test_apple: m test/examples/test_unit_example_test.rb:4test_banana: m test/examples/test_unit_example_test.rb:8wrong line:
$ m test/example_test.rbRun options:# Running tests:..Finished tests in 0.001293s, 1546.7904 tests/s,3093.5808 assertions/s.1 tests, 2 assertions, 0 failures, 0 errors, 0 skipsrun it all:
somefactsm
works with test-unit,rails, mini-test1.uses rocco for literatedocumentation2.four months of daily use3.
how does itworkm
programming is not magic
figure out where testmethods are1.match what line you chosewith tests we know about2.run that test!3.
__/\\\\____________/\\\\__\/\\\\\\________/\\\\\\__\/\\\//\\\____/\\\//\\\__\/\\\\///\\\/\\\/_\/\\\__\/\\\__\///\\\/___\/\\\__\/\\\____\///_____\/\\\__\/\\\_____________\/\\\__\/\\\_____________\/\\\__\///______________\///__gem install mhttp://quaran.to/mhttps://github.com/qrush/m