-
-
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
Cannot run @ParameterizedTest
method invocations in parallel and other test sequentially
#3373
Comments
@marcphilipp does JUnit 5 has the opportunity to run tests from @MethodSource parallely ? |
Edit(h) deleted a screenshot of "Writing Tests" / "Parallel Execution" section from the User Guide. https://junit.org/junit5/docs/current/user-guide/#writing-tests-parallel-execution |
@sormuras thanks for the reference, but test with method source feels it as separate test. When I run A.test1[1] and A.test[2] and A.test2[1] and A.test2[2] it can run crossing like A.test1[1] and A.test2[1]. How to be sure that test with all data run and after that move to another test ? @TestMethodOrder(MethodOrderer.OrderAnnotation.class) doesn't help me. |
@ParameterizedTest
with @MethodSource
in parallel and other test sequentially
@gl-khimin, just to be clear, are you asking the following question?
|
@ParameterizedTest
with @MethodSource
in parallel and other test sequentially@ParameterizedTest
method invocations in parallel and other test sequentially
If you would like us to be able to process this issue, please provide the requested information. If the information is not provided within the next 3 weeks, we will be unable to proceed and this issue will be closed. |
@gl-khimin IIUC you're asking if there's a way to run invocations of a parameterized test in parallel but not concurrently to invocations of other parameterized tests, right? For example, run public class ConcurrentParameterizedTests {
@ParameterizedTest
@ValueSource(ints = { 1, 2, 3, 4, 5, 6 })
void test1() throws Exception {
Thread.sleep(1000);
}
@ParameterizedTest
@ValueSource(ints = { 1, 2, 3, 4, 5, 6 })
void test2() throws Exception {
Thread.sleep(1000);
}
} Currently that's only possible if you enclose each parameterized test in a nested class: @Execution(SAME_THREAD)
public class ConcurrentParameterizedTests {
@Nested
class A {
@ParameterizedTest
@Execution(CONCURRENT)
@ValueSource(ints = { 1, 2, 3, 4, 5, 6 })
void test1() throws Exception {
Thread.sleep(1000);
}
}
@Nested
class B {
@ParameterizedTest
@Execution(CONCURRENT)
@ValueSource(ints = { 1, 2, 3, 4, 5, 6 })
void test2() throws Exception {
Thread.sleep(1000);
}
}
} Please let me know if that wasn't what you were asking. 🙂 |
How can I run a parameterized test which retrieves data from
@MethodSource
in parallel?One way to do it is to run only one test in class parallel. I found global configurations:
junit.jupiter.execution.parallel.mode.default = same_thread
: run tests in class in paralleljunit.jupiter.execution.parallel.mode.classes.default = same_thread
: tests classes paralleljunit.jupiter.execution.parallel.enabled=true
The text was updated successfully, but these errors were encountered: