Repository navigation
[SUREFIRE-859] Make random test order reproducible - #3421
Merged
slachiewicz merged 1 commit intoAug 10, 2026
Merged
Conversation
Sort discovered test classes before shuffling so a seed produces the same order across filesystems and machines. Forward the Surefire random seed to JUnit Jupiter for deterministic class and method ordering. Fixes apache#859
wilx
marked this pull request as ready for review
August 9, 2026 16:22
Member
|
@wilx could You add labels to PR? |
slachiewicz
approved these changes
Aug 9, 2026
Contributor
Author
I don't think I have the privileges. I don't see the cog wheel. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
runOrderRandomSeedto JUnit Jupiter asjunit.jupiter.execution.order.random.seedWhy
Collections.shuffle()is deterministic only when both its input order and seed are deterministic. Test-class discovery can return classes in a different order across filesystems and machines, so the same Surefire seed previously produced different shuffled orders.JUnit Jupiter also performs its own class and method ordering. Surefire selected Jupiter's random orderers for
runOrder=random, but did not passrunOrderRandomSeedto JUnit. Jupiter therefore used an independent seed and could not reproduce the complete test order from the Surefire seed.Sorting the discovered classes before shuffling provides a stable input. Forwarding the same seed through JUnit's configuration parameters makes Jupiter's random class and method ordering reproducible as well. An explicit
junit.jupiter.execution.order.random.seedin Surefire's JUnit configuration parameters retains precedence.Fixes #859
Validation
mvn clean installpassed across all 17 reactor modules on JDK 17mvn -Prun-its clean installpassed;surefire-itsran 764 tests with no failures or errorsRunOrderITpassed all 11 tests, including JUnit seed propagation withforkCount=0andforkCount=1git diff --checkpassedFollowing this checklist to help us incorporate your
contribution quickly and easily:
mvn clean installto make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
mvn -Prun-its clean install).If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.