ruby on rails 4.2 - How to make MiniTests run tests in alphabetical order of Test classes? -


in minitest know can make test methods run in alphabetical order, not feasible test classes . there way in can make minitest run in alphabetical order of test classes?

i know there shouldn't dependency between test classes not approach, there @ possible way can achieve this?

we figured out solution in case looking 1

take @ following thread:

https://github.com/seattlerb/minitest/issues/514

here gist thread in case link broken:

correct. can see in gist, test methods still running in alphabetical order, test classes not.

test order dependencies bugs in tests can , lead errors in production code. should consider fixing tests each 1 order independent. full randomization 100% success should goal. if have lot of tests, can daunting task, https://github.com/seattlerb/minitest-bisect can absolutely that.

if you're reason absolutely 100% dead-set on keeping test order dependency (errors), you'll have monkey patch minitest.__run.

add initializer patching minitest similar following

module minitest   def self.__run reporter, options     suites = runnable.runnables     parallel, other = suites.partition { |s| s.test_order == :parallel }     random, sorted  = other.partition  { |s| s.test_order == :random }      sorted.map { |suite| suite.run reporter, options } +       random.shuffle.map   { |suite| suite.run reporter, options } +       parallel.shuffle.map { |suite| suite.run reporter, options }   end end 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -