Why does Rails 5 order test cases randomly?

不打扰是莪最后的温柔 提交于 2019-12-14 01:42:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!