CtrlK
BlogDocsLog inGet started
Tessl Logo

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

JUnit Platform Suite provides declarative test suite framework with annotations for creating and configuring comprehensive test suites on the JUnit 5 platform.

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

JUnit Platform Suite

JUnit Platform Suite provides a comprehensive framework for creating declarative test suites on the JUnit 5 platform. It enables developers to compose sophisticated test suites using annotations for test selection, filtering, configuration, and lifecycle management with powerful and flexible control over test discovery and execution.

Package Information

  • Package Name: org.junit.platform:junit-platform-suite
  • Package Type: Maven
  • Language: Java
  • Installation: Maven dependency or Gradle implementation
  • Module: org.junit.platform.suite (aggregates org.junit.platform.suite.api and org.junit.platform.suite.engine)

Core Imports

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

For specific capabilities:

// Configuration annotations
import org.junit.platform.suite.api.ConfigurationParameter;
import org.junit.platform.suite.api.BeforeSuite;
import org.junit.platform.suite.api.AfterSuite;

// Selection annotations
import org.junit.platform.suite.api.SelectMethod;
import org.junit.platform.suite.api.SelectFiles;
import org.junit.platform.suite.api.SelectDirectories;

// Filter annotations
import org.junit.platform.suite.api.IncludeClassNamePatterns;
import org.junit.platform.suite.api.ExcludeClassNamePatterns;
import org.junit.platform.suite.api.IncludeTags;
import org.junit.platform.suite.api.ExcludeTags;

Basic Usage

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

// Basic test suite with class selection
@Suite
@SelectClasses({UserTest.class, ProductTest.class, OrderTest.class})
class BasicSuite {
}

// Package-based suite with filtering
@Suite
@SelectPackages("com.example.integration")
@IncludeClassNamePatterns(".*IntegrationTest")
@ExcludeTags("slow")
class IntegrationSuite {
}

// Configuration with lifecycle
@Suite
@SelectPackages("com.example")
@ConfigurationParameter(key = "junit.jupiter.execution.parallel.enabled", value = "true")
@SuiteDisplayName("Parallel Test Suite")
class ParallelSuite {
    
    @BeforeSuite
    static void setupSuite() {
        // Suite initialization
        System.setProperty("test.environment", "suite");
    }
    
    @AfterSuite
    static void cleanupSuite() {
        // Suite cleanup
        System.clearProperty("test.environment");
    }
}

Architecture

JUnit Platform Suite is built around several key architectural components:

  • Suite Declaration: @Suite annotation marks classes as declarative test suites
  • Test Selection: Multiple @Select* annotations specify which tests to include using classes, packages, methods, files, URIs, modules, or directories
  • Filtering System: @Include* and @Exclude* annotations provide fine-grained control over test inclusion using class name patterns, packages, tags, and engines
  • Configuration Management: @ConfigurationParameter and @ConfigurationParametersResource annotations manage suite-specific configuration
  • Lifecycle Integration: @BeforeSuite and @AfterSuite annotations provide suite-level setup and teardown capabilities
  • Suite Engine: Internal SuiteTestEngine integrates with JUnit Platform launcher for execution

The framework supports both explicit selection (selecting specific classes/methods) and discovery-based selection (selecting packages with filters), enabling flexible test organization and execution strategies.

Capabilities

Core Suite Declaration

Primary @Suite annotation and suite configuration for declaring and configuring test suites with display names and failure policies.

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

@SuiteDisplayName
public @interface SuiteDisplayName {
    String value();
}

Core Suite Declaration

Test Selection

Comprehensive test selection capabilities including classes, packages, methods, files, directories, URIs, modules, and classpath resources with flexible selector parsing.

@SelectClasses
public @interface SelectClasses {
    Class<?>[] value() default {};
    String[] names() default {};
}

@SelectPackages
public @interface SelectPackages {
    String[] value();
}

@SelectMethod
public @interface SelectMethod {
    String value() default "";
    Class<?> type() default Class.class;
    String typeName() default "";
    String name() default "";
    Class<?>[] parameterTypes() default {};
    String parameterTypeNames() default "";
}

Test Selection

Test Filtering

Powerful filtering system for including and excluding tests based on class name patterns, packages, tags, and test engines with regex pattern matching and tag expressions.

@IncludeClassNamePatterns
public @interface IncludeClassNamePatterns {
    String[] value() default "^(Test.*|.+[.$]Test.*|.*Tests?)$";
}

@ExcludeClassNamePatterns  
public @interface ExcludeClassNamePatterns {
    String[] value();
}

@IncludeTags
public @interface IncludeTags {
    String[] value();
}

@ExcludeTags
public @interface ExcludeTags {
    String[] value();
}

Test Filtering

Configuration and Lifecycle

Suite configuration management through parameters and properties files, plus lifecycle hooks for suite setup and teardown operations.

@ConfigurationParameter
public @interface ConfigurationParameter {
    String key();
    String value();
}

@BeforeSuite
public @interface BeforeSuite {
}

@AfterSuite
public @interface AfterSuite {
}

@DisableParentConfigurationParameters
public @interface DisableParentConfigurationParameters {
}

Configuration and Lifecycle

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.junit.platform/junit-platform-suite@1.12.x
Publish Source
CLI
Badge
tessl/maven-org-junit-platform--junit-platform-suite badge