Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3e948e6
Delete deprecated `MethodOrderer.Alphanumeric`
marcphilipp May 8, 2025
d72c11d
Delete deprecated `InvocationInterceptor.interceptDynamicTest`
marcphilipp May 8, 2025
99c612d
Delete deprecated `ReflectionSupport.loadClass`
marcphilipp May 8, 2025
9b63b10
Delete deprecated `ReflectionUtils.readFieldValue`
marcphilipp May 8, 2025
a441615
Delete deprecated `BlacklistedExceptions`
marcphilipp May 8, 2025
3513a3b
Delete deprecated `PreconditionViolationException`
marcphilipp May 8, 2025
8570b54
Delete deprecated `ReflectionUtils.getMethod`
marcphilipp May 8, 2025
c5447d7
Delete deprecated `ClasspathScanningSupport`
marcphilipp May 8, 2025
2b1bd49
Delete deprecated `ConfigurationParameters.size()`
marcphilipp May 8, 2025
f98fdd1
Delete deprecated `MethodSelector.getMethodParameterTypes()`
marcphilipp May 8, 2025
f727bfb
Delete deprecated `NestedMethodSelector.getMethodParameterTypes()`
marcphilipp May 8, 2025
b48ab70
Make deprecated `ReportEntry` constructor `private`
marcphilipp May 8, 2025
ac5b643
Delete deprecated `SingleTestExecutor`
marcphilipp May 8, 2025
7a7e492
Make deprecated `LauncherDiscoveryRequestBuilder` constructor `private`
marcphilipp May 8, 2025
ab67cf7
Delete deprecated `LegacyReportingUtils`
marcphilipp May 8, 2025
a18aae2
Delete deprecated `TestPlan` methods
marcphilipp May 8, 2025
3338c8e
Delete deprecated `junit-platform-runner` module
marcphilipp May 8, 2025
c932f0e
Delete deprecated `@UseTechnicalNames` annotation
marcphilipp May 8, 2025
0db3763
Delete deprecated methods in `EngineTestKit`
marcphilipp May 8, 2025
a75e4fa
Remove support for deprecated `junit.jupiter.tempdir.scope` config param
marcphilipp May 8, 2025
dac8035
Restore `TestPlan.getTestIdentifier(String)` because it's used by Gradle
marcphilipp May 8, 2025
5845fc2
Document minimum required version of Maven Surefire
marcphilipp May 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ val platformProjects by extra(listOf(
projects.junitPlatformJfr,
projects.junitPlatformLauncher,
projects.junitPlatformReporting,
projects.junitPlatformRunner,
projects.junitPlatformSuite,
projects.junitPlatformSuiteApi,
projects.junitPlatformSuiteCommons,
Expand Down
1 change: 0 additions & 1 deletion documentation/documentation.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ dependencies {

testImplementation(projects.junitJupiterMigrationsupport)
testImplementation(projects.junitPlatformConsole)
testImplementation(projects.junitPlatformRunner)
testImplementation(projects.junitPlatformSuite)
testImplementation(projects.junitPlatformTestkit)
testImplementation(projects.junitVintageEngine)
Expand Down
1 change: 0 additions & 1 deletion documentation/src/docs/asciidoc/link-attributes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ endif::[]
:ClassOrderer: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/ClassOrderer.html[ClassOrderer]
:ClassTemplate: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/ClassTemplate.html[@ClassTemplate]
:Disabled: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/Disabled.html[@Disabled]
:MethodOrderer_Alphanumeric: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/MethodOrderer.Alphanumeric.html[MethodOrderer.Alphanumeric]
:MethodOrderer_DisplayName: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/MethodOrderer.DisplayName.html[MethodOrderer.DisplayName]
:MethodOrderer_MethodName: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/MethodOrderer.MethodName.html[MethodOrderer.MethodName]
:MethodOrderer_OrderAnnotation: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/MethodOrderer.OrderAnnotation.html[MethodOrderer.OrderAnnotation]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,30 @@ repository on GitHub.
subcommand.
* Remove support for deprecated non-conventional `ConsoleLauncher` options such as
`--h` (rather than `-h`) or `-help` (rather than `--help`).
* The `junit-platform-runner` module that provided the `JUnitPlatform` runner has been
discontinued.
* Support for Maven Surefire/Failsafe versions < 3.0.0 has been dropped.
* The following deprecated APIs have been removed:
- `ReflectionSupport.loadClass(String)` method
- `ReflectionUtils.readFieldValue(...)` methods
- `ReflectionUtils.getMethod(...)` method
- `BlacklistedExceptions` class
- `PreconditionViolationException` class (from `org.junit.platform.commons.util`)
- `ClasspathScanningSupport` class
- `ConfigurationParameters.size()` method
- `MethodSelector.getMethodParameterTypes()` method
- `NestedMethodSelector.getMethodParameterTypes()` method
- `ReportEntry()` constructor
- `SingleTestExecutor` class
- `LauncherDiscoveryRequestBuilder()` constructor
- `LegacyReportingUtils` class
- `TestPlan.add(TestIdentifier)`, `TestPlan.getChildren(String)`, and
`TestPlan.getTestIdentifier(String)` methods
- `TestPlan.add(TestIdentifier)` and `TestPlan.getChildren(String)` methods
- `@UseTechnicalNames` annotation
- `EngineTestKit.execute(String, EngineDiscoveryRequest)`,
`EngineTestKit.execute(TestEngine, EngineDiscoveryRequest)`, and
`EngineTestKit.Builder.filters(...)` methods

[[release-notes-6.0.0-M1-junit-platform-new-features-and-improvements]]
==== New Features and Improvements
Expand All @@ -63,7 +87,11 @@ repository on GitHub.
[[release-notes-6.0.0-M1-junit-jupiter-deprecations-and-breaking-changes]]
==== Deprecations and Breaking Changes

* ❓
* The following deprecated APIs have been removed:
- `MethodOrderer.Alphanumeric` class
- `InvocationInterceptor.interceptDynamicTest(Invocation, ExtensionContext)` method
* The deprecated `junit.jupiter.tempdir.scope` configuration parameter is no longer
supported.

[[release-notes-6.0.0-M1-junit-jupiter-new-features-and-improvements]]
==== New Features and Improvements
Expand Down
3 changes: 0 additions & 3 deletions documentation/src/docs/asciidoc/user-guide/appendix.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ Please refer to the corresponding sections for <<running-tests-build-maven-bom,
`junit-platform-reporting`::
`TestExecutionListener` implementations that generate test reports -- typically used
by IDEs and build tools. See <<junit-platform-reporting>> for details.
`junit-platform-runner`::
Runner for executing tests and test suites on the JUnit Platform in a JUnit 4
environment. See <<running-tests-junit-platform-runner>> for details.
`junit-platform-suite`::
JUnit Platform Suite artifact that transitively pulls in dependencies on
`junit-platform-suite-api` and `junit-platform-suite-engine` for simplified dependency
Expand Down
144 changes: 4 additions & 140 deletions documentation/src/docs/asciidoc/user-guide/running-tests.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ documentation.
==== Other IDEs

If you are using an editor or IDE other than one of those listed in the previous sections,
the JUnit team provides two alternative solutions to assist you in using JUnit 5. You can
use the <<running-tests-console-launcher>> manually -- for example, from the command line
-- or execute tests with a <<running-tests-junit-platform-runner,JUnit 4 based Runner>> if
your IDE has built-in support for JUnit 4.
and it doesn't support running tests on the JUnit Platform, you can use the
<<running-tests-console-launcher>> to run them from the command line.

[[running-tests-build]]
=== Build Support
Expand Down Expand Up @@ -320,27 +318,9 @@ for executing tests on the JUnit Platform. The `pom.xml` file in the
and can serve as a starting point for configuring your Maven build.

[WARNING]
.Use recent version of Maven Surefire/Failsafe to avoid interoperability issues
.Minimum required version of Maven Surefire/Failsafe
====
To avoid interoperability issues, it is recommended to use a recent version of Maven
Surefire/Failsafe (3.0.0 or later) because it automatically aligns the version of the
JUnit Platform Launcher that is used with the JUnit Platform version found on the test
runtime classpath.

If you are using a version older than 3.0.0-M4, you can work around the missing alignment
by adding a test dependency on the matching version of the JUnit Platform Launcher to your
Maven build as follows.

[source,xml]
[subs=attributes+]
----
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>{version}</version>
<scope>test</scope>
</dependency>
----
As of JUnit 6.0, the minimum required version of Maven Surefire/Failsafe is 3.0.0.
====

[[running-tests-build-maven-bom]]
Expand Down Expand Up @@ -854,122 +834,6 @@ DYNAMIC = 35
REPORTED = 37
----


[[running-tests-junit-platform-runner]]
=== Using JUnit 4 to run the JUnit Platform

[WARNING]
.The `JUnitPlatform` runner has been deprecated
====
The `JUnitPlatform` runner was developed by the JUnit team as an interim solution for
running test suites and tests on the JUnit Platform in a JUnit 4 environment.

In recent years, all mainstream build tools and IDEs provide built-in support for running
tests directly on the JUnit Platform.

In addition, the introduction of `@Suite` support provided by the
`junit-platform-suite-engine` module makes the `JUnitPlatform` runner obsolete. See
<<junit-platform-suite-engine>> for details.

The `JUnitPlatform` runner and `@UseTechnicalNames` annotation have therefore been
deprecated in JUnit Platform 1.8 and will be removed in JUnit Platform 2.0.

If you are using the `JUnitPlatform` runner, please migrate to the `@Suite` support.
====

The `JUnitPlatform` runner is a JUnit 4 based `Runner` which enables you to run any test
whose programming model is supported on the JUnit Platform in a JUnit 4 environment --
for example, a JUnit Jupiter test class.

Annotating a class with `@RunWith(JUnitPlatform.class)` allows it to be run with IDEs and
build systems that support JUnit 4 but do not yet support the JUnit Platform directly.

NOTE: Since the JUnit Platform has features that JUnit 4 does not have, the runner is
only able to support a subset of the JUnit Platform functionality, especially with regard
to reporting (see <<running-tests-junit-platform-runner-technical-names>>).

[[running-tests-junit-platform-runner-setup]]
==== Setup

You need the following artifacts and their dependencies on the classpath. See
<<dependency-metadata>> for details regarding group IDs, artifact IDs, and versions.

[[running-tests-junit-platform-runner-setup-explicit-dependencies]]
===== Explicit Dependencies

* `junit-platform-runner` in _test_ scope: location of the `JUnitPlatform` runner
* `junit-{junit4-version}.jar` in _test_ scope: to run tests using JUnit 4
* `junit-jupiter-api` in _test_ scope: API for writing tests using JUnit Jupiter,
including `@Test`, etc.
* `junit-jupiter-engine` in _test runtime_ scope: implementation of the `TestEngine` API
for JUnit Jupiter

[[running-tests-junit-platform-runner-setup-transitive-dependencies]]
===== Transitive Dependencies

* `junit-platform-suite-api` in _test_ scope
* `junit-platform-suite-commons` in _test_ scope
* `junit-platform-launcher` in _test_ scope
* `junit-platform-engine` in _test_ scope
* `junit-platform-commons` in _test_ scope
* `opentest4j` in _test_ scope

[[running-tests-junit-platform-runner-technical-names]]
==== Display Names vs. Technical Names

To define a custom _display name_ for the class run via `@RunWith(JUnitPlatform.class)`
annotate the class with `@SuiteDisplayName` and provide a custom value.

By default, _display names_ will be used for test artifacts; however, when the
`JUnitPlatform` runner is used to execute tests with a build tool such as Gradle or
Maven, the generated test report often needs to include the _technical names_ of test
artifacts — for example, fully qualified class names — instead of shorter display names
like the simple name of a test class or a custom display name containing special
characters. To enable technical names for reporting purposes, declare the
`@UseTechnicalNames` annotation alongside `@RunWith(JUnitPlatform.class)`.

Note that the presence of `@UseTechnicalNames` overrides any custom display name
configured via `@SuiteDisplayName`.

[[running-tests-junit-platform-runner-single-test]]
==== Single Test Class

One way to use the `JUnitPlatform` runner is to annotate a test class with
`@RunWith(JUnitPlatform.class)` directly. Please note that the test methods in the
following example are annotated with `org.junit.jupiter.api.Test` (JUnit Jupiter), not
`org.junit.Test` (JUnit 4). Moreover, in this case the test class must be `public`;
otherwise, some IDEs and build tools might not recognize it as a JUnit 4 test class.

[source,java,indent=0]
----
include::{testDir}/example/JUnitPlatformClassDemo.java[tags=user_guide]
----

[[running-tests-junit-platform-runner-test-suite]]
==== Test Suite

If you have multiple test classes you can create a test suite as can be seen in the
following example.

[source,java,indent=0]
----
include::{testDir}/example/JUnitPlatformSuiteDemo.java[tags=user_guide]
----

The `JUnitPlatformSuiteDemo` will discover and run all tests in the `example` package and
its subpackages. By default, it will only include test classes whose names either begin
with `Test` or end with `Test` or `Tests`.

.Additional Configuration Options
NOTE: There are more configuration options for discovering and filtering tests than just
`@SelectPackages`. Please consult the Javadoc of the `{suite-api-package}` package for
further details.

WARNING: Test classes and suites annotated with `@RunWith(JUnitPlatform.class)`
**cannot** be executed directly on the JUnit Platform (or as a "JUnit 5" test as
documented in some IDEs). Such classes and suites can only be executed using JUnit 4
infrastructure.

[[running-tests-discovery-selectors]]
=== Discovery Selectors

Expand Down
13 changes: 2 additions & 11 deletions documentation/src/docs/asciidoc/user-guide/writing-tests.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -974,9 +974,6 @@ following built-in `MethodOrderer` implementations.
specified via the `{Order}` annotation
* `{MethodOrderer_Random}`: orders test methods _pseudo-randomly_ and supports
configuration of a custom _seed_
* `{MethodOrderer_Alphanumeric}`: sorts test methods _alphanumerically_ based on their
names and formal parameter lists; **deprecated in favor of `{MethodOrderer_MethodName}`,
to be removed in 6.0**

NOTE: See also: <<extensions-execution-order-wrapping-behavior>>

Expand Down Expand Up @@ -1275,9 +1272,8 @@ include::{testDir}/example/TestInfoDemo.java[tags=user_guide]
method, respectively. This allows them to be viewed in IDEs or included in reports.
+
In JUnit Jupiter you should use `TestReporter` where you used to print information to
`stdout` or `stderr` in JUnit 4. Using `@RunWith(JUnitPlatform.class)` will output all
reported entries to `stdout`. In addition, some IDEs print report entries to `stdout` or
display them in the user interface for test results.
`stdout` or `stderr` in JUnit 4. Some IDEs print report entries to `stdout` or display
them in the user interface for test results.

[source,java,indent=0]
----
Expand Down Expand Up @@ -3525,11 +3521,6 @@ You can inject multiple temporary directories by specifying multiple annotated p
include::{testDir}/example/TempDirectoryDemo.java[tags=user_guide_multiple_directories]
----

WARNING: To revert to the old behavior of using a single temporary directory for the
entire test class or method (depending on which level the annotation is used), you can set
the `junit.jupiter.tempdir.scope` configuration parameter to `per_context`. However,
please note that this option is deprecated and will be removed in a future release.

The following example stores a _shared_ temporary directory in a `static` field. This
allows the same `sharedTempDir` to be used in all lifecycle methods and test methods of
the test class. For better isolation, you should use an instance field or constructor
Expand Down
4 changes: 0 additions & 4 deletions documentation/src/plantuml/component-diagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ package org.junit.platform {
[junit-platform-jfr] as jfr
[junit-platform-launcher] as launcher
[junit-platform-reporting] as reporting
[junit-platform-runner] as runner
[junit-platform-suite] as suite
[junit-platform-suite-api] as suite_api
[junit-platform-suite-commons] as suite_commons
Expand Down Expand Up @@ -83,9 +82,6 @@ engine ..> commons
reporting ..> launcher
reporting ......> otr_tooling_spi

runner ..> suite_commons
runner ...> junit4

suite ..> suite_api
suite ..> suite_engine

Expand Down
39 changes: 0 additions & 39 deletions documentation/src/test/java/example/JUnitPlatformClassDemo.java

This file was deleted.

27 changes: 0 additions & 27 deletions documentation/src/test/java/example/JUnitPlatformSuiteDemo.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package org.junit.jupiter.api;

import static java.util.Comparator.comparingInt;
import static org.apiguardian.api.API.Status.DEPRECATED;
import static org.apiguardian.api.API.Status.STABLE;

import java.lang.reflect.Method;
Expand Down Expand Up @@ -126,26 +125,6 @@ default Optional<ExecutionMode> getDefaultExecutionMode() {
return Optional.of(ExecutionMode.SAME_THREAD);
}

/**
* {@code MethodOrderer} that sorts methods alphanumerically based on their
* names using {@link String#compareTo(String)}.
*
* <p>If two methods have the same name, {@code String} representations of
* their formal parameter lists will be used as a fallback for comparing the
* methods.
*
* @since 5.4
* @deprecated as of JUnit Jupiter 5.7 in favor of {@link MethodOrderer.MethodName};
* to be removed in 6.0
*/
@API(status = DEPRECATED, since = "5.7")
@Deprecated
class Alphanumeric extends MethodName {

public Alphanumeric() {
}
}

/**
* {@code MethodOrderer} that sorts methods alphanumerically based on their
* names using {@link String#compareTo(String)}.
Expand Down
Loading