Pro Yearly is on sale from $80 to $50! »

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.

Eb8975af8e49e19e3dd6b6b84a542e26?s=128

Nick Quaranto

April 11, 2012
Tweet

Transcript

  1. m a better test-unit runner @qrush

  2. i’m @qrush

  3. @ i live here

  4. c i work at 37signals

  5. stands for metal m

  6. None
  7. runs tests by line number m

  8. $ 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:
  9. $ 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:
  10. $ 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:
  11. $ 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:
  12. some facts m

  13. works with test-unit, rails, mini-test 1. uses rocco for literate

    documentation 2. four months of daily use 3.
  14. how does it work m

  15. programming is not magic

  16. figure out where test methods are 1. match what line

    you chose with tests we know about 2. run that test! 3.
  17. __/\\\\____________/\\\\_ _\/\\\\\\________/\\\\\\_ _\/\\\//\\\____/\\\//\\\_ _\/\\\\///\\\/\\\/_\/\\\_ _\/\\\__\///\\\/___\/\\\_ _\/\\\____\///_____\/\\\_ _\/\\\_____________\/\\\_ _\/\\\_____________\/\\\_ _\///______________\///__ gem

    install m http://quaran.to/m https://github.com/qrush/m