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


Java LauncherFactory类代码示例

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


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

示例1: main

import org.junit.platform.launcher.core.LauncherFactory; //导入依赖的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: main

import org.junit.platform.launcher.core.LauncherFactory; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    try (SocketChannel channel = openSocket()) {
        TestExecutionListener listener = createListener(channel);
        Launcher launcher = LauncherFactory.create();
        launcher.registerTestExecutionListeners(listener);

        ObjectInputStream inputStream = openInput();
        Map<String, List<String>> config = (Map<String, List<String>>) inputStream.readObject();
        Set<File> roots = config.get("classpathRoots").stream()
            .map(File::new)
            .collect(Collectors.toSet());

        LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
            .selectors(selectClasspathRoots(roots))
            .build();

        launcher.execute(request);
    }
}
 
开发者ID:ajoberstar,项目名称:jovial,代码行数:20,代码来源:JovialSocketLauncher.java

示例3: runClasses

import org.junit.platform.launcher.core.LauncherFactory; //导入依赖的package包/类
private void runClasses(Class<?>... classes) {
    final ClassSelector[] classSelectors = Stream.of(classes)
            .map(DiscoverySelectors::selectClass)
            .toArray(ClassSelector[]::new);
    final LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
            .selectors(classSelectors)
            .build();

    AllureJunit5AnnotationProcessor.setLifecycle(lifecycle);
    final Launcher launcher = LauncherFactory.create();
    launcher.execute(request, new AllureJunit5(lifecycle));
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:13,代码来源:AnnotationsTest.java

示例4: runClasses

import org.junit.platform.launcher.core.LauncherFactory; //导入依赖的package包/类
private void runClasses(Class<?>... classes) {
    final ClassSelector[] classSelectors = Stream.of(classes)
            .map(DiscoverySelectors::selectClass)
            .toArray(ClassSelector[]::new);
    final LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
            .selectors(classSelectors)
            .build();

    final Launcher launcher = LauncherFactory.create();
    launcher.execute(request, new AllureJunit5(lifecycle));
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:12,代码来源:AllureJunit5Test.java

示例5: runTests

import org.junit.platform.launcher.core.LauncherFactory; //导入依赖的package包/类
public static TestPlanExecutionReport runTests(Class<?> clazz) {
  Launcher launcher = LauncherFactory.create();
  LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
      .selectors(selectClass(clazz))
      .build();

  ExecutionReportListener listener = new ExecutionReportListener().addClassToSkip(clazz);
  launcher.execute(request, listener);
  return listener.getReport();
}
 
开发者ID:JeffreyFalgout,项目名称:junit5-extensions,代码行数:11,代码来源:ExtensionTester.java

示例6: execute

import org.junit.platform.launcher.core.LauncherFactory; //导入依赖的package包/类
public ExitStatus execute(SummaryGeneratingListener listener,
                          DiscoverySelector selector,
                          ApplicationConfiguration applicationConfiguration,
                          FilesLocator filesLocator) {
    ApplicationConfigurationResolver.setConfiguration(applicationConfiguration);
    FilesLocatorResolver.setFilesLocator(filesLocator);

    LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
        .selectors(selector)
        .build();

    Launcher launcher = LauncherFactory.create();
    launcher.registerTestExecutionListeners(listener);
    launcher.execute(request);

    return listener.getSummary().getFailures().isEmpty() ? ExitStatus.SUCCESS : ExitStatus.FAILURE;
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:18,代码来源:Application.java

示例7: getAsInt

import org.junit.platform.launcher.core.LauncherFactory; //导入依赖的package包/类
@Override
public int getAsInt() {
  ClassLoader oldContext = Thread.currentThread().getContextClassLoader();
  Thread.currentThread().setContextClassLoader(classLoader);
  try {
    ModuleReference moduleReference = ModuleHelper.getOnlyModule(testPath);
    Launcher launcher = LauncherFactory.create();
    return launch(moduleReference, launcher);
  } finally {
    Thread.currentThread().setContextClassLoader(oldContext);
  }
}
 
开发者ID:forax,项目名称:pro,代码行数:13,代码来源:TesterRunner.java

示例8: JUnit5TestUnitFinder

import org.junit.platform.launcher.core.LauncherFactory; //导入依赖的package包/类
public JUnit5TestUnitFinder() {
    launcher = LauncherFactory.create();
}
 
开发者ID:tobiasstadler,项目名称:pitest-junit5-plugin,代码行数:4,代码来源:JUnit5TestUnitFinder.java


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