Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Invocations of a method-ordered class template should run in parallel by default #5024

Copy link
Copy link
@t-o-n-y-p

Description

@t-o-n-y-p
Issue body actions

Following the discussion here #5023

Steps to reproduce

  1. Set up parallel test execution, for example, with 4 fixed threads
  2. Write a method-ordered test class annotated with @TestMethodOrder(MethodOrderer.OrderAnnotation.class) and with order being assigned to its test methods
  3. Declare this class a template and make a couple of invocations for it
  4. Run the test class. Code example is provided below
junit.jupiter.execution.parallel.enabled=true
junit.jupiter.execution.parallel.mode.default=concurrent
junit.jupiter.execution.parallel.config.strategy=fixed
junit.jupiter.execution.parallel.config.fixed.parallelism=4
@ExtendWith(MethodOrderedClassTemplateExtension.class)
@ClassTemplate
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class MethodOrderedClassTemplateTest {

  @Test
  @Order(0)
  void test1() throws InterruptedException {
    Thread.sleep(2000);
  }

  @Test
  @Order(1)
  void test2() throws InterruptedException {
    Thread.sleep(2000);
  }
}
@NullMarked
public class MethodOrderedClassTemplateExtension implements ClassTemplateInvocationContextProvider {
  @Override
  public boolean supportsClassTemplate(ExtensionContext context) {
    return true;
  }

  @Override
  public Stream<? extends ClassTemplateInvocationContext> provideClassTemplateInvocationContexts(ExtensionContext context) {
    return Stream.of(new ClassTemplateInvocationContext() {}, new ClassTemplateInvocationContext() {});
  }
}

Expected result

Invocations are being run in parallel while test method order is being respected within each invocation

Actual result

Invocations are being run sequentially

Context

  • Used versions (Jupiter/Vintage/Platform): 6.0.0
  • Build Tool/IDE: IntelliJ IDEA 2025.2.2

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.