Close

JUnit 5 - JUnit Platform Suite Engine Introduction

[Last Updated: Dec 18, 2025]

The JUnit Platform Suite Engine is a powerful extension to JUnit 5 that allows you to compose and execute custom test suites. It provides a flexible way to aggregate tests from different sources, apply filters, and create organized test execution plans.

What is Suite Engine?

The Suite Engine enables you to create test suites that can include tests from multiple classes, packages, or even different test engines. It's particularly useful for organizing integration tests, smoke tests, or any scenario where you need to group tests across different modules or components.

Key Benefits

  • Test Organization: Group related tests across different packages and classes
  • Selective Execution: Choose specific tests using various selection criteria
  • Filtering: Include or exclude tests based on patterns, tags, or engines
  • Cross-Module Testing: Combine tests from different modules or projects
  • Custom Configuration: Tailor test suites for different environments or purposes

Core Annotations

The Suite Engine provides several annotations for suite configuration:

  • @Suite: Marks a class as a test suite
  • @SelectPackages: Selects packages to include in the suite
  • @SelectClasses: Selects specific test classes
  • @IncludePackages / @ExcludePackages: Filter packages
  • @IncludeClassNamePatterns / @ExcludeClassNamePatterns: Filter by class name patterns
  • @SuiteDisplayName: Provides a custom display name for the suite
  • @IncludeEngines / @ExcludeEngines: Filter by test engines
  • @IncludeTags / @ExcludeTags: Filter by test tags
  • @UseTechnicalNames: Use technical names instead of display names

Dependencies

To use the Suite Engine, you need to include the JUnit Platform Suite API dependency:

 <dependency>
     <groupId>org.junit.jupiter</groupI
     <artifactId>junit-jupiter-engine</artifactId>
     <version>6.0.0</version>
     <scope>test</scope>
  </dependency>

Java source and doc

Definition of Suite

Version: 6.0.0
 package org.junit.platform.suite.api;
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.TYPE)
 @Inherited
 @Documented
 @API(status = STABLE, since = "1.10")
 @Testable
 public @interface Suite {
     @API(status = STABLE, since = "1.11")
     boolean failIfNoTests() default true; 1
 }
1Fail suite if no tests were discovered. (Since 1.9)

See Also