Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random @FixMethodOrder with seed #998

Closed
wants to merge 1 commit into from

Conversation

SpOOnman
Copy link

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.

@kcooney
Copy link
Member

kcooney commented Sep 26, 2014

We are currently finalizing 4.12, so this will have to wait for a bit.

I personally would strongly prefer that we get some version of #882 committed and have people write their own random "sorter". I've rarely seen two engineers agree on how to implement randomization of test classes/methods.

@marcphilipp
Copy link
Member

Closing in favor of #1004.

@marcphilipp marcphilipp closed this Dec 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants