本文整理汇总了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());
}
示例3: testPlanExecutionStarted
import org.junit.platform.launcher.TestPlan; //导入依赖的package包/类
@Override
public void testPlanExecutionStarted(TestPlan testPlan) {
executionReportBuilder = TestPlanExecutionReport.builder(testPlan);
executionReportBuilder.addAllClassesToSkip(classesToSkip);
classesToSkip.clear();
}
示例4: builder
import org.junit.platform.launcher.TestPlan; //导入依赖的package包/类
public static Builder builder(TestPlan testPlan) {
return new AutoValue_TestPlanExecutionReport.Builder().setTestPlan(testPlan);
}
示例5: setTestPlan
import org.junit.platform.launcher.TestPlan; //导入依赖的package包/类
final Builder setTestPlan(TestPlan testPlan) {
this.testPlan = testPlan;
return this;
}
示例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);
}