Search in sources :

Example 6 with LauncherDiscoveryRequest

use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.

the class DiscoveryRequestCreatorTests method convertsEngineOptions.

@Test
void convertsEngineOptions() {
    options.setScanClasspath(true);
    options.setIncludedEngines(asList("engine1", "engine2", "engine3"));
    options.setExcludedEngines(singletonList("engine2"));
    LauncherDiscoveryRequest request = convert();
    List<EngineFilter> engineFilters = request.getEngineFilters();
    assertThat(engineFilters).hasSize(2);
    assertThat(engineFilters.get(0).toString()).contains("includes", "[engine1, engine2, engine3]");
    assertThat(engineFilters.get(1).toString()).contains("excludes", "[engine2]");
}
Also used : LauncherDiscoveryRequest(org.junit.platform.launcher.LauncherDiscoveryRequest) EngineFilter(org.junit.platform.launcher.EngineFilter) Test(org.junit.jupiter.api.Test)

Example 7 with LauncherDiscoveryRequest

use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.

the class DiscoveryRequestCreatorTests method convertsPackageSelectors.

@Test
void convertsPackageSelectors() {
    options.setSelectedPackages(asList("com.acme.foo", "com.example.bar"));
    LauncherDiscoveryRequest request = convert();
    List<PackageSelector> packageSelectors = request.getSelectorsByType(PackageSelector.class);
    assertThat(packageSelectors).extracting(PackageSelector::getPackageName).containsExactly("com.acme.foo", "com.example.bar");
}
Also used : LauncherDiscoveryRequest(org.junit.platform.launcher.LauncherDiscoveryRequest) PackageSelector(org.junit.platform.engine.discovery.PackageSelector) Test(org.junit.jupiter.api.Test)

Example 8 with LauncherDiscoveryRequest

use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.

the class DiscoveryRequestCreatorTests method convertsClassSelectors.

@Test
void convertsClassSelectors() {
    options.setSelectedClasses(asList("com.acme.Foo", "com.example.Bar"));
    LauncherDiscoveryRequest request = convert();
    List<ClassSelector> classSelectors = request.getSelectorsByType(ClassSelector.class);
    assertThat(classSelectors).extracting(ClassSelector::getClassName).containsExactly("com.acme.Foo", "com.example.Bar");
}
Also used : LauncherDiscoveryRequest(org.junit.platform.launcher.LauncherDiscoveryRequest) ClassSelector(org.junit.platform.engine.discovery.ClassSelector) Test(org.junit.jupiter.api.Test)

Example 9 with LauncherDiscoveryRequest

use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.

the class DiscoveryRequestCreatorTests method convertsFileSelectors.

@Test
void convertsFileSelectors() {
    options.setSelectedFiles(asList("foo.txt", "bar.csv"));
    LauncherDiscoveryRequest request = convert();
    List<FileSelector> fileSelectors = request.getSelectorsByType(FileSelector.class);
    assertThat(fileSelectors).extracting(FileSelector::getRawPath).containsExactly("foo.txt", "bar.csv");
}
Also used : LauncherDiscoveryRequest(org.junit.platform.launcher.LauncherDiscoveryRequest) FileSelector(org.junit.platform.engine.discovery.FileSelector) Test(org.junit.jupiter.api.Test)

Example 10 with LauncherDiscoveryRequest

use of org.junit.platform.launcher.LauncherDiscoveryRequest in project junit5 by junit-team.

the class DiscoveryRequestCreatorTests method convertsTagOptions.

@Test
void convertsTagOptions() {
    options.setScanClasspath(true);
    options.setIncludedTagExpressions(asList("fast", "medium", "slow"));
    options.setExcludedTagExpressions(asList("slow"));
    LauncherDiscoveryRequest request = convert();
    List<PostDiscoveryFilter> postDiscoveryFilters = request.getPostDiscoveryFilters();
    assertThat(postDiscoveryFilters).hasSize(2);
    assertThat(postDiscoveryFilters.get(0).toString()).contains("TagFilter");
    assertThat(postDiscoveryFilters.get(1).toString()).contains("TagFilter");
}
Also used : LauncherDiscoveryRequest(org.junit.platform.launcher.LauncherDiscoveryRequest) PostDiscoveryFilter(org.junit.platform.launcher.PostDiscoveryFilter) Test(org.junit.jupiter.api.Test)

Aggregations

LauncherDiscoveryRequest (org.junit.platform.launcher.LauncherDiscoveryRequest)167 Test (org.junit.jupiter.api.Test)141 ExecutionEventRecorder (org.junit.platform.engine.test.event.ExecutionEventRecorder)74 TestDescriptor (org.junit.platform.engine.TestDescriptor)54 PlainOldJavaClassWithoutAnyTest (org.junit.vintage.engine.samples.PlainOldJavaClassWithoutAnyTest)33 Launcher (org.junit.platform.launcher.Launcher)16 DynamicTest (org.junit.jupiter.api.DynamicTest)12 DynamicTest.dynamicTest (org.junit.jupiter.api.DynamicTest.dynamicTest)11 DiscoverySelectors.selectMethod (org.junit.platform.engine.discovery.DiscoverySelectors.selectMethod)11 PlainJUnit4TestCaseWithFiveTestMethods (org.junit.vintage.engine.samples.junit4.PlainJUnit4TestCaseWithFiveTestMethods)11 Method (java.lang.reflect.Method)10 PlainJUnit4TestCaseWithSingleTestWhichFails (org.junit.vintage.engine.samples.junit4.PlainJUnit4TestCaseWithSingleTestWhichFails)8 IOException (java.io.IOException)7 SummaryGeneratingListener (org.junit.platform.launcher.listeners.SummaryGeneratingListener)7 ArrayList (java.util.ArrayList)6 TestExecutionListener (org.junit.platform.launcher.TestExecutionListener)6 TestIdentifier (org.junit.platform.launcher.TestIdentifier)5 TestPlan (org.junit.platform.launcher.TestPlan)5 Path (java.nio.file.Path)4 DiscoverySelectors.selectUniqueId (org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId)4