Annotation Interface Suite


@Suite marks a class as a test suite on the JUnit Platform.

Selector and filter annotations are used to control the contents of the suite. Additionally, configuration can be passed to the suite via the configuration annotations.

When the @IncludeClassNamePatterns annotation is not present, the default include pattern "^(Test.*|.+[.$]Test.*|.*Tests?)$" will be used in order to avoid loading classes unnecessarily (see ClassNameFilter#STANDARD_INCLUDE_PATTERN).

By default a suite discovers tests using the configuration parameters explicitly configured by @ConfigurationParameter and the configuration parameters from the discovery request that discovered the suite. Annotating a suite with @DisableParentConfigurationParameters disables the latter as a source of parameters so that only explicit configuration parameters are taken into account.

Note: Depending on the declared selectors, different suites may contain the same tests, potentially with different configurations. Moreover, tests in a suite are executed in addition to the tests executed by every other test engine, which can result in the same tests being executed twice. To prevent that, configure your build tool to include only the junit-platform-suite engine, or use a custom naming pattern. For example, name all suites *Suite and all tests *Test, and configure your build tool to include only the former. Alternatively, consider using tags to select specific groups of tests.

Since:
1.8
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Fail suite if no tests were discovered.
  • Element Details

    • failIfNoTests

      @API(status=STABLE, since="1.11") boolean failIfNoTests
      Fail suite if no tests were discovered.
      Since:
      1.9
      Default:
      true