Annotation Interface RetryTest


JUnit annotation to mark a test method for retry on failure.

When a test fails, it will be retried up to the specified number of times.

This annotation automatically includes the RetryExtension, so no additional @ExtendWith annotation is required.

Usage example:

 @RetryTest(3)
 void unstableTest() {
     // Test code that might fail intermittently
 }
Since:
1.0
Author:
Erik C. Thauvin
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Optional name for the test template.
    int
    The maximum number of retry attempts for a failing test.
  • Element Details

    • name

      String name
      Optional name for the test template. If not specified, a default name will be generated.
      Returns:
      the display name for the retry test template
      Default:
      ""
    • value

      int value
      The maximum number of retry attempts for a failing test.

      The test will be executed at most (value + 1) times in total.

      Returns:
      the number of retry attempts. Must be greater than 0
      Default:
      3