-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Introduce support for parallel test execution in declarative test suites #964
Comments
Related to #60 |
Understood. #60 still serves as a good umbrella issue for parallel, other thread, multi-thread feature requests. |
This is closely related to #744. |
I have reworded this issue's title accordingly. |
Added Related Issues section. |
Thanks for looking into this. What's the status of #744? If things turn out to become more concrete, I would happily support the development. |
Well, you could of course start experimenting in your own branch, develop a proof of concept, etc. |
not sure if is part of the same issue, I am trying to migrating a maven project from JUnit4 to JUnit5. When I added the needed dependencies in pom.xml file for the plugins, Is there any support for parallel test executions in maven ? |
Regarding Maven: @koretzki Can you please try that? |
Yes, it does work. |
The plan is to handover the plugin to the Maven Surefire team. Please consult them regarding their roadmap. /cc @Tibor17 |
Is this currently supported in the gradle plugin? Is the team waiting for the Gradle team to take over the Junit5 gradle integration and embed it into the gradle tool by default. |
Our Gradle plugin does currently not support parallel test execution. And, indeed, we're waiting for the Gradle team to start work on first-class support for JUnit 5. As a sidenote, there's also a prototype for parallel execution within the Jupiter engine, see #60. |
@marcphilipp - Now that there is gradle plugin support via the My specific use-case is to be able to run each test in its own isolated JVM to ensure that static state is not carried between unit tests (legacy system). This seems closely related to parallel test support. |
@jamiewastin |
The parallel test execution feature is exactly what I needed. This is an amazing and truly elegant solution! For my use case this worked perfectly: Create junit-platform.properties in src/test/resources:
Add The concurrent execution of test methods (not just classes) is amazing. Thank you so much for adding this feature! I'm closing this issue now. |
@casid, thanks for letting us know. We are very glad to hear your excitement about the parallel test execution support. |
does it work with recent version of Maven Surefire/ Failsafe plugins ? |
@koretzki It does work with Maven Surefire/Failsafe. Consult the User Guide how to a) enable parallel execution in Jupiter and b) how to configure Maven Surefire. The Maven documentation states "Running Tests in Parallel -- From JUnit Platform does not support running tests in parallel." due to the fact that the |
@koretzki You can use the latest version |
@koretzki The real execution should be parallel. The only problem is that sometime the reports are lost or incomplete. Is this happening? |
Hi @Tibor17, reports are ok, but Failsafe does not run in parallel. I took my parallel working surefire maven profile and replaced just it with the Failsafe plugin. Any printout that was with thread name changed from ForkJoinPool (names) to Main in all test printouts (same check with thread ids).
|
@koretzki Does it work if you put those properties into |
@marcphilippI I did try it, but it did not work. |
@marcphilipp My bad to chime in, but this issue more or less describes my problem, and I saw that the last mention of you contains a typo :) So I'm trying to reproduce a working parallel suites scenario from JUnit 4 to JUnit 5. Are there any plans to change this? I have a large testbase so I desperately need parallelism, but within a "unit" (suite) a single threaded, fixed-order execution of test classes is a must. These are NOT unit tests, but functional tests with webdriver - the test classes/methods can be executed independently, but without shared states (same thread) and predetermined order, execution takes a very, very long time. |
I'm currently migrating a project from JUnit4 to JUnit5 (Branch: https://github.com/casid/mazebert-ladder/tree/junit5).
A feature of the JUnit4 tests is that I can run all unit tests in parallel. This is an essential feature since it a) chops down the test execution time significantly and b) prevents developers from adding shared state to unit tests.
In JUnit4 with the help of junit-toolbox:
I wished JUnit5 to support something like this:
But I couldn't find anything that looked even slightly like it.
I think suites could greatly improve configuration options for test executions. In fact, it would remove the need for external tools to implement the same features (e.g. parallel execution / test discovery). You could simply point maven-surefire, gradle or IntelliJ to the TestSuite(s) you want to execute.
Integration tests could benefit from this too:
I would love to have something like this in JUnit5! Currently I have some mixed feelings how to proceed with adopting JUnit5 (great new features like nested tests) vs JUnit4 (great test execution control).
Related Issues
@BeforeSuite
and@AfterSuite
annotations #456The text was updated successfully, but these errors were encountered: