Our test quite takes a while to run, and there is always this 5-10 minute period where we know which test has failed, but we can't see the failure message or backtrace until the suite finishes. It would be more efficient to see the backtraces as they happen. Is this possible?
How can you get rspec to print failed test backtraces *as* it is running?
Asked Answered
You have two options:
1) fail fast
# spec/spec_helper.rb
RSpec.configure do |c|
c.fail_fast = true
end
..or use it from the command line
$ bundle exec rspec spec/ --fail-fast
.F
Failures:
1) Swinger should set the Capybara driver
Failure/Error: Capybara.current_driver.should_not == :rack_test
Finished in 0.00479 seconds
2 examples, 1 failure
Basically this option on error will stop the test suite and it will print the error.
2) use rspec-instafail gem
https://github.com/grosser/rspec-instafail
This gem will show failing spec instantly and it will continue running specs.
fail_fast is close but it stops the rest of the tests from running after the first failure. To have them keep running is better, so rspec-instafail worked great! (after a brief troll combining it with Guard github.com/grosser/rspec-instafail/issues/13) Thanks a ton! You just saved me a bunch of time. –
Tinctorial
I use Fuubar to get immediate failure messages and backtraces while the suite continues, as well as get a more meaningful indicator of how far my test suite has progressed.
Fuubar looks pretty awesome also. Thanks! –
Tinctorial
© 2022 - 2024 — McMap. All rights reserved.