This is a short post about using turn gem with MiniTest::Spec and Rails 3.1 for better output.
Add to your Gemfile:
Assuming you have this in your test file:
Now, you can run your tests and enjoy chosen output format:
This post is based on some other sources. Please take a look at them to find more:
Add to your Gemfile:
group :test do
  gem 'turn'
end
$ bundle install
Assuming you have this in your test file:
require "minitest_helper"
Turn.config do |c|
 # use one of output formats:
 # :outline  - turn's original case/test outline mode [default]
 # :progress - indicates progress with progress bar
 # :dotted   - test/unit's traditional dot-progress mode
 # :pretty   - new pretty reporter
 # :marshal  - dump output as YAML (normal run mode only)
 # :cue      - interactive testing
 c.format  = :outline
 # turn on invoke/execute tracing, enable full backtrace
 c.trace   = true
 # use humanized test names (works only with :outline format)
 c.natural = true
endNow, you can run your tests and enjoy chosen output format:
$ rake testThis post is based on some other sources. Please take a look at them to find more:
Nice! Can I help out with reporter functionality?
ReplyDeleteSure, you can. Whatever you mean;)
ReplyDeleteHi , first thanks for your clear post..
ReplyDeleteI tried to follow all you steps , it's running , BUT I got a very strange behavior :
in my minitest_helper.rb , if I write c.trace = true , I don't get the trace ...
if I write c.trace = false , I get the trace ...
Gemfile
group :test do
gem 'minitest'
gem 'turn'
Rails (3.2.3) w Ruby 1.9.3-p125
minitest (2.12.1)
turn (0.9.5)
Thanks, useful post, but contains a bug, which is the cause of kadoudal's observation.
ReplyDelete"c.trace = true" causes the error `limit_backtrace': undefined method `to_i' for true:TrueClass (NoMethodError).
It's possible that variable was previously boolean, but this should now be an integer declaring number of backtrace lines to show, e.g.:
c.trace = 20