Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Short answer:</p> <pre><code>gem install minitest # Install MiniTest gem install minitest_tu_shim # Install Test::Unit shim use_minitest yes # Use MiniTest Test::Unit shim instead of stdlib Test::Unit ruby your_test.rb -v # Run your test in verbose mode </code></pre> <p>Ruby 1.9 use <a href="http://blog.zenspider.com/minitest/" rel="noreferrer"><code>MiniTest</code></a> as its default testing framework instead of <a href="http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html" rel="noreferrer"><code>Test::Unit</code></a>. MiniTest is smaller, faster, has more useful features, and is largely backward compatible with Test::Unit. One of those newer features is measuring the time each test takes with the <code>-v</code> flag. When you run the e sure you place this flag after the script </p> <p>If, as in rails, you use <a href="http://rake.rubyforge.org/classes/Rake/TestTask.html" rel="noreferrer"><code>Rake::TestTask</code></a> to run your tests, you'll can either specify it at runtime by running</p> <pre><code>rake test TESTOPTS='-v' </code></pre> <p>or specify it in the task by adding <code>-v</code> to the <code>options</code> attribute, like so</p> <pre><code>Rake::TestTask.new do |t| t.options = '-v' end </code></pre> <p>Finally, if you're using rails and MiniTest just isn't good enough for you, you might appreciate the <a href="http://github.com/timocratic/test_benchmark" rel="noreferrer"><code>test_benchmark</code></a> plugin. Usage is easy. Add the following line to your <code>config/environments/test.rb</code></p> <pre><code>config.gem "timocratic-test_benchmark", :lib =&gt; 'test_benchmark', :source =&gt; 'http://gems.github.com' </code></pre> <p>Install it with</p> <pre><code>RAILS_ENV='test' rake gems:install </code></pre> <p>From then on, you'll get a nice sorted list when you run your tests</p> <pre><code>rake test:units [...] Test Benchmark Times: Suite Totals: 7.124 test_destroy(FeedTest) 7.219 test_create(FeedTest) 7.646 test_subscribe_to_auto_discovery(FeedTest) 9.339 test_auto_discover_updates_url(FeedTest) 9.543 test_find_or_create_by_auto_discover_url(FeedTest) 15.780 test_import_from_opml(FeedTest) </code></pre> <p>I'm sorry to say that <code>MiniTest</code> and the <code>test_benchmark</code> plugin are incompatible with each other, but I strongly encourage you to try <code>MiniTest</code>, since it'll make your tests faster, and will continue to be supported in Ruby 1.9.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload