Upgrade to Pro — share decks privately, control downloads, hide ads and more …

m: a better Ruby Test::Unit runner

m: a better Ruby Test::Unit runner

Run tests by line number in Test::Unit, and more!

Presented at WNYRuby on April 11th, 2012.

Nick Quaranto

April 11, 2012
Tweet

More Decks by Nick Quaranto

Other Decks in Programming

Transcript

  1. $ cat -n test/example_test.rb 1 require 'test/unit' 2 3 class

    ExampleTest < Test::Unit::TestCase 4 def test_apple 5 assert_equal 1, 1 6 end 7 8 def test_banana 9 assert_equal 1, 1 10 end 11 end you wrote:
  2. $ m test/example_test.rb:4 Run 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 skips run one test:
  3. $ m test/example_test.rb:2 No tests found on line 2. Valid

    tests to run: test_apple: m test/examples/test_unit_example_test.rb:4 test_banana: m test/examples/test_unit_example_test.rb:8 wrong line:
  4. $ m test/example_test.rb Run 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 skips run it all:
  5. works with test-unit, rails, mini-test 1. uses rocco for literate

    documentation 2. four months of daily use 3.
  6. figure out where test methods are 1. match what line

    you chose with tests we know about 2. run that test! 3.