当前位置: 首页>>代码示例>>Java>>正文


Java TestPlan类代码示例

本文整理汇总了Java中org.junit.platform.launcher.TestPlan的典型用法代码示例。如果您正苦于以下问题:Java TestPlan类的具体用法?Java TestPlan怎么用?Java TestPlan使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TestPlan类属于org.junit.platform.launcher包,在下文中一共展示了TestPlan类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.junit.platform.launcher.TestPlan; //导入依赖的package包/类
@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);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Software-Testing-with-JUnit-5,代码行数:19,代码来源:LauncherApiExample.java

示例2: findTestUnits

import org.junit.platform.launcher.TestPlan; //导入依赖的package包/类
@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());
}
 
开发者ID:tobiasstadler,项目名称:pitest-junit5-plugin,代码行数:18,代码来源:JUnit5TestUnitFinder.java

示例3: testPlanExecutionStarted

import org.junit.platform.launcher.TestPlan; //导入依赖的package包/类
@Override
public void testPlanExecutionStarted(TestPlan testPlan) {
  executionReportBuilder = TestPlanExecutionReport.builder(testPlan);
  executionReportBuilder.addAllClassesToSkip(classesToSkip);
  classesToSkip.clear();
}
 
开发者ID:JeffreyFalgout,项目名称:junit5-extensions,代码行数:7,代码来源:ExecutionReportListener.java

示例4: builder

import org.junit.platform.launcher.TestPlan; //导入依赖的package包/类
public static Builder builder(TestPlan testPlan) {
  return new AutoValue_TestPlanExecutionReport.Builder().setTestPlan(testPlan);
}
 
开发者ID:JeffreyFalgout,项目名称:junit5-extensions,代码行数:4,代码来源:TestPlanExecutionReport.java

示例5: setTestPlan

import org.junit.platform.launcher.TestPlan; //导入依赖的package包/类
final Builder setTestPlan(TestPlan testPlan) {
  this.testPlan = testPlan;
  return this;
}
 
开发者ID:JeffreyFalgout,项目名称:junit5-extensions,代码行数:5,代码来源:TestPlanExecutionReport.java

示例6: testPlanExecutionFinished

import org.junit.platform.launcher.TestPlan; //导入依赖的package包/类
@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);
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:7,代码来源:TestStatusPrintingListener.java


注:本文中的org.junit.platform.launcher.TestPlan类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。