Interface ExecutionCondition

All Superinterfaces:
Extension
All Known Implementing Classes:
IgnoreCondition
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @API(status=STABLE, since="5.0") public interface ExecutionCondition extends Extension
ExecutionCondition defines the Extension API for programmatic, conditional test execution.

An ExecutionCondition is evaluated to determine if a given container or test should be executed based on the supplied ExtensionContext.

If an ExecutionCondition disables a test method, that does not prevent the test class from being instantiated. Rather, it prevents the execution of the test method and method-level lifecycle callbacks such as @BeforeEach methods, @AfterEach methods, and corresponding extension APIs.

Constructor Requirements

Consult the documentation in Extension for details on constructor requirements.

Since:
5.0
See Also:
Disabled, EnabledIfEnvironmentVariable, DisabledIfEnvironmentVariable, EnabledIfSystemProperty, DisabledIfSystemProperty, EnabledOnJre, DisabledOnJre, EnabledForJreRange, DisabledForJreRange, EnabledOnOs, DisabledOnOs
  • Method Details

    • evaluateExecutionCondition

      ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context)
      Evaluate this condition for the supplied ExtensionContext.

      An enabled result indicates that the container or test should be executed; whereas, a disabled result indicates that the container or test should not be executed.

      Parameters:
      context - the current extension context; never null
      Returns:
      the result of evaluating this condition; never null