junit-team/junit — pull request #998 by SpOOnman (2014-09-26 13:58:27+00:00)
Title: Random @FixMethodOrder with seed

This is my draft proposal for new @FixMethodOrder(RANDOM) option. It allows you to shuffle test methods order within test suite. Then it's easier to detect tests that has side effects and affect other test. Typical scenario is when you have a test suite that passes with deterministic and predictable order on one JVM, but fails on other. Random order gives you more confidence that your tests don't rely on each order.

Each test suite has it's own random seed and this seed is displayed. Later on you can recreate the same shuffled order using displayed seed. You can achieve that with new @FixMethodOrder parameter - seed. This is guaranteed by Java Random implementation: "If two instances of Random are created with the same seed, and the same sequence of method calls is made for each, they will generate and return identical sequences of numbers".

I have one problem with this draft. I cannot find a proper way to communicate generated seed to user. There are many runners with different purposes and I'm not sure which solution would be fine here. I've marked these places with TODO mark.

If you like my implementation, please help me with that last point.