or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

configuration.mdcore-framework.mdfiltering.mdindex.mdlifecycle.mdselection.md
tile.json

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

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.junit.platform/junit-platform-suite-api@1.12.x

To install, run

npx @tessl/cli install tessl/maven-org-junit-platform--junit-platform-suite-api@1.12.0

index.mddocs/

JUnit Platform Suite API

JUnit Platform Suite API provides a comprehensive set of annotations for creating and configuring test suites on the JUnit Platform. It enables declarative test suite configuration with flexible test selection, advanced filtering, and extensive configuration capabilities for organizing and executing collections of tests across the JUnit Platform ecosystem.

Package Information

  • Package Name: org.junit.platform:junit-platform-suite-api
  • Package Type: maven
  • Language: Java
  • Installation:
    <dependency>
      <groupId>org.junit.platform</groupId>
      <artifactId>junit-platform-suite-api</artifactId>
      <version>1.12.2</version>
    </dependency>

Core Imports

import org.junit.platform.suite.api.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.SelectPackages;
import org.junit.platform.suite.api.IncludeTags;
import org.junit.platform.suite.api.ExcludeTags;

Basic Usage

import org.junit.platform.suite.api.*;

@Suite
@SelectPackages("com.example.tests")
@IncludeTags("integration")
@ExcludeTags("slow")
@SuiteDisplayName("Integration Test Suite")
public class IntegrationTestSuite {
    // Suite configuration through annotations only
    
    @BeforeSuite
    static void setUp() {
        // Optional setup before all tests in suite
        System.out.println("Starting integration tests");
    }
    
    @AfterSuite
    static void tearDown() {
        // Optional cleanup after all tests in suite
        System.out.println("Integration tests completed");
    }
}

Architecture

The JUnit Platform Suite API is built around several key architectural components:

  • Annotation-Driven Configuration: All suite configuration is done through annotations applied to suite classes
  • Test Selection Engine: Sophisticated test selection using various criteria (classes, packages, methods, files, resources, etc.)
  • Filtering System: Powerful include/exclude filtering based on engines, packages, tags, and class name patterns
  • Configuration Management: Support for configuration parameters from annotations, resources, and parent discovery requests
  • Lifecycle Integration: Suite-level setup and teardown capabilities with @BeforeSuite and @AfterSuite
  • JUnit Platform Integration: Seamless integration with JUnit Platform's discovery and execution engines

Capabilities

Core Suite Framework

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

@Suite
public @interface Suite {
    boolean failIfNoTests() default true;
}

@SuiteDisplayName("Custom Display Name")
public @interface SuiteDisplayName {
    String value();
}

Core Suite Framework

Suite Lifecycle Management

Annotations for controlling execution flow with setup and teardown methods that run before and after all tests in a suite.

@BeforeSuite
static void setUp() { /* setup logic */ }

@AfterSuite  
static void tearDown() { /* cleanup logic */ }

Suite Lifecycle

Test Selection

Comprehensive test selection capabilities supporting classes, packages, methods, files, resources, directories, modules, and URIs with flexible selector syntax.

@SelectClasses({TestClass1.class, TestClass2.class})
@SelectPackages({"com.example.unit", "com.example.integration"})
@SelectMethod(type = MyTest.class, name = "testMethod")
@Select({"class:com.example.TestClass", "method:com.example.TestClass#testMethod"})

Test Selection

Test Filtering

Advanced filtering system for including and excluding tests based on engines, packages, tags, and class name patterns with support for complex tag expressions.

@IncludeEngines({"junit-jupiter", "junit-vintage"})
@ExcludeEngines("junit-platform-suite")
@IncludeTags({"unit", "integration"})
@ExcludeTags({"slow | flaky"})
@IncludeClassNamePatterns(".*Test")
@ExcludeClassNamePatterns(".*IT")

Test Filtering

Configuration Management

Configuration parameter management with support for inline parameters, properties files, and inheritance control from parent discovery requests.

@ConfigurationParameter(key = "junit.jupiter.displayname.generator.default", 
                       value = "org.junit.jupiter.api.DisplayNameGenerator$ReplaceUnderscores")
@ConfigurationParametersResource("/test-config.properties")
@DisableParentConfigurationParameters

Configuration

Types

// Container annotations for repeatable annotations
public @interface Selects {
    Select[] value();
}

public @interface SelectFiles {
    SelectFile[] value();
}

public @interface SelectClasspathResources {
    SelectClasspathResource[] value();
}

public @interface SelectMethods {
    SelectMethod[] value();
}

public @interface ConfigurationParameters {
    ConfigurationParameter[] value();
}

public @interface ConfigurationParametersResources {
    ConfigurationParametersResource[] value();
}

// Deprecated annotation
@Deprecated
@API(status = DEPRECATED, since = "1.8")
public @interface UseTechnicalNames {
}