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

Allow Launcher to randomize tests after discovery #3398

Closed
LeggoMahEggo opened this issue Jul 20, 2023 · 3 comments
Closed

Allow Launcher to randomize tests after discovery #3398

LeggoMahEggo opened this issue Jul 20, 2023 · 3 comments

Comments

@LeggoMahEggo
Copy link

My test classes are annotated with @TestMethodOrder using the Random method orderer; they are (of course) performed in a random order, but when I discover and execute them from a Launcher instance, they run in the order that they were discovered. For example if the order of test discovery is TestClassA followed by TestClassB, both test classes have their tests randomized, but TestClassA's tests will always run before TestClassB's tests. I would like to be able to randomize all tests so that test execution order is a mix of both TestClassA and TestClassB tests (I gather though that it may be problematic due to needing to instantiate multiple test classes at the same time).

@marcphilipp
Copy link
Member

You can also randomize the order of test classes but that would still run all tests from one class before starting on the second class. The only way to achieve what you're after is to enable parallel execution. Would that be an option for you?

@LeggoMahEggo
Copy link
Author

Unfortunately not; I use Junit with Selenium to test my company's browser tools, so I don't think parallel execution would help in that regard.

@marcphilipp
Copy link
Member

Team decision: Since test classes also have lifecycle methods etc. we run them one by one unless parallel execution is enabled. Therefore, this proposal is not possible due to the architecture of JUnit 5.

@marcphilipp marcphilipp closed this as not planned Won't fix, can't repro, duplicate, stale Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants