Skip to content
Snippets Groups Projects
Commit a7f73935 authored by Vincent Massol's avatar Vincent Massol
Browse files

[Misc] Fix test failing because of XCOMMONS-1902: Provide environmental...

[Misc] Fix test failing because of XCOMMONS-1902: Provide environmental information when a test fails in the CI to help debug it
parent 5d1c85bb
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.platform.launcher.Launcher; import org.junit.platform.launcher.Launcher;
import org.junit.platform.launcher.LauncherDiscoveryRequest; import org.junit.platform.launcher.LauncherDiscoveryRequest;
import org.junit.platform.launcher.core.LauncherConfig;
import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder; import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder;
import org.junit.platform.launcher.core.LauncherFactory; import org.junit.platform.launcher.core.LauncherFactory;
import org.junit.platform.launcher.listeners.SummaryGeneratingListener; import org.junit.platform.launcher.listeners.SummaryGeneratingListener;
...@@ -141,7 +142,12 @@ void verifyConsoleExtension() throws Exception ...@@ -141,7 +142,12 @@ void verifyConsoleExtension() throws Exception
LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request() LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
.selectors(selectClass(SampleTestCase.class)) .selectors(selectClass(SampleTestCase.class))
.build(); .build();
Launcher launcher = LauncherFactory.create(); // Do not auto load TestExecutionListener since that would load our
// FailingTestDebuggingTestExecutionListener which would print things in the console since we test test
// failures in this test class, and in turn it would fail the test since we verify what's printed in the
// console...
LauncherConfig config = LauncherConfig.builder().enableTestExecutionListenerAutoRegistration(false).build();
Launcher launcher = LauncherFactory.create(config);
SummaryGeneratingListener summaryListener = new SummaryGeneratingListener(); SummaryGeneratingListener summaryListener = new SummaryGeneratingListener();
launcher.execute(request, summaryListener); launcher.execute(request, summaryListener);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment