@API(status=STABLE, since="5.0") public final class Constants extends Object
JupiterTestEngine
.
Values for timeouts must be in the following, case-insensitive format:
<number> [ns|μs|ms|s|m|h|d]
. The space between the number and the
unit may be omitted. Specifying no unit is equivalent to using seconds.
Value | Equivalent annotation |
---|---|
42 | @Timeout(42) |
42 ns | @Timeout(value = 42, unit = NANOSECONDS) |
42 μs | @Timeout(value = 42, unit = MICROSECONDS) |
42 ms | @Timeout(value = 42, unit = MILLISECONDS) |
42 s | @Timeout(value = 42, unit = SECONDS) |
42 m | @Timeout(value = 42, unit = MINUTES) |
42 h | @Timeout(value = 42, unit = HOURS) |
42 d | @Timeout(value = 42, unit = DAYS) |
ConfigurationParameters
Modifier and Type | Field and Description |
---|---|
static String |
DEACTIVATE_ALL_CONDITIONS_PATTERN
Wildcard pattern which signals that all conditions should be deactivated: "*"
|
static String |
DEACTIVATE_CONDITIONS_PATTERN_PROPERTY_NAME
Property name used to provide a pattern for deactivating conditions: "junit.jupiter.conditions.deactivate"
|
static String |
DEFAULT_AFTER_ALL_METHOD_TIMEOUT_PROPERTY_NAME
Property name used to set the default timeout for all
@AfterAll methods. |
static String |
DEFAULT_AFTER_EACH_METHOD_TIMEOUT_PROPERTY_NAME
Property name used to set the default timeout for all
@AfterEach methods. |
static String |
DEFAULT_BEFORE_ALL_METHOD_TIMEOUT_PROPERTY_NAME
Property name used to set the default timeout for all
@BeforeAll methods. |
static String |
DEFAULT_BEFORE_EACH_METHOD_TIMEOUT_PROPERTY_NAME
Property name used to set the default timeout for all
@BeforeEach methods. |
static String |
DEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAME
Property name used to set the default test execution mode for top-level
classes: "junit.jupiter.execution.parallel.mode.classes.default"
|
static String |
DEFAULT_DISPLAY_NAME_GENERATOR_PROPERTY_NAME
Property name used to set the default display name generator class name: "junit.jupiter.displayname.generator.default"
|
static String |
DEFAULT_LIFECYCLE_METHOD_TIMEOUT_PROPERTY_NAME
Property name used to set the default timeout for all lifecycle methods.
|
static String |
DEFAULT_PARALLEL_EXECUTION_MODE
Property name used to set the default test execution mode: "junit.jupiter.execution.parallel.mode.default"
|
static String |
DEFAULT_TEST_FACTORY_METHOD_TIMEOUT_PROPERTY_NAME
Property name used to set the default timeout for all
@TestFactory methods. |
static String |
DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME
Property name used to set the default test instance lifecycle mode: "junit.jupiter.testinstance.lifecycle.default"
|
static String |
DEFAULT_TEST_METHOD_TIMEOUT_PROPERTY_NAME
Property name used to set the default timeout for all
@Test methods. |
static String |
DEFAULT_TEST_TEMPLATE_METHOD_TIMEOUT_PROPERTY_NAME
Property name used to set the default timeout for all
@TestTemplate methods. |
static String |
DEFAULT_TESTABLE_METHOD_TIMEOUT_PROPERTY_NAME
Property name used to set the default timeout for all testable methods.
|
static String |
DEFAULT_TIMEOUT_PROPERTY_NAME
Property name used to set the default timeout for all testable and
lifecycle methods.
|
static String |
EXTENSIONS_AUTODETECTION_ENABLED_PROPERTY_NAME
Property name used to enable auto-detection and registration of extensions via
Java's
ServiceLoader mechanism: "junit.jupiter.extensions.autodetection.enabled" |
static String |
PARALLEL_CONFIG_CUSTOM_CLASS_PROPERTY_NAME
Property name used to specify the fully qualified class name of the
ParallelExecutionConfigurationStrategy to be used for the
custom configuration strategy: "junit.jupiter.execution.parallel.config.custom.class" |
static String |
PARALLEL_CONFIG_DYNAMIC_FACTOR_PROPERTY_NAME
Property name used to set the factor to be multiplied with the number of
available processors/cores to determine the desired parallelism for the
dynamic configuration strategy: "junit.jupiter.execution.parallel.config.dynamic.factor" |
static String |
PARALLEL_CONFIG_FIXED_PARALLELISM_PROPERTY_NAME
Property name used to set the desired parallelism for the
fixed
configuration strategy: "junit.jupiter.execution.parallel.config.fixed.parallelism" |
static String |
PARALLEL_CONFIG_STRATEGY_PROPERTY_NAME
Property name used to select the
ParallelExecutionConfigurationStrategy : "junit.jupiter.execution.parallel.config.strategy" |
static String |
PARALLEL_EXECUTION_ENABLED_PROPERTY_NAME
Property name used to enable parallel test execution: "junit.jupiter.execution.parallel.enabled"
|
public static final String DEACTIVATE_CONDITIONS_PATTERN_PROPERTY_NAME
If the pattern consists solely of an asterisk (*
), all conditions
will be deactivated. Otherwise, the pattern will be used to match against
the fully qualified class name (FQCN) of each registered condition.
Any dot (.
) in the pattern will match against a dot (.
)
or a dollar sign ($
) in the FQCN. Any asterisk (*
) will match
against one or more characters in the FQCN. All other characters in the
pattern will be matched one-to-one against the FQCN.
*
: deactivates all conditions.
org.junit.*
: deactivates every condition under the org.junit
base package and any of its subpackages.
*.MyCondition
: deactivates every condition whose simple class name is
exactly MyCondition
.
*System*
: deactivates every condition whose simple class name contains
System
.
org.example.MyCondition
: deactivates the condition whose FQCN is
exactly org.example.MyCondition
.
public static final String DEACTIVATE_ALL_CONDITIONS_PATTERN
public static final String DEFAULT_DISPLAY_NAME_GENERATOR_PROPERTY_NAME
Supported values include fully qualified class names for types that implement
DisplayNameGenerator
.
If not specified, the default is
DisplayNameGenerator.Standard
.
public static final String EXTENSIONS_AUTODETECTION_ENABLED_PROPERTY_NAME
ServiceLoader
mechanism: "junit.jupiter.extensions.autodetection.enabled"
The default behavior is not to perform auto-detection.
public static final String DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME
Supported values include names of enum constants defined in
TestInstance.Lifecycle
, ignoring case.
If not specified, the default is "per_method" which corresponds to
@TestInstance(Lifecycle.PER_METHOD)
.
TestInstance
,
Constant Field Values@API(status=EXPERIMENTAL, since="5.3") public static final String PARALLEL_EXECUTION_ENABLED_PROPERTY_NAME
By default, tests are executed sequentially in a single thread.
@API(status=EXPERIMENTAL, since="5.4") public static final String DEFAULT_PARALLEL_EXECUTION_MODE
This setting is only effective if parallel execution is enabled.
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)
.
Execution
,
ExecutionMode
,
Constant Field Values@API(status=EXPERIMENTAL, since="5.5") public static final String DEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAME
This setting is only effective if parallel execution is enabled.
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_PARALLEL_EXECUTION_MODE
.
Execution
,
ExecutionMode
,
Constant Field Values@API(status=EXPERIMENTAL, since="5.3") public static final String PARALLEL_CONFIG_STRATEGY_PROPERTY_NAME
ParallelExecutionConfigurationStrategy
: "junit.jupiter.execution.parallel.config.strategy"
Potential values: dynamic
(default), fixed
, or
custom
.
@API(status=EXPERIMENTAL, since="5.3") public static final String PARALLEL_CONFIG_FIXED_PARALLELISM_PROPERTY_NAME
fixed
configuration strategy: "junit.jupiter.execution.parallel.config.fixed.parallelism"
No default value; must be a positive integer.
@API(status=EXPERIMENTAL, since="5.3") public static final String PARALLEL_CONFIG_DYNAMIC_FACTOR_PROPERTY_NAME
dynamic
configuration strategy: "junit.jupiter.execution.parallel.config.dynamic.factor"
Value must be a positive decimal number; defaults to 1
.
@API(status=EXPERIMENTAL, since="5.3") public static final String PARALLEL_CONFIG_CUSTOM_CLASS_PROPERTY_NAME
ParallelExecutionConfigurationStrategy
to be used for the
custom
configuration strategy: "junit.jupiter.execution.parallel.config.custom.class"@API(status=EXPERIMENTAL, since="5.5") public static final String DEFAULT_TIMEOUT_PROPERTY_NAME
The value of this property will be used unless overridden by a more
specific property or a @Timeout
annotation present on the method or on an enclosing test class (for testable
methods).
Please refer to the class description for the definition of supported values.
Timeout
,
Constant Field Values@API(status=EXPERIMENTAL, since="5.5") public static final String DEFAULT_TESTABLE_METHOD_TIMEOUT_PROPERTY_NAME
The value of this property will be used unless overridden by a more
specific property or a @Timeout
annotation present on the testable method or on an enclosing test class.
This property overrides the "junit.jupiter.execution.timeout.default" property.
Please refer to the class description for the definition of supported values.
Timeout
,
Constant Field Values@API(status=EXPERIMENTAL, since="5.5") public static final String DEFAULT_TEST_METHOD_TIMEOUT_PROPERTY_NAME
@Test
methods.
The value of this property will be used unless overridden by a
@Timeout
annotation present on the
@Test
method or on an enclosing test
class.
This property overrides the "junit.jupiter.execution.timeout.testable.method.default" property.
Please refer to the class description for the definition of supported values.
Timeout
,
Constant Field Values@API(status=EXPERIMENTAL, since="5.5") public static final String DEFAULT_TEST_TEMPLATE_METHOD_TIMEOUT_PROPERTY_NAME
@TestTemplate
methods.
The value of this property will be used unless overridden by a
@Timeout
annotation present on the
@TestTemplate
method or on an
enclosing test class.
This property overrides the "junit.jupiter.execution.timeout.testable.method.default" property.
Please refer to the class description for the definition of supported values.
Timeout
,
Constant Field Values@API(status=EXPERIMENTAL, since="5.5") public static final String DEFAULT_TEST_FACTORY_METHOD_TIMEOUT_PROPERTY_NAME
@TestFactory
methods.
The value of this property will be used unless overridden by a
@Timeout
annotation present on the
@TestFactory
method or on an
enclosing test class.
This property overrides the "junit.jupiter.execution.timeout.testable.method.default" property.
Please refer to the class description for the definition of supported values.
Timeout
,
Constant Field Values@API(status=EXPERIMENTAL, since="5.5") public static final String DEFAULT_LIFECYCLE_METHOD_TIMEOUT_PROPERTY_NAME
The value of this property will be used unless overridden by a more
specific property or a @Timeout
annotation present on the lifecycle method.
This property overrides the "junit.jupiter.execution.timeout.default" property.
Please refer to the class description for the definition of supported values.
Timeout
,
Constant Field Values@API(status=EXPERIMENTAL, since="5.5") public static final String DEFAULT_BEFORE_ALL_METHOD_TIMEOUT_PROPERTY_NAME
@BeforeAll
methods.
The value of this property will be used unless overridden by a
@Timeout
annotation present on the
@BeforeAll
method.
This property overrides the "junit.jupiter.execution.timeout.lifecycle.method.default" property.
Please refer to the class description for the definition of supported values.
Timeout
,
Constant Field Values@API(status=EXPERIMENTAL, since="5.5") public static final String DEFAULT_BEFORE_EACH_METHOD_TIMEOUT_PROPERTY_NAME
@BeforeEach
methods.
The value of this property will be used unless overridden by a
@Timeout
annotation present on the
@BeforeEach
method.
This property overrides the "junit.jupiter.execution.timeout.lifecycle.method.default" property.
Please refer to the class description for the definition of supported values.
Timeout
,
Constant Field Values@API(status=EXPERIMENTAL, since="5.5") public static final String DEFAULT_AFTER_EACH_METHOD_TIMEOUT_PROPERTY_NAME
@AfterEach
methods.
The value of this property will be used unless overridden by a
@Timeout
annotation present on the
@AfterEach
method.
This property overrides the "junit.jupiter.execution.timeout.lifecycle.method.default" property.
Please refer to the class description for the definition of supported values.
Timeout
,
Constant Field Values@API(status=EXPERIMENTAL, since="5.5") public static final String DEFAULT_AFTER_ALL_METHOD_TIMEOUT_PROPERTY_NAME
@AfterAll
methods.
The value of this property will be used unless overridden by a
@Timeout
annotation present on the
@AfterAll
method.
This property overrides the "junit.jupiter.execution.timeout.lifecycle.method.default" property.
Please refer to the class description for the definition of supported values.
Timeout
,
Constant Field ValuesCopyright © 2019. All rights reserved.