Coder Social home page Coder Social logo

turn's Introduction

TURN - MiniTest Reporters Build status

by Tim Pease & Trans
http://rubygems.org/gems/turn

TURN is no longer being maintained!

Ruby's built-in test framework has changed so frequently (and rather poorly) over the last few years that it has been a relative nightmare to try keep Turn working. From the deprecation of Test::Unit and the switch to MiniTest and thru all the many API changes made to MiniTest itself (we're at major version 5 now!), it is simply not conducive to a coder's productivity to have to rewrite a program every year while explaining to gracious bug reporters that it's broken because the underlying API has changed yet again.

The most recent major change finally added something of a real reporter API. That's a good thing! Although it should have been there from day one. Yet the new version also removed the runner API. That means Turn would have revert back to old subclassing and monkey patching tricks in order support certain features such as the solo and cross runners.

As any programmer can well understand, I have no interest in playing these musical chairs any longer. I have endeavored to provide preliminary support for Minitest v5+, which is now in the master branch. For the most part, the reporter part, it is working. But there are plenty of loose ends that have to be tied up if everything is to work as it should.

If someone else would like to take up the mantle of this project please have at it. I'm available to answer any questions. Until then, consider this entire project deprecated.

Sincerely,
  trans

DESCRIPTION

TURN is a new way to view test results. With longer running tests, it can be very frustrating to see a failure (....F...) and then have to wait till all the tests finish before you can see what the exact failure was. TURN displays each test on a separate line with failures being displayed immediately instead of at the end of the tests.

If you have the 'ansi' gem installed, then TURN output will be displayed in wonderful technicolor (but only if your terminal supports ANSI color codes). Well, the only colors are green and red, but that is still color.

FEATURES

General usage provides better test output. Here is some sample output:

