diff --git a/documentation/src/docs/asciidoc/user-guide/advanced-topics/launcher-api.adoc b/documentation/src/docs/asciidoc/user-guide/advanced-topics/launcher-api.adoc index 9b4722dcd6b3..18c0b261e299 100644 --- a/documentation/src/docs/asciidoc/user-guide/advanced-topics/launcher-api.adoc +++ b/documentation/src/docs/asciidoc/user-guide/advanced-topics/launcher-api.adoc @@ -272,6 +272,6 @@ When running tests via the `{Launcher}` API, you can enable _dry-run mode_ by se `junit.platform.execution.dryRun.enabled` <> to `true`. In this mode, the `{Launcher}` will not actually execute any tests but will notify registered `{TestExecutionListener}` instances as if all -tests had been executed successfully. This can be useful to test changes in the -configuration of a build or to verify a listener is called as expected without having to -wait for all tests to be executed. +tests had been skipped and their containers had been successful. This can be useful to +test changes in the configuration of a build or to verify a listener is called as expected +without having to wait for all tests to be executed. diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java index af05c4ae86ee..7e85b35d1c53 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java @@ -153,11 +153,11 @@ public class LauncherConstants { * *

When dry-run mode is enabled, no tests will be executed. Instead, all * registered {@link TestExecutionListener TestExecutionListeners} will - * receive started/finished events for all test descriptors that are part - * of the discovered {@link TestPlan}. All tests will be reported as - * successful. This can be useful to test changes in the configuration of a - * build or to verify a listener is called as expected without having to - * wait for all tests to be executed. + * receive events for all test descriptors that are part of the discovered + * {@link TestPlan}. All containers will be reported as successful and all + * tests as skipped. This can be useful to test changes in the configuration + * of a build or to verify a listener is called as expected without having + * to wait for all tests to be executed. * *

Value must be either {@code true} or {@code false}; defaults to {@code false}. */ diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java index ed764199a3f6..bf0f78a7bde0 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java @@ -110,8 +110,7 @@ public void preVisitContainer(TestIdentifier testIdentifier) { @Override public void visit(TestIdentifier testIdentifier) { if (!testIdentifier.isContainer()) { - listener.executionStarted(testIdentifier); - listener.executionFinished(testIdentifier, TestExecutionResult.successful()); + listener.executionSkipped(testIdentifier, "JUnit Platform dry-run mode is enabled"); } } diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherTests.java index 0e39ae5e2d23..f5b777b4b71d 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherTests.java @@ -646,8 +646,7 @@ void dryRunModeReportsEventsForAllTestsButDoesNotExecuteThem() { inOrder.verify(listener).testPlanExecutionStarted(any()); inOrder.verify(listener).executionStarted(TestIdentifier.from(engine.getEngineDescriptor())); inOrder.verify(listener).executionStarted(TestIdentifier.from(container)); - inOrder.verify(listener).executionStarted(TestIdentifier.from(test)); - inOrder.verify(listener).executionFinished(TestIdentifier.from(test), successful()); + inOrder.verify(listener).executionSkipped(TestIdentifier.from(test), "JUnit Platform dry-run mode is enabled"); inOrder.verify(listener).executionFinished(TestIdentifier.from(container), successful()); inOrder.verify(listener).executionFinished(TestIdentifier.from(engine.getEngineDescriptor()), successful()); inOrder.verify(listener).testPlanExecutionFinished(any());