CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-junit-platform--junit-platform-suite-api

JUnit Platform Suite API provides annotations and configuration options for creating test suites with the JUnit Platform, including test selection, filtering, and configuration capabilities for organizing and executing collections of tests

Pending
Overview
Eval results
Files

core-framework.mddocs/

Core Suite Framework

Central annotations for defining and configuring test suites with display names and failure behavior control.

Capabilities

@Suite Annotation

The primary annotation that marks a class as a test suite on the JUnit Platform.

/**
 * Marks a class as a test suite on the JUnit Platform.
 * Selector and filter annotations control suite contents.
 * Configuration annotations provide additional parameters.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Inherited
@Documented
@API(status = STABLE, since = "1.10")
@Testable
public @interface Suite {
    /**
     * Fail suite if no tests were discovered.
     * @return true to fail when no tests found, false to allow empty suites
     * @since 1.9
     */
    @API(status = STABLE, since = "1.11")
    boolean failIfNoTests() default true;
}

Usage Examples:

// Basic suite - fails if no tests found
@Suite
@SelectPackages("com.example.tests")
public class BasicTestSuite {
}

// Suite that allows empty results
@Suite(failIfNoTests = false)
@SelectTags("optional")
public class OptionalTestSuite {
}

// Complex suite with multiple selectors and filters
@Suite
@SelectClasses({UnitTests.class, IntegrationTests.class})
@IncludeTags("smoke")
@ExcludeTags("slow")
@ConfigurationParameter(key = "parallel.execution", value = "true")
public class SmokeTestSuite {
}

@SuiteDisplayName Annotation

Declares a custom display name for test suite execution in IDEs and build tools.

/**
 * Declares a custom display name for test suite execution.
 * Display names are used for test reporting and may contain spaces, 
 * special characters, and emoji.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@API(status = MAINTAINED, since = "1.1")
public @interface SuiteDisplayName {
    /**
     * The custom display name for the suite.
     * @return custom display name; never blank or consisting solely of whitespace
     */
    String value();
}

Usage Examples:

@Suite
@SuiteDisplayName("🧪 Unit Test Suite")
@SelectPackages("com.example.unit")
public class UnitTestSuite {
}

@Suite  
@SuiteDisplayName("Integration Tests - Database Layer")
@SelectClasses({DatabaseIntegrationTest.class, RepositoryTest.class})
public class DatabaseIntegrationSuite {
}

@Suite
@SuiteDisplayName("Performance & Load Testing")
@IncludeTags("performance")
public class PerformanceTestSuite {
}

Suite Configuration Best Practices

Default Behavior

  • When @IncludeClassNamePatterns is not present, the default include pattern ^(Test.*|.+[.$]Test.*|.*Tests?)$ is used
  • By default, suites discover tests using both explicit configuration parameters and parameters from the parent discovery request
  • Suite classes themselves don't contain test methods - configuration is done through annotations only

Configuration Inheritance

  • Suites support configuration inheritance from parent discovery requests
  • Use @DisableParentConfigurationParameters to use only explicitly configured parameters
  • Multiple selector annotations can be combined for complex test selection

@UseTechnicalNames Annotation (Deprecated)

Specifies that technical names should be used instead of display names for test reporting.

/**
 * Specifies that technical names should be used instead of display names.
 * @deprecated since 1.8, in favor of @Suite support provided by 
 * junit-platform-suite-engine module; to be removed in JUnit Platform 2.0
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@API(status = DEPRECATED, since = "1.8")
@Deprecated
public @interface UseTechnicalNames {
}

Migration Path:

// DEPRECATED - Don't use this
@RunWith(JUnitPlatform.class)
@UseTechnicalNames
@SelectPackages("com.example")
public class OldStyleSuite {
}

// RECOMMENDED - Use @Suite instead
@Suite
@SelectPackages("com.example")
public class ModernSuite {
}

Important Notes:

  • This annotation is deprecated since JUnit Platform 1.8
  • It was used with @RunWith(JUnitPlatform.class) in JUnit 4 environments
  • Will be removed in JUnit Platform 2.0
  • Modern @Suite annotation provides equivalent functionality with better integration

Error Handling

  • When failIfNoTests() = true (default), suites will fail if no tests are discovered
  • Invalid configuration parameters or malformed selectors will cause suite failure
  • Tag expressions with invalid syntax will result in runtime errors

Install with Tessl CLI

npx tessl i tessl/maven-org-junit-platform--junit-platform-suite-api

docs

configuration.md

core-framework.md

filtering.md

index.md

lifecycle.md

selection.md

tile.json