Java 类org.junit.platform.launcher.TestPlan 实例源码

项目:mastering-junit5    文件:LauncherApiExample.java   
@SuppressWarnings("unused")
public static void main(String[] args) {
    // Discover and filter tests
    LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder
            .request()
            .selectors(selectPackage("io.github.bonigarcia"),
                    selectClass(DummyTest.class))
            .filters(includeClassNamePatterns(".*Test")).build();

    Launcher launcher = LauncherFactory.create();
    TestPlan plan = launcher.discover(request);

    // Executing tests
    TestExecutionListener listener = new SummaryGeneratingListener();
    launcher.registerTestExecutionListeners(listener);

    launcher.execute(request, listener);
}
项目:Mastering-Software-Testing-with-JUnit-5    文件:LauncherApiExample.java   
@SuppressWarnings("unused")
public static void main(String[] args) {
    // Discover and filter tests
    LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder
            .request()
            .selectors(selectPackage("io.github.bonigarcia"),
                    selectClass(DummyTest.class))
            .filters(includeClassNamePatterns(".*Test")).build();

    Launcher launcher = LauncherFactory.create();
    TestPlan plan = launcher.discover(request);

    // Executing tests
    TestExecutionListener listener = new SummaryGeneratingListener();
    launcher.registerTestExecutionListeners(listener);

    launcher.execute(request, listener);
}
项目:pitest-junit5-plugin    文件:JUnit5TestUnitFinder.java   
@Override
public List<TestUnit> findTestUnits(Class<?> clazz) {
    TestPlan testPlan = launcher.discover(LauncherDiscoveryRequestBuilder
            .request()
            .selectors(DiscoverySelectors.selectClass(clazz))
            .build());

    return testPlan.getRoots()
            .stream()
            .map(testPlan::getDescendants)
            .flatMap(Set::stream)
            .filter(testIdentifier -> testIdentifier.getSource().isPresent())
            .filter(testIdentifier -> testIdentifier.getSource().get() instanceof MethodSource)
            .filter(testIdentifier -> ((MethodSource) testIdentifier.getSource().get()).getClassName().equals(clazz.getName()))
            .map(testIdentifier -> new JUnit5TestUnit(testIdentifier))
            .collect(toList());
}
项目:junit5-extensions    文件:ExecutionReportListener.java   
@Override
public void testPlanExecutionStarted(TestPlan testPlan) {
  executionReportBuilder = TestPlanExecutionReport.builder(testPlan);
  executionReportBuilder.addAllClassesToSkip(classesToSkip);
  classesToSkip.clear();
}
项目:junit5-extensions    文件:TestPlanExecutionReport.java   
public static Builder builder(TestPlan testPlan) {
  return new AutoValue_TestPlanExecutionReport.Builder().setTestPlan(testPlan);
}
项目:junit5-extensions    文件:TestPlanExecutionReport.java   
final Builder setTestPlan(TestPlan testPlan) {
  this.testPlan = testPlan;
  return this;
}
项目:verify-matching-service-adapter    文件:TestStatusPrintingListener.java   
@Override
public void testPlanExecutionFinished(TestPlan testPlan) {
    super.testPlanExecutionFinished(testPlan);
    long tests = testPlan.countTestIdentifiers(TestIdentifier::isTest);
    System.out.println("Test execution finished. Number of all tests: " + tests);
}