mahemoff
mahemoff

Reputation: 46479

Why does Rails 5 order test cases randomly?

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?

Upvotes: 4

Views: 1076

Answers (2)

Sumit Munot
Sumit Munot

Reputation: 3868

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.

Upvotes: 2

ptd
ptd

Reputation: 3053

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.

Upvotes: 10

Related Questions