Created
November 22, 2015 16:44
-
-
Save ttddyy/6ebe7044a37aadd6febb to your computer and use it in GitHub Desktop.
launcher to run junit5 tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.springframework.test.context.junit5; | |
import org.junit.gen5.console.ColoredPrintingTestListener; | |
import org.junit.gen5.engine.TestPlanSpecification; | |
import org.junit.gen5.launcher.Launcher; | |
import org.junit.gen5.launcher.listeners.SummaryCreatingTestListener; | |
import org.junit.gen5.launcher.listeners.TestExecutionSummary; | |
import java.io.PrintWriter; | |
/** | |
* @author Tadaya Tsuyukubo | |
*/ | |
public class SpringExtensionTestsLauncher { | |
public static void main(String[] args) { | |
Launcher launcher = new Launcher(); | |
TestPlanSpecification testPlanSpecification = TestPlanSpecification.build( | |
TestPlanSpecification.forPackage("org.springframework.test.context.junit5") | |
); | |
TestExecutionSummary summary = new TestExecutionSummary(); | |
launcher.registerTestPlanExecutionListeners(new SummaryCreatingTestListener(summary)); | |
launcher.registerTestPlanExecutionListeners(new ColoredPrintingTestListener(System.out, false)); | |
launcher.execute(testPlanSpecification); | |
try (PrintWriter writer = new PrintWriter(System.out)) { | |
summary.printFailuresOn(writer); | |
summary.printOn(writer); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment