Top Description Fields Methods
org.junit.jupiter.api.parallel

public @Interface Execution

extends Annotation
Annotations
@API
status:STABLE
since:5.10
@Retention:RUNTIME
@Target:TYPE, METHOD
@Inherited
Static Imports
org.apiguardian.api.API.Status.MAINTAINED, .API.Status.STABLE

@Execution is used to configure the parallel execution mode of a test class or test method.

This annotation is inherited within class hierarchies.

Default Execution Mode

If this annotation is not present, ExecutionMode#SAME_THREAD is used unless a default execution mode is defined via one of the following configuration parameters:

junit.jupiter.execution.parallel.mode.default
Default execution mode for all classes and tests
junit.jupiter.execution.parallel.mode.classes.default
Default execution mode for top-level classes

junit.jupiter.execution.parallel.mode.classes.default overrides junit.jupiter.execution.parallel.mode.default for top-level classes.

The default execution mode is not applied to classes that use the PER_CLASS lifecycle or a MethodOrderer. In both cases, test methods in such test classes are only executed concurrently if the @Execution(CONCURRENT) annotation is present on the test class or method.

Since
5.3
See Also
Isolated, ResourceLock

Field Summary

Modifier and TypeField and Description
public static final String
DEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAME

Property name used to set the default test execution mode for top-level classes:

This setting is only effective if parallel execution is enabled.

public static final String
DEFAULT_EXECUTION_MODE_PROPERTY_NAME

Property name used to set the default test execution mode:

This setting is only effective if parallel execution is enabled.

Method Summary

Modifier and TypeMethod and Description
public String
reason()

The reason for using the selected execution mode.

public ExecutionMode
value()

The required/preferred execution mode.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Field Detail

DEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAMEback to summary
public static final String DEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAME

Property name used to set the default test execution mode for top-level classes:

This setting is only effective if parallel execution is enabled.

Supported Values

Supported values include names of enum constants defined in ExecutionMode, ignoring case.

If not specified, it will be resolved into the same value as DEFAULT_EXECUTION_MODE_PROPERTY_NAME.

Annotations
@API
status:MAINTAINED
since:5.13.3
Since
5.4
DEFAULT_EXECUTION_MODE_PROPERTY_NAMEback to summary
public static final String DEFAULT_EXECUTION_MODE_PROPERTY_NAME

Property name used to set the default test execution mode:

This setting is only effective if parallel execution is enabled.

Supported Values

Supported values include names of enum constants defined in ExecutionMode, ignoring case.

If not specified, the default is "same_thread" which corresponds to @Execution(ExecutionMode.SAME_THREAD).

Annotations
@API
status:MAINTAINED
since:5.13.3
Since
5.4

Method Detail

reasonback to summary
public String reason()

The reason for using the selected execution mode.

This is for informational purposes only.

Annotations
@API
status:STABLE
since:5.10
Since
5.10
valueback to summary
public ExecutionMode value()

The required/preferred execution mode.

See Also
ExecutionMode