问题
It's mentioned in the upgrade guide Rails 5 will order tests randomly. It's trivial to revert to fixed order, but I'm just wondering why this change was made? Is it to support parallel testing?
回答1:
Random test ordering is good practice. If you always do your test in a fixed order there is a chance your tests depend on each other. Each test should have no side effects, and random ordering guarantees this.
回答2:
Refereed to Rails 5 Awesome features
Rails 5 order test cases randomly, the new runner is, in fact, my favourite piece of Rails 5. I love minitest, and I always was a bit envy of RSpec users, as they have a great runner that allows you to specify the file and line number of a failing spec.
Now, thanks to Yves Senn, we have the same feature when using Rails’ minitest.
来源:https://stackoverflow.com/questions/27826600/why-does-rails-5-order-test-cases-randomly