TestMyClass
    test_alt                                                            PASS
    test_alt_eq                                                         PASS
    test_bad                                                            FAIL
        ./test/test_my_class.rb:64:in `test_bad'
        <false> is not true.
    test_foo                                                            PASS
    test_foo_eq                                                         PASS
TestYourClass
    test_method_a                                                       PASS
    test_method_b                                                       PASS
    test_method_c                                                       PASS
============================================================================
  pass: 7,  fail: 1,  error: 0
  total: 15 tests with 42 assertions in 0.018 seconds
============================================================================

Turn also provides solo and cross test modes when run from the turn commandline application.

INSTRUCTION

Turn can be used from the command-line or via require. The command-line tool offers additional options for how one runs tests.

Command Line

You can use the turn executable in place of the ruby interpreter.

$ turn -Ilib test/test_all.rb

This will invoke the ruby interpreter and automatically require the turn formatting library. All command line arguments are passed "as is" to the ruby interpreter.

To use the solo runner.

$ turn --solo -Ilib test/

This will run all tests in the test/ directory in a separate process. Likewise for the cross runner.

$ turn --cross -Ilib test/

This will run every pairing of tests in a separate process.

Via Require

Simply require the TURN package from within your test suite.

$ require 'turn/autorun'

This will configure MiniTest to use TURN formatting for displaying test results. A better line to use, though, is the following:

begin; require 'turn/autorun'; rescue LoadError; end

When you distribute your code, the test suite can be run without requiring the end user to install the TURN package.

For a Rails application, put the require line into the 'test/test_helper.rb' script. Now your Rails tests will use TURN formatting.

Note: This changed in version 0.9. It used to be just require 'turn', but because of how bundle exec works, it was better to require a subdirectory file.

Configuration

You can use Turn.config to adjust turn configuration.

Options are following:

tests           List of file names or glob patterns of tests to run. Default: ["test/**/{test,}*{,test}.rb"]
exclude         List of file names or globs to exclude from tests list. Default: []
pattern         Regexp pattern that all test names must match to be eligible to run. Default: /.*/ (all)
matchcase       Regexp pattern that all test cases must match to be eligible to run. Default: nil (all)
loadpath        Add these folders to the $LOAD_PATH. Default: ['lib']
requires        Libs to require when running tests. Default: []
format          Reporter type (:pretty, :dot, :cue, :marshal, :outline, :progress). Default: :pretty
live            Test against live install (i.e. Don't use loadpath option). Default: false
verbose         Verbose output? Default: false
trace           Number of backtrace lines to display. Default: set from ENV or nil (all)
natural         Use natural language case names.  Default: false
ansi            Force colorized output (requires 'ansi' gem). Default: set from ENV or nil (auto)

To set option just call the desired method:

Turn.config.format = :progress

Also, you can use following environment variables to adjust settings:

backtrace       Number of backtrace lines to display. Default: set from ENV or nil
ansi            Force colorize output (requires 'ansi' gem).

Finally, you can include your own custom Reporter type (aka format). Turn will search for reporters in the .turn/reporters/ directory of your local project and then in your user home directory. So for example, if you specified the following:

Turn.config.format = :cool

Then Turn will look first for ./.turn/reporters/cool_reporter.rb, then ~/.turn/reporters/cool_reporter.rb.

See source code for examples of how to write your own reporters.

REQUIREMENTS

  • ansi 1.1+ (for colorized output and progress bar output mode)

INSTALLATION

Follow the usual procedure:

$ gem install turn

TODO

  • Support MiniTest v5.0
  • General code cleanup

CONTRIBUTING

  1. Fork it
  2. Create your feature branch (git checkout -b my_new_feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my_new_feature)
  5. Create a new Pull Request

If you are a project member please follow the same process (minus the forking). For significant changes please wait for another developer to review and merge them, whereas small contributions/fixes can be merged without review.

Building

To build the gem simply run:

gem build .gemspec

Solo and Cross Runners

An important aspect of Turn's design that needs be kept in mind, is the way solo and cross testing features are implemented. This is some really neat code actually (IMO), but it might be difficult to grasp with out some explanation. What turn does when using the --solo or --cross options, is shell out to itself using the YAML reporter. It does this repeatedly for each test, or each pair of tests, respectively, and then collates all the resulting YAML reports into a single report, which it then feeds back into the selected reporter.

LICENSE

MIT License

Copyright (c) 2006 Tim Pease Copyright (c) 2009 Thomas Sawyer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

turn's People

Contributors

5long avatar adamtao avatar calebphillips avatar cameel avatar carols10cents avatar citizen428 avatar cylence avatar daniely avatar defunkt avatar dhh avatar djanowski avatar dontangg avatar dubek avatar jana4u avatar japgolly avatar juniorz avatar lukaszx0 avatar metropolis-testman avatar no0p avatar os97673 avatar rtomayko avatar salimane avatar sethers avatar sweed avatar tpope avatar trans avatar twp avatar yalab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

turn's Issues

turn steps on mocha's teardown

Here's a case to reproduce (sorry, no Gemfile, but the versions of gems/etc (current) are all present):

And here's the issue upstream with mocha:

tl;dr Something when turn is required prevents mocha's teardown running, so wide-reaching stubs, expectations and mocks aren't cleaned up. Not normally a problem when using instance-level stubs/expectations; but with any_instance for example, it makes problems.

Under disperate load order conditions (that is :test_unit, :turn, :mocha vs. :test_unit, :mocha, :turn) - the former passes all tests, but the word PASS is absent.

There's a lot more discussion and examples at the mocha issue, the issue remains open in case that a cooperative fix requires some modification to mocha.

Apologies that the test-case isn't quite the simplest it could be, hopefully it's simple enough to follow.

Better output for MiniTest::Spec failed assertions

Because of the nature of how spec assertions are defined in MiniTest (infect_an_assertion), the output for a failed assertion looks like this:

  OutputSpec:
     FAIL test_0001_output (0.00s) 
          Expected 1, not 2.
          (eval):4:in `must_equal'

Without turn, the output looks like this:

    1) Failure:
  test_0001_output(OutputSpec) [turn.rb:6]:
  Expected 1, not 2.

