How junit-team/junit-framework works
1. This is a monorepo for the JUnit ecosystem, split into three major product lines: JUnit Platform, JUnit Jupiter, and JUnit Vintage. The codebase is organized as many Gradle subprojects, with modules published independently and tied together by a shared build, BOM, docs, and compatibility test suites.
2. The lowest architectural layer is junit-platform-commons. It contains shared utilities used everywhere else: reflection and classpath scanning, annotation handling, conversion helpers, resource access, logging, string utilities, and precondition/error types. This module is the common dependency boundary for most other modules.
3. The Platform execution kernel lives in junit-platform-engine. It defines the engine SPI and core model: TestEngine, TestDescriptor, UniqueId, selectors, discovery filters, execution results, reporting types, and the hierarchical execution support used by engines. Engines build descriptor trees during discovery and execute them through the hierarchical executor infrastructure.
4. junit-platform-launcher is the orchestration layer above engines. It aggregates discovery requests, applies filters and listeners, coordinates engine discovery/execution, manages launcher sessions, handles tag expressions and method filters, and adapts engine events into TestExecutionListener callbacks. This is the main entry point used by IDEs, build tools, and command-line tools.
5. junit-platform-console is a CLI and ToolProvider wrapper around the launcher. It translates command-line options into discovery/execution requests, loads test engines via service discovery, and renders results in different output styles. The console layer is how the platform is exposed as a standalone executable tool.
6. junit-platform-reporting sits on the listener side of the launcher and turns execution events into reports. It contains both legacy XML reporting and the newer Open Test Reporting implementation, with service-loader registrations so it can be attached automatically during execution. This module is a post-processing boundary: it does not run tests, it consumes launcher events.
7. junit-platform-suite-api and junit-platform-suite-engine provide test-suite composition. The API defines annotations such as suite selectors, inclusion/exclusion filters, and lifecycle hooks; the suite engine interprets those annotations, creates discovery selectors, and delegates actual test execution to other engines. This is the bridge between “suite definition” and “engine execution.”
8. junit-platform-testkit is a verification tool for engines and launcher behavior. It provides in-process assertions over discovery results, execution events, event statistics, and termination state, and is used heavily by the repo’s own tests to validate engine and launcher behavior.
9. junit-jupiter-api is the user-facing programming model for writing tests. It includes assertions, assumptions, lifecycle annotations, display names, dynamic/repeated/parameterized test support, conditions, extensions, temp directory and parallel-execution APIs, plus Kotlin support in src/main/kotlin. It is the contract that test classes and extensions program against.
10. junit-jupiter-engine is the runtime that discovers and executes Jupiter tests. It translates Jupiter annotations into engine descriptors, applies extension registration and parameter resolution, manages test instances and lifecycle callbacks, and handles features like nested tests, test templates, repeated tests, timeouts, and dynamic tests. This module is the core implementation behind the Jupiter programming model.
11. junit-jupiter-params is a specialized Jupiter extension module for parameterized tests and parameterized classes. It adds argument providers, converters, aggregators, invocation name formatting, and the resolver pipeline that injects argument values into test methods and class templates. It depends on the Jupiter engine infrastructure but adds its own discovery/execution extension points.
12. junit-jupiter-migrationsupport is a compatibility bridge for JUnit 4-era constructs. It adapts selected JUnit 4 rules and ignored conditions into Jupiter extensions, helping legacy tests move forward without rewriting everything at once.
13. junit-vintage-engine is the adapter for running JUnit 3 and JUnit 4 tests on the JUnit Platform. It discovers legacy test classes, wraps runners/descriptions into platform descriptors, and executes them through the platform engine contract so Vintage tests appear alongside Jupiter tests in the same launcher flow.
14. junit-jupiter and junit-start are umbrella/entry modules. junit-jupiter is the aggregate dependency for the Jupiter stack, while junit-start provides a minimal bootstrapping entry point for users who want a simple runtime start class rather than the full platform API surface.
15. The repository is heavily self-tested through dedicated integration suites: jupiter-tests, platform-tests, and platform-tooling-support-tests. These projects exercise cross-module behavior, Kotlin/Groovy interoperability, console output snapshots, build-tool integrations, reporting formats, and launch/execution edge cases. They are as important to the architecture as the production modules because they validate the contracts between modules.
16. Build and packaging are first-class architectural concerns. The project uses Gradle Kotlin DSL, Java modules (module-info.java), service-loader registrations under META-INF/services, JMH benchmarks in selected modules, and generated sources/templates in a few places. Documentation is also a structured subsystem via Antora, with examples and executable snippets that mirror the API/engine split.
Main entry points: platform-tests.gradle.kts Platform tests · launcher/package-info.java Launcher · engine/package-info.java Platform engine · platform-tooling-support-tests.gradle.kts Tooling tests
Components 20
JUnit Platform
Shared engine, launcher, reporting, suite, console, and testkit layers.
- Platform commons · Reflection, scanning, annotation, resource, logging, conversion, and utility boundary.
junit-platform-commons/src/main/java/org/junit/platform/commons/package-info.java - Platform engine · Core test engine SPI, descriptor model, selectors, discovery, reporting, and hierarchical execution support.
junit-platform-engine/src/main/java/org/junit/platform/engine/package-info.java - Launcher · Coordinates discovery, filtering, sessions, listeners, and engine execution.
junit-platform-launcher/src/main/java/org/junit/platform/launcher/package-info.java - Console · Command-line and ToolProvider entry point built on the launcher.
junit-platform-console/src/main/java/org/junit/platform/console/ConsoleLauncher.java - Reporting · Consumes launcher events and produces XML and Open Test Reporting outputs.
junit-platform-reporting/src/main/java/org/junit/platform/reporting/package-info.java - Suite API · Annotations and selectors for suite definition and filtering.
junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/package-info.java - Suite engine · Interprets suite annotations, builds selectors, and delegates to other engines.
junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestEngine.java - TestKit · In-process assertions over discovery results, execution events, and termination state.
junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineTestKit.java
JUnit Jupiter
Jupiter API, engine, parameters, migration support, and umbrella modules.
- Jupiter API · Assertions, assumptions, lifecycle, extensions, parameterized and parallel-test APIs.
junit-jupiter-api/src/main/java/org/junit/jupiter/api/package-info.java - Jupiter engine · Discovers and executes Jupiter tests, lifecycle callbacks, extensions, templates, and dynamic tests.
junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/JupiterTestEngine.java - Params · Parameterized tests and classes, argument providers, converters, aggregators, and invocation resolution.
junit-jupiter-params/src/main/java/org/junit/jupiter/params/package-info.java - Migration support · Bridges selected JUnit 4 rules and ignore behavior into Jupiter.
junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/package-info.java - Jupiter umbrella · Aggregate dependency for the Jupiter stack.
junit-jupiter/src/main/java/module-info.java - JUnit Start · Minimal runtime entry point for simple startup use cases.
junit-start/src/main/java/org/junit/start/JUnit.java
JUnit Vintage
Adapters for JUnit 3/4 execution on the platform.
- Vintage engine · Runs JUnit 3 and JUnit 4 tests on the JUnit Platform.
junit-vintage-engine/src/main/java/org/junit/vintage/engine/VintageTestEngine.java
Build & docs
Gradle build, documentation, and cross-module verification suites.
- Gradle build · Shared Gradle Kotlin DSL build that wires the monorepo and publishing.
build.gradle.kts - BOM · Bill of materials for coordinated dependency consumption.
junit-bom/junit-bom.gradle.kts - Docs site · Antora-based documentation, examples, and executable snippets.
documentation/antora-playbook.yml - Platform tests · Cross-module tests for platform, launcher, console, reporting, suite, and testkit behavior.
platform-tests/platform-tests.gradle.kts - Tooling tests · External tool and packaging compatibility tests for starter projects and launchers.
platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts
Connections 33
- Gradle build → BOM: publishes · Build defines the BOM and release artifacts.
- Gradle build → Docs site: drives · Build generates and validates documentation.
- Gradle build → Platform tests: runs · Build orchestrates cross-module verification suites.
- Gradle build → Tooling tests: runs · Build orchestrates external tooling compatibility suites.
- Platform commons → Platform engine: shared by · Engine depends on common utilities and support code.
- Platform commons → Launcher: shared by · Launcher relies on common utilities and support code.
- Platform engine → Launcher: executes under · Launcher discovers and executes engines through the engine SPI.
- Launcher → Console: fronted by · Console wraps launcher discovery and execution.
- Launcher → Reporting: emits events to · Reporting attaches as launcher listeners.
- Suite API → Suite engine: interpreted by · Suite engine reads suite annotations and selectors from the API.
- Suite engine → Launcher: orchestrated by · Suite execution happens through the launcher flow.
- Suite engine → Platform engine: delegates to · Suite engine delegates actual test execution to other engines.
- TestKit → Launcher: observes · TestKit asserts launcher behavior and emitted events.
- Jupiter API → Jupiter engine: implemented by · Engine realizes the Jupiter programming model.
- Jupiter API → Params: extended by · Parameterized support extends the Jupiter API model.
- Jupiter engine → Platform engine: implements SPI · Jupiter engine is a platform engine implementation.
- Params → Jupiter engine: hooks into · Parameterized features plug into Jupiter execution.
- Migration support → Jupiter engine: adapts to · Migration support attaches as Jupiter extensions.
- Jupiter umbrella → Jupiter API: aggregates · Umbrella module bundles the Jupiter API.
- Jupiter umbrella → Jupiter engine: aggregates · Umbrella module bundles the Jupiter engine.
- JUnit Start → Launcher: boots · Startup entry bridges to platform launching.
- Vintage engine → Platform engine: implements SPI · Vintage is a platform engine implementation.
- Platform tests → Platform commons: validates · Platform tests cover shared utility contracts.
- Platform tests → Platform engine: validates · Platform tests cover engine SPI and descriptor behavior.
- Platform tests → Launcher: validates · Platform tests cover launcher orchestration and filters.
- Platform tests → Console: validates · Platform tests cover console output and command flow.
- Platform tests → Reporting: validates · Platform tests cover legacy and open reporting.
- Platform tests → Suite engine: validates · Platform tests cover suite discovery and execution.
- Platform tests → TestKit: uses · Platform tests use the test kit to assert execution behavior.
- Tooling tests → Console: covers · Tooling tests cover console and packaging scenarios.
- Tooling tests → JUnit Start: covers · Tooling tests cover startup and distribution scenarios.
- Tooling tests → Vintage engine: covers · Tooling tests cover legacy integration scenarios.
- Tooling tests → Jupiter API: covers · Tooling tests cover Jupiter usage in starter projects.