开发者

Is there a way to force RSpec to show intermediate results?

开发者 https://www.devze.com 2023-01-25 00:58 出处:网络
Every time I run RSpec tests, it goes off executing everything. Which is fine, except tha开发者_StackOverflowt I don\'t want to wait for the entire suite to run before I see what the one failure early

Every time I run RSpec tests, it goes off executing everything. Which is fine, except tha开发者_StackOverflowt I don't want to wait for the entire suite to run before I see what the one failure early in the series was.

$ rspec spec/
...........F................................


I think this is what you are looking for: http://jeffkreeftmeijer.com/2010/making-rspec-stop-operation-immediately-after-failing/

It makes RSpec stop after the first failure.

You should also look at this: http://jeffkreeftmeijer.com/2010/fuubar-the-instafailing-rspec-progress-bar-formatter/

It's a better RSpec formatter.


Another option, if you want immediate information about a failure is to change the format to be documentation, that way you will see the details of any given failure as it happens.

You set this by running rspec with the --format documentation option. It can also be put in your spec_helper.rb as a permanent option for that repository (though can be overriden at the command line).

The downside to this approach is that you now get a lot wordier output and in fact earlier output will scroll off, so this option works best if you are going to keep the terminal window open and visible somewhere so you can see when errors come up. Doesn't require direct attention as peripheral vision can be used and of course you can scroll back at any point. Works better for smaller repositories with hundreds rather than thousands of tests.


It's also worth mentioning that if you interrupt an 'rspec' (ctl+C) it will immediately jump to the end reports so you can see what the error's about.

Unit Test isn't that clever, last time I looked.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号