The line number of the failure would be nice to have in the turn output.

(I'm using mintiest 2.5.1 and turn 0.8.2.)

Incompatibility with minitest & mocha when using :skip

When referencing the method :skip using the latest versions of minitest, turn, and mocha an ArgumentError is thrown (from inside mocha, but does not occur when turn is disabled). Here are the gems used

gem 'rails', '3.0.10'
gem 'mocha', '0.10.0'
gem 'turn', '0.8.3'
gem 'minitest', "2.6.2"

Here is the error that is produced:

        wrong number of arguments (0 for 1)
        STDERR:
        Exception `ArgumentError' at /Users/dave/.rvm/gems/ruby-1.9.2-p290@laika/gems/mocha-0.10.0/lib/mocha/integration/mini_test/version_230_to_251.rb:36:in `rescue in run'
        /Users/dave/.rvm/gems/ruby-1.9.2-p290@laika/gems/mocha-0.10.0/lib/mocha/integration/mini_test/version_230_to_251.rb:47:in `run'
        /Users/dave/.rvm/gems/ruby-1.9.2-p290@laika/gems/activesupport-3.0.10/lib/active_support/testing/setup_and_teardown.rb:35:in `block in run'
        /Users/dave/.rvm/gems/ruby-1.9.2-p290@laika/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:444:in `_run_setup_callbacks'
        /Users/dave/.rvm/gems/ruby-1.9.2-p290@laika/gems/activesupport-3.0.10/lib/active_support/testing/setup_and_teardown.rb:34:in `run'

When turn is removed from the bundle, the behavior reverts to the normal "S" being output along with the the skip error message.

Incompatibility with recent MiniTest

Hey guys,

Recently a MiniTest user reported a failure using MiniTest::Spec with turn. Here's a minimal testcase to demonstrate the problem:

gem 'minitest'
require 'minitest/autorun'
require 'turn'

describe String do
  before do
    @string = String.new
  end

  it 'is empty' do
    @string.must_be :empty?
  end
end

Running that results in this output:

pete@balloon /tmp $ ruby minitest_and_turn.rb 
Loaded suite minitest_and_turn
Started

String:
    ERROR test_0001_is_empty (0.00s) 
          NoMethodError: undefined method `empty?' for nil:NilClass
          (eval):6:in `must_be'


Finished in 0.001434 seconds.

1 tests, 0 assertions, 0 failures, 1 errors, 0 skips

The good news is that the unreleased git master version of turn works with the most recent MiniTest. Is there an ETA on a new release?

Integrate autorunners with main runners

The (command line) runners are mature enough now that the autorunners can be re-written to use them.

It will take some doing, but the pay off is there will no longer be two sets of runners to maintain.

putting turn in Gemfile causes spurious test run summary

If I put gem 'turn' in my Gemfile and then run a task e.g. rake routes, then I see this at the bottom of the list of routes:

LOADED SUITE test,test/functional,test/unit,test/unit/helpers,test/performance
MiniTest::Spec
==============================================================================
  pass: 0,  fail: 0,  error: 0
  total: 0 tests with 0 assertions in 0.001157612 seconds
==============================================================================

The workaround is instead to use

gem 'turn', :require => false

If this behaviour is intentional, it should be documented; otherwise it should be fixed.

turn summary shows after all rake tasks

If I require turn in the Gemfile

group :development, :test do
  gem 'turn'
end

And then a random non-test related rake task

vagrant@vagrantup:~/conduit$ rake -n tmp:clear
(in /data/web/conduit/current)
** Invoke tmp:clear (first_time)
** Invoke tmp:sessions:clear (first_time)
** Execute (dry run) tmp:sessions:clear
** Invoke tmp:cache:clear (first_time)
** Execute (dry run) tmp:cache:clear
** Invoke tmp:sockets:clear (first_time)
** Execute (dry run) tmp:sockets:clear
** Execute (dry run) tmp:clear

=========================================================================
  pass: 0,  fail: 0,  error: 0
  total: 0 tests with 0 assertions in 0.000239 seconds
=========================================================================

Result format inconsistent when running on ruby 1.8.7 vs 1.9.2

Both installs of ruby have turn 0.8.2 installed.

When running on 1.9.2 the PASS/FAIL is to the left of the test function, with the individual time to execute to the right of the function. Only the first line of the backtrace is available in this version.

When running on 1.8.7 the PASS/FAIL are right aligned, and there is no individual test execution time. The full backtrace is available in this version.

Ideally I would love to have:

  • all the output from 1.9.2 on both versions, with a full backtrace.

Is it a default that has change that can be toggled by setting a config option or variable? I am not using the turn command line tool so it can't be a command line parameter.

error running turn with ruby 1.9.2

I get the following error when trying to run turn on a rails test suite with factory girl, on ruby 1.9.2, OSX, using the new turn 0.8.0 gem:

$ turn --solo -Ilib test/
LOADED SUITE
test/factories/activities.rb
/Users/francis/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/syck.rb:135:in load': instance of IO needed (TypeError) from /Users/francis/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/syck.rb:135:inload'
from /Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/turn-0.8.0/lib/turn/runners/isorunner.rb:90:in block in test_loop_runner' from /Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/turn-0.8.0/lib/turn/components/suite.rb:72:ineach'
from /Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/turn-0.8.0/lib/turn/components/suite.rb:72:in each' from /Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/turn-0.8.0/lib/turn/runners/isorunner.rb:56:ineach_with_index'
from /Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/turn-0.8.0/lib/turn/runners/isorunner.rb:56:in test_loop_runner' from /Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/turn-0.8.0/lib/turn/runners/isorunner.rb:43:instart'
from /Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/turn-0.8.0/lib/turn/controller.rb:139:in start' from /Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/turn-0.8.0/lib/turn/command.rb:199:inmain'
from /Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/turn-0.8.0/lib/turn/command.rb:37:in main' from /Users/francis/.rvm/gems/ruby-1.9.2-preview3/gems/turn-0.8.0/bin/turn:3:in<top (required)>'
from /Users/francis/.rvm/gems/ruby-1.9.2-preview3/bin/turn:19:in load' from /Users/francis/.rvm/gems/ruby-1.9.2-preview3/bin/turn:19:in

'

Breaks `-n test_method_name` feature from Ruby

require 'turn' breaks the feature in Ruby where you can do ruby -Itest ./my_test.rb -n test_just_this_one_thing.

Under the defaults, this would run only the method named test_just_this_one_thing, with turn loaded, however it runs all tests, all the time.

The ruby docuemntation for this feature is misleading, or I'm misunderstanding it:

ruby --help
... snip ...
  -n              assume 'while gets(); ... end' loop around your script
... snip ...

A note further to this is that when using bundler, turn appears to be badly behaved:

gem 'turn', :require => false

should make bundler skip loading this, but it doesn't - turn still loads, even if I do not explicitly require it anywhere. (it's possible, something in Rails is auto-loading it, but I really hope not.

ASCI Colours don't display properly in cmd

We use cmd.exe for most of our coding as we do not like to require the use of cygwin or supplementary prompts.

The output is very hard to read:
←[33m ERROR←[0m testPasswordChange (1.59s)

I am also filing a bug report with the ANSI gem, as the fail to detect win32 on my machine as the RUBY_PLATFORM=i386mingw32 and it looks for win32.

Can a flag of some sort be added to support the disabling of colours?

I tried removing ansi because the turn documentation is written such that it should use it if found, and otherwise not. This is the error I get without the ansi gem installed:
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in to_specs': Could not find ansi (>= 1.2.2) amongst [builder-3.0.0, commonwatir-1.8.1, firewatir-1.8.1, hoe-2.9.4, minitest-1.6.0, nokogiri-1.4.4.1-x86-mingw32, rake-0.8.7, rd oc-2.5.8, rubygems-update-1.8.5, s4t-utils-1.0.4, turn-0.8.1, user-choices-1.1.6.1, watir-1.8.1, win32-api-1.4.8-x86-mingw32, win32-process-0.6.5, win32console-1.3.0-x86-mingw32, windows-api-0.4.0, windows-pr-1.2.0, xml-simple-1.0.16] (Gem::LoadError) from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:759:i nblock in activate_dependencies'

Thanks!

Weird results/output with Mocha & Shoulda

Gems

group :test do
  # http://stackoverflow.com/questions/3118866/mocha-mock-carries-to-another-test/4375296#4375296
  gem 'mocha', :require => false # required in test_helper.rb at the bottom
  gem 'shoulda'
end

Test case

class EventTest < ActiveSupport::TestCase
  test "a sample mock" do
    mocky = mock(:name => "Steve")
  end

  test "assert the truth" do
    assert true
  end
end

Expected output (before using turn):

F.
Finished in 0.187605 seconds.

  1) Failure:
test_a_sample_mock(EventTest) [test/unit/event_test.rb:20]:
not all expectations were satisfied
unsatisfied expectations:
- expected exactly once, not yet invoked: #<Mock:0x100ee12a8>.name(any_parameters)


2 tests, 2 assertions, 1 failures, 0 errors, 0 skips

After adding turn:

EventTest:
     PASS test_a_sample_mock (0.18s) 
     PASS test_assert_the_truth (0.01s) 

Finished in 0.193767 seconds.

2 tests, 1 assertions, 0 failures, 0 errors, 0 skips

Heh. Where did my failure go? Requiring turn before shoulda brings it back but breaks the output:

EventTest:
     FAIL test_a_sample_mock (0.18s) 
          not all expectations were satisfied
unsatisfied expectations:
- expected exactly once, not yet invoked: #<Mock:0x103382aa8>.name(any_parameters)
          test/unit/event_test.rb:20:in `block in <class:EventTest>'

 test_assert_the_truth (0.01s) 

Finished in 0.191906 seconds.

2 tests, 2 assertions, 1 failures, 0 errors, 0 skips

test_the_truth for example has no PASS status. Only when I remove mocha (and the mock test) completely does it return. Just adding gem 'mocha', :require => false was enough to make it disappear, without requiring it anywhere else.

Any ideas?

Leading "-" in ARGV

Possible gotcha when Turn uses "ruby -Ilib bin/turn -" both in the tests and in the isolated test runners. I just discovered that the "-" doesn't get removed but is passed along as the first argument to the command --at least that's what is happening to me on another project, so I assume it will be happening to turn too. If it is, turn seems to me handling it gracefully at this point, but just in case it might be a good idea to shift off any leading "-" in ARGV right off the bat.

line number of offending test not output

        Failed assertion, no message given.
        Assertion at /home/stefan/.rvm/gems/ruby-1.9.3-rc1@sharewise/gems/activesupport-3.1.1/lib/active_support/testing/setup_and_teardown.rb:35:in`block in run'

vs. without turn


  1) Failure:
test_find_matching(PromotionTest) [test/unit/promotion_test.rb:22]:
Failed assertion, no message given.

with turn enabled i have no idea which line in the tests caused the issue
without turn I see its line 22 in my test

ANSI gem

Hi Tim. I've recently spun off facets/ansicode.rb as a stand-alone project --with some cool additional ANSI-related classes (gem install ansi). So I just pushed the changes needed to swap out Turn's color support for the 'ansi' project. Please give it a whirl and if everything checks out, go ahead and release it at your discretion.

turn barfs on rbx *.rbc files

rubies/ruby-1.8.7-p330/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require': no such file to load -- /Users/test/code/beefcake/test/buffer_decode_test.rbc (LoadError)
  from rubies/ruby-1.8.7-p330/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
  from gems/ruby-1.8.7-p330/gems/turn-0.8.1/lib/turn/runners/testrunner.rb:28:in `initialize'
  from gems/ruby-1.8.7-p330/gems/turn-0.8.1/lib/turn/runners/testrunner.rb:28:in `each'
  from gems/ruby-1.8.7-p330/gems/turn-0.8.1/lib/turn/runners/testrunner.rb:28:in `initialize'
  from gems/ruby-1.8.7-p330/gems/turn-0.8.1/lib/turn/controller.rb:137:in `new'
  from gems/ruby-1.8.7-p330/gems/turn-0.8.1/lib/turn/controller.rb:137:in `start'
  from gems/ruby-1.8.7-p330/gems/turn-0.8.1/lib/turn/command.rb:199:in `main'
  from gems/ruby-1.8.7-p330/gems/turn-0.8.1/lib/turn/command.rb:37:in `main'
  from gems/ruby-1.8.7-p330/gems/turn-0.8.1/bin/turn:3
  from gems/ruby-1.8.7-p330/bin/turn:19:in `load'
  from gems/ruby-1.8.7-p330/bin/turn:19

Skip Counts

test/unit (the gem) now supports a number of new count types, like skip and omit. The turn runner needs to track those too. Need to further consider how mintest and test/unit will coexist with regards to this.

[turn 0.8.1] Wrong assertion count

When fed the following test file:

class FooTest < MiniTest::Unit::TestCase
  def test_t1
    assert true
  end
end

class BarTest < MiniTest::Unit::TestCase
  def test_t2
    assert true
    assert true
  end
end

turn outputs:

2 tests, 5 assertions, 0 failures, 0 errors

I guess turn should reset some local counter, but it does not. On running the above, turn counts 2 assertions in test_t2, then it counts 3 (2+1) instead of 1 in test_t1, adding up to 5.

turn 0.8.3 doesn't display time of individual tests

One of the features I like about 0.8.2 is it displays the time of each individual test making it easy to locate long running tests and fix them. I definitely prefer that turn 0.8.3 displays the test name before running the test, then follows it with pass/fail. I would just ask that immediately after the pass/fail is the test time. Thank you.

Display normalized method name

I added an option for displaying normalized method names. So instead of test_some_method_name the formatter will display some method name PASS.

Here's the commit: c3fab87052642c234a0e1aed94e37a1084cecf0e

0.8.3 Fails to display color with Rails 3.1.0 & auto test

I don't really know where to report this.

The short version is that under Rails 3.1.0, using mintiest for testing, and running 'bundle exec autotest' and:

with 0.8.2 - I get a nicely colored display
with 0.8.3 - I get a monochrome display which is doubled. By 'doubled' I mean that it runs the tests, displaying
the output and then redisplays the output. Always monochrome.

I traced it down to 'colorize?' and the test '$stdout.tty?' - which returns 'false'. [all the other tests return a true value]

Have no idea if this is a turn, Rails, rails test, mintiest or ZenTest problem.

Oh - BTW - I'm running on a MacBook 17, running OSX 10.7.2.

should recognize --testcase option

the standard test/unit runner has the option to run only specific testcases with the --testcase (or -t) PATTERN option, which is currently not recognized by turn:

$ turn -t /JsonApi/ functional/locations_controller_test.rb 
/usr/bin/turn: invalid option -- t
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/getoptlong.rb:403:in `set_error': invalid option -- t (GetoptLong::InvalidOption)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/getoptlong.rb:580:in `get_option'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/getoptlong.rb:611:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/getoptlong.rb:610:in `loop'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/getoptlong.rb:610:in `each'
from /Library/Ruby/Gems/1.8/gems/turn-0.7.0/lib/turn/command.rb:62
from /Library/Ruby/Gems/1.8/gems/turn-0.7.0/bin/turn:3:in `load'
from /Library/Ruby/Gems/1.8/gems/turn-0.7.0/bin/turn:3
from /usr/bin/turn:19:in `load'
from /usr/bin/turn:19

[patch] fix for ruby 1.9

diff --git a/lib/turn/controller.rb b/lib/turn/controller.rb
index cf35289..eb6a2d6 100644
--- a/lib/turn/controller.rb
+++ b/lib/turn/controller.rb
@@ -114,7 +114,7 @@ module Turn

     def files
       @files ||= (
-        fs = tests.map do |t|
+        fs = Array(tests).map do |t|
           File.directory?(t) ? Dir[File.join(t, '**', '*')] : Dir[t]
         end
         fs = fs.flatten.reject{ |f| File.directory?(f) }

fixes

ruby-1.9.2-p136/gems/turn-0.8.1/lib/turn/controller.rb:117:in `files': undefined method `map' for "test/**/{test,}*{,test}":String (NoMethodError)
  from ruby-1.9.2-p136/gems/turn-0.8.1/lib/turn/controller.rb:132:in `start'
  from ruby-1.9.2-p136/gems/turn-0.8.1/lib/turn/command.rb:199:in `main'
  from ruby-1.9.2-p136/gems/turn-0.8.1/lib/turn/command.rb:37:in `main'
  from ruby-1.9.2-p136/gems/turn-0.8.1/bin/turn:3:in `<top (required)>'
  from ruby-1.9.2-p136/bin/turn:19:in `load'
  from ruby-1.9.2-p136/bin/turn:19:in `<main>'

Command line utility doesn't work?

$ turn -h
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- facets/progressbar (LoadError)
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
  from /Users/chris/.gems/gems/turn-0.6.2/lib/turn/reporters/progress_reporter.rb:2
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
  from /Users/chris/.gems/gems/turn-0.6.2/lib/turn/controller.rb:10
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
  from /Users/chris/.gems/gems/turn-0.6.2/lib/turn/command.rb:25
  from /Users/chris/.gems/gems/turn-0.6.2/bin/turn:3:in `load'
  from /Users/chris/.gems/gems/turn-0.6.2/bin/turn:3
  from /Users/chris/.gems/bin/turn:19:in `load'
  from /Users/chris/.gems/bin/turn:19

I have facets installed:

$ gem list facets

*** LOCAL GEMS ***

facets (2.8.0)

--trace still doesn't work

With turn 0.8.3 and Ruby 1.9.3, if I run turn --trace my_test.rb, failures still only show a single error line rather than the full stack trace. I read issue #33 and it led me to believe that --trace should now work with every runner, but unfortunately this is not the case. I tried -P, -D, -T, and none of them gave a full trace when combined with --trace. The only one which did was -C but of course this doesn't work with non-interactive test runs. I'm happy to help debug the issue ...

BTW I'm using minitest - I deinstalled test-unit and also tried with -m to make sure; neither made any difference.

with 0.8.3, turn --version reports 0.9.0

I have turn 0.8.3 installed, but turn --version outputs 0.9.0. Here is the guilty commit made back in August, before 0.8.3 was released - presumably someone changed their mind about what the next version number would be, and forgot to fix this.

Only display failed test

Can there be an option that the output only display failed tests?

Each of my test class has a butt load of tests and that'll be really handy!

Need to register turn runner

I'd like to use turn as my global test runner (i.e. the runner I set in my global .test-unit.yml file), but it doesn't appear that turn registers itself as a runner via AutoRunner.register_runner.

Complete backtrace?

Hi.

My test raises an exception, due to active record, but the backtrace contains only one line so I can't see where it has been raised. Is there a way to expand the backtrace output?

Turn 0.9.3 causes all tests in suite to be run rather than only changed files

Rails 3.2.1, turn 0.9.3 (from repo), rails-autotest 4.1.0 and 4.1.1, minitest 2.6.2, autotest-fsevent 0.2.7

(color and formatting are back and working)

in test_helper.rb - do NOT have 'require turn/autorun' - but have tried it both ways. Did have Turn.config.ansi = true

Any time any file is changed, entire suite of tests run.

Also, errors dump the entire stack trace - which again defeats pretty printing.

Have reverted to turn 0.8.3.

BTW - I like the PASS/FAIL/SKIP on the left rather than the right because I use really long test names, which makes a
very ragged right edge. If that is configurable, please add a couple of notes to the README

Thanks,
Mike

With Autotest, repeatedly runs single test file

In a Rails project that uses Shoulda (in case that matters), I required turn using the recommended begin ... rescue LoadError scheme. I then ran autotest -f. After changing a file and saving it, autotest did indeed run the related test file, but it then continued to run it in a loop without end -- even when I saved another file.

My apologies for not tracking down the issue and patching it myself.

Turn with Spork and Test::Unit - Test Either not running

I've been working getting our integration tests to run using Test::Unit, Capybara, Spork, and Guard. We've been using Turn and love the output when running tests.

But it takes us 15 seconds (on a patched ruby 1.9.3) just to boot Rails, so Spork really helps cut down on that testing time.

Below you can see the three cases. We know that each of Spork and turn are working when run without the other being turned on, but when you enable both of them, the tests don't actually run. I have even made test that purposely fails, but it still shows "pass: 0, fail: 0, error: 0 total: 0 tests with 0 assertions in 0.004036 seconds" on one that should most definitely fail. Even tests that should be throwing exceptions are not.

If you could point me in the right direction on what I would need to do to get the two tool to work together, I would love to work on this for you.

###############################################################
# Turn : false
# Spork : true
###############################################################
bash$ testdrb -Itest test/integration/nurse_notes_test.rb 
Loaded suite NurseNotesTest
Started


Finished in 4.351769 seconds.

2 tests, 3 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed

0.46 tests/s, 0.69 assertions/s



###############################################################
# Turn : true
# Spork : false
###############################################################
bash$ ruby -Itest test/integration/nurse_notes_test.rb 

LOADED SUITE test,test/integration,test/support,test/unit

ActionController::TestCase
ActionDispatch::IntegrationTest
ActiveRecord::TestCase
ActiveSupport::TestCase
NurseNotesTest
     test_nurse_note_has_show                                             PASS
     test_nurse_note_has_summary                                          PASS
Test::Unit::TestCase
==============================================================================
  pass: 2,  fail: 0,  error: 0
  total: 2 tests with 3 assertions in 2.797512 seconds
==============================================================================



###############################################################
# Turn : true
# Spork : true
###############################################################
bash$ testdrb -Itest test/integration/nurse_notes_test.rb 
LOADED SUITE test/integration

==============================================================================
  pass: 0,  fail: 0,  error: 0
  total: 0 tests with 0 assertions in 0.004036 seconds
==============================================================================

MiniTest Support

I recently pushed a "first small step toward MiniTest support". First let me apologize for pushing that directly to master. That was an accident. I thought I was pushing to my own fork. But maybe it's for the best b/c at some point this issue has to be addressed, and now is a good a time as any.

I've been giving the issue some serious thought, I've become concerned that supporting both Test::Unit and MiniTest with the same code base will prove increasingly difficult. Already Test::Unit 2 has a number of new counts (omitted, pending, etc.). So not only will the runners need an adapter, but each reporter will also have to account for these distinctions.

So I am thinking that Turn might do well to split into two projects, one for Test::Unit and one for MiniTest. I think this is the best solution b/c it allows each project to evolve as needs be along with the underlying test framework they each augment. Of course, the two can continue to cross-pollinate.

Output buffered with ruby 1.8.7 and autotest

When running autotest and turn with ruby 1.8.7 the output is all buffered until the end of the test run. This is a little bit annoying. Has anyone experienced this before?

It works fine with ruby 1.9.2 but would like it to work in a similar manner on 1.8.7.

Any suggestions?

Cheers,
Alastair

Turn has an unspecified dependency on MiniTest

As of turn v. 0.8.3, there is an undocumented dependency on MiniTest.

It appears this stems from some recent additions to support minitest.

I don't particularly care for all the extra output from MiniTest, so if this could be optional or sensing that would be the preferred fix.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.