I tried to run only one test class from Gradle. I used these commands:
gradle -Dtest.single=Junit5Test test
gradle test --tests ru.tests.runner.Junit5Test
But it runs all of the project's tests. I need to run only one test class. Here is my class:
public class Junit5Test {
public static void main(String[] args) {
LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
.selectors(
selectPackage("ru.tests.api")
)
.build();
Launcher launcher = LauncherFactory.create();
launcher.execute(request, new TestExecutionListener());
}
}
It works perfect by right-click run. I use
- IntellijIDEA 2017.1.5,
- Gradle,
- junitPlatformVersion = '1.0.0-M6',
- junitJupiterVersion = '5.0.0-M6'