本文整理汇总了Java中org.junit.platform.launcher.LauncherDiscoveryRequest类的典型用法代码示例。如果您正苦于以下问题:Java LauncherDiscoveryRequest类的具体用法?Java LauncherDiscoveryRequest怎么用?Java LauncherDiscoveryRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LauncherDiscoveryRequest类属于org.junit.platform.launcher包,在下文中一共展示了LauncherDiscoveryRequest类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的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: execute
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的package包/类
/**
* Instance an engine and execute the test resources identified by the given {@code selectors} and
* wrap the response in a listener so that we can make sense of what happened. The listener
* exposes information about the test execution flow which the extension tests can assert against.
*
* @param selectors {@link DiscoverySelector} instances which will isolate test class or test
* methods
* @return a {@link RecordingExecutionListener} which encapsulates what the engine did
*/
public static RecordingExecutionListener execute(DiscoverySelector... selectors) {
// instance an engine
JupiterTestEngine testEngine = new JupiterTestEngine();
// discover the requested test resources
LauncherDiscoveryRequest discoveryRequest = request().selectors(selectors).build();
RecordingExecutionListener listener = new RecordingExecutionListener();
// execute the discovered test resources
TestDescriptor testDescriptor =
testEngine.discover(discoveryRequest, UniqueId.forEngine(testEngine.getId()));
testEngine.execute(
new ExecutionRequest(
testDescriptor, listener, discoveryRequest.getConfigurationParameters()));
return listener;
}
开发者ID:glytching,项目名称:junit-extensions,代码行数:28,代码来源:ExtensionTester.java
示例3: main
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的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
示例4: launch
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的package包/类
private static int launch(ModuleReference moduleReference, Launcher launcher) {
LauncherDiscoveryRequestBuilder builder = LauncherDiscoveryRequestBuilder.request();
builder.selectors(selectModule(moduleReference.descriptor().name()));
long startTimeMillis = System.currentTimeMillis();
LauncherDiscoveryRequest launcherDiscoveryRequest = builder.build();
SummaryGeneratingListener summaryGeneratingListener = new SummaryGeneratingListener();
launcher.execute(launcherDiscoveryRequest, summaryGeneratingListener);
long duration = System.currentTimeMillis() - startTimeMillis;
TestExecutionSummary summary = summaryGeneratingListener.getSummary();
int failures = (int) summary.getTestsFailedCount();
if (failures == 0) {
long succeeded = summary.getTestsSucceededCount();
String moduleName = moduleReference.descriptor().toNameAndVersion();
System.out.printf("[tester] Successfully tested %s: %d tests in %d ms%n", moduleName, succeeded, duration);
} else {
StringWriter stringWriter = new StringWriter();
summary.printTo(new PrintWriter(stringWriter));
summary.printFailuresTo(new PrintWriter(stringWriter));
System.out.println(stringWriter);
}
return failures;
}
开发者ID:forax,项目名称:pro,代码行数:25,代码来源:TesterRunner.java
示例5: runClasses
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的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
示例6: runClasses
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的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
示例7: runTests
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的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
示例8: execute
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的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
示例9: executeTests
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的package包/类
private JupiterExecutionListener executeTests(LauncherDiscoveryRequest request) throws Exception {
TestDescriptor testDescriptor = createTestDescriptorForCucumber(
engine.discover(request, forEngine(engine.getId())), containers);
eventRecorder.reset();
engine.execute(new ExecutionRequest(testDescriptor, eventRecorder, request.getConfigurationParameters()));
return eventRecorder;
}
开发者ID:FaustXVI,项目名称:junit5-docker,代码行数:8,代码来源:JupiterTestEngineForTests.java
示例10: executeTestMethods
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的package包/类
private ExecutionEventRecorder executeTestMethods(Class<?> type, String[] methodNames) {
//@formatter:off
DiscoverySelector[] selectors = stream(methodNames)
.map(methodName -> selectMethod(type, methodName))
.toArray(DiscoverySelector[]::new);
//@formatter:on
LauncherDiscoveryRequest request = request().selectors(selectors).build();
return executeTests(request);
}
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:10,代码来源:AbstractPioneerTestEngineTests.java
示例11: ForeignClassLoaderLauncher
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的package包/类
public ForeignClassLoaderLauncher(Launcher launcher, LauncherDiscoveryRequest launcherDiscoveryRequest) {
this.launcher = launcher;
this.launcherDiscoveryRequest = launcherDiscoveryRequest;
}
开发者ID:tobiasstadler,项目名称:pitest-junit5-plugin,代码行数:5,代码来源:ForeignClassLoaderLauncher.java
示例12: executeTests
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的package包/类
protected ExecutionEventRecorder executeTests(LauncherDiscoveryRequest request) {
TestDescriptor testDescriptor = discoverTests(request);
ExecutionEventRecorder eventRecorder = new ExecutionEventRecorder();
engine.execute(new ExecutionRequest(testDescriptor, eventRecorder, request.getConfigurationParameters()));
return eventRecorder;
}
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:7,代码来源:AbstractJupiterTestEngineTests.java
示例13: discoverTests
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的package包/类
protected TestDescriptor discoverTests(LauncherDiscoveryRequest request) {
return engine.discover(request, UniqueId.forEngine(engine.getId()));
}
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:4,代码来源:AbstractJupiterTestEngineTests.java
示例14: executeTestClass
import org.junit.platform.launcher.LauncherDiscoveryRequest; //导入依赖的package包/类
private ExecutionEventRecorder executeTestClass(Class<?> type) {
LauncherDiscoveryRequest request = request().selectors(selectClass(type)).build();
return executeTests(request);
}
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:5,代码来源:AbstractPioneerTestEngineTests.java
注:本文中的org.junit.platform.launcher.LauncherDiscoveryRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论