Annotation Type Timeout

    • Field Detail

      • DEFAULT_TIMEOUT_PROPERTY_NAME

        @API(status=STABLE,
             since="5.9")
        static final java.lang.String DEFAULT_TIMEOUT_PROPERTY_NAME
        Property name used to set the default timeout for all testable and lifecycle methods: "junit.jupiter.execution.timeout.default".

        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.

        Since:
        5.5
      • DEFAULT_TESTABLE_METHOD_TIMEOUT_PROPERTY_NAME

        @API(status=STABLE,
             since="5.9")
        static final java.lang.String DEFAULT_TESTABLE_METHOD_TIMEOUT_PROPERTY_NAME
        Property name used to set the default timeout for all testable methods: "junit.jupiter.execution.timeout.testable.method.default".

        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.

        Since:
        5.5
      • DEFAULT_TEST_METHOD_TIMEOUT_PROPERTY_NAME

        @API(status=STABLE,
             since="5.9")
        static final java.lang.String DEFAULT_TEST_METHOD_TIMEOUT_PROPERTY_NAME
        Property name used to set the default timeout for all @Test methods: "junit.jupiter.execution.timeout.test.method.default".

        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.

        Since:
        5.5
      • DEFAULT_TEST_TEMPLATE_METHOD_TIMEOUT_PROPERTY_NAME

        @API(status=STABLE,
             since="5.9")
        static final java.lang.String DEFAULT_TEST_TEMPLATE_METHOD_TIMEOUT_PROPERTY_NAME
        Property name used to set the default timeout for all @TestTemplate methods: "junit.jupiter.execution.timeout.testtemplate.method.default".

        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.

        Since:
        5.5
      • DEFAULT_TEST_FACTORY_METHOD_TIMEOUT_PROPERTY_NAME

        @API(status=STABLE,
             since="5.9")
        static final java.lang.String DEFAULT_TEST_FACTORY_METHOD_TIMEOUT_PROPERTY_NAME
        Property name used to set the default timeout for all @TestFactory methods: "junit.jupiter.execution.timeout.testfactory.method.default".

        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.

        Since:
        5.5
      • DEFAULT_LIFECYCLE_METHOD_TIMEOUT_PROPERTY_NAME

        @API(status=STABLE,
             since="5.9")
        static final java.lang.String DEFAULT_LIFECYCLE_METHOD_TIMEOUT_PROPERTY_NAME
        Property name used to set the default timeout for all lifecycle methods: "junit.jupiter.execution.timeout.lifecycle.method.default".

        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.

        Since:
        5.5
      • DEFAULT_BEFORE_ALL_METHOD_TIMEOUT_PROPERTY_NAME

        @API(status=STABLE,
             since="5.9")
        static final java.lang.String DEFAULT_BEFORE_ALL_METHOD_TIMEOUT_PROPERTY_NAME
        Property name used to set the default timeout for all @BeforeAll methods: "junit.jupiter.execution.timeout.beforeall.method.default".

        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.

        Since:
        5.5
      • DEFAULT_BEFORE_EACH_METHOD_TIMEOUT_PROPERTY_NAME

        @API(status=STABLE,
             since="5.9")
        static final java.lang.String DEFAULT_BEFORE_EACH_METHOD_TIMEOUT_PROPERTY_NAME
        Property name used to set the default timeout for all @BeforeEach methods: "junit.jupiter.execution.timeout.beforeeach.method.default".

        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.

        Since:
        5.5
      • DEFAULT_AFTER_EACH_METHOD_TIMEOUT_PROPERTY_NAME

        @API(status=STABLE,
             since="5.9")
        static final java.lang.String DEFAULT_AFTER_EACH_METHOD_TIMEOUT_PROPERTY_NAME
        Property name used to set the default timeout for all @AfterEach methods: "junit.jupiter.execution.timeout.aftereach.method.default".

        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.

        Since:
        5.5
      • DEFAULT_AFTER_ALL_METHOD_TIMEOUT_PROPERTY_NAME

        @API(status=STABLE,
             since="5.9")
        static final java.lang.String DEFAULT_AFTER_ALL_METHOD_TIMEOUT_PROPERTY_NAME
        Property name used to set the default timeout for all @AfterAll methods: "junit.jupiter.execution.timeout.afterall.method.default".

        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.

        Since:
        5.5
      • TIMEOUT_MODE_PROPERTY_NAME

        @API(status=STABLE,
             since="5.9")
        static final java.lang.String TIMEOUT_MODE_PROPERTY_NAME
        Property name used to configure whether timeouts are applied to tests: "junit.jupiter.execution.timeout.mode".

        The value of this property will be used to toggle whether @Timeout is applied to tests.

        Supported timeout mode values:

        • enabled: enables timeouts
        • disabled: disables timeouts
        • disabled_on_debug: disables timeouts while debugging

        If not specified, the default is enabled.

        Since:
        5.6
      • DEFAULT_TIMEOUT_THREAD_MODE_PROPERTY_NAME

        @API(status=EXPERIMENTAL,
             since="5.9")
        static final java.lang.String DEFAULT_TIMEOUT_THREAD_MODE_PROPERTY_NAME
        Property name used to set the default thread mode for all testable and lifecycle methods: "junit.jupiter.execution.timeout.thread.mode.default".

        The value of this property will be used unless overridden by a @Timeout annotation present on the method or on an enclosing test class (for testable methods).

        The supported values are SAME_THREAD or SEPARATE_THREAD, if none is provided SAME_THREAD is used as default.

        Since:
        5.9
    • Element Detail

      • value

        long value
        The duration of this timeout.
        Returns:
        timeout duration; must be a positive number
      • unit

        java.util.concurrent.TimeUnit unit
        The time unit of this timeout.
        Returns:
        time unit
        See Also:
        TimeUnit
        Default:
        java.util.concurrent.TimeUnit.SECONDS
      • threadMode

        @API(status=EXPERIMENTAL,
             since="5.9")
        Timeout.ThreadMode threadMode
        The thread mode of this timeout.
        Returns:
        thread mode
        Since:
        5.9
        See Also:
        Timeout.ThreadMode
        Default:
        org.junit.jupiter.api.Timeout.ThreadMode.INFERRED