Annotation Type Execution
-
@API(status=STABLE, since="5.10") @Retention(RUNTIME) @Target({TYPE,METHOD}) @Inherited public @interface Execution@Executionis used to configure the parallel execution mode of a test class or test method.Since JUnit Jupiter 5.4, this annotation is inherited within class hierarchies.
Default Execution Mode
If this annotation is not present,
ExecutionMode.SAME_THREADis 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_CLASSlifecycle or aMethodOrderer. 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
Fields Modifier and Type Fields Description static java.lang.StringDEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAMEProperty name used to set the default test execution mode for top-level classes: "junit.jupiter.execution.parallel.mode.classes.default"static java.lang.StringDEFAULT_EXECUTION_MODE_PROPERTY_NAMEProperty name used to set the default test execution mode: "junit.jupiter.execution.parallel.mode.default"
-
Required Element Summary
Required Elements Modifier and Type Required Element Description ExecutionModevalueThe required/preferred execution mode.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.StringreasonThe reason for using the selected execution mode.
-
-
-
Field Detail
-
DEFAULT_EXECUTION_MODE_PROPERTY_NAME
@API(status=MAINTAINED, since="5.13.3") static final java.lang.String DEFAULT_EXECUTION_MODE_PROPERTY_NAMEProperty name used to set the default test execution mode: "junit.jupiter.execution.parallel.mode.default"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).- Since:
- 5.4
-
-
-
DEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAME
@API(status=MAINTAINED, since="5.13.3") static final java.lang.String DEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAMEProperty name used to set the default test execution mode for top-level classes: "junit.jupiter.execution.parallel.mode.classes.default"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.- Since:
- 5.4
-
-
Element Detail
-
value
ExecutionMode value
The required/preferred execution mode.- See Also:
ExecutionMode
-
-