ruby - Minitest i_suck_and_my_tests_are_order_dependent -
i'm using spec syntax of minitest describe blocks. in minitest_helper.rb
(what each spec file require
s) have:
minitest::test.i_suck_and_my_tests_are_order_dependent!
this makes test within describe block run in order. still, order of describe blocks random.
how make everything in-order?
demonstrating problem:
require 'minitest/autorun' require 'minitest/documentation' minitest::test.i_suck_and_my_tests_are_order_dependent! describe "block1" 3.times.each |i| "should print #{i+1}" end end describe "block2" 3.times.each |i| "should print #{i+1}" end end
i expect output:
block1 0001 should print 1 0002 should print 2 0003 should print 3 block2 0001 should print 1 0002 should print 2 0003 should print 3
but block2
comes first.adding more blocks shows blocks run in random order.
what want for?
documentation
randomizing tests great making sure tests independent should (in other words, it's great debugging test suite). after i'm done debugging test suite, though, want test-suite serve documentation, , documentation written in random order kind of sucks.
it doesn't seem there option turn off, added it: https://github.com/seattlerb/minitest/pull/550
minitest.should_shuffle_suites = false
should turn off minitest
fork.
Comments
Post a Comment