类org.junit.platform.testkit.engine.EngineTestKit源码实例Demo

下面列出了怎么用org.junit.platform.testkit.engine.EngineTestKit的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dropwizard-guicey   文件: ParallelExecutionTest.java
@Test
void checkParallelExecution() {
    EngineTestKit
            .engine("junit-jupiter")
            .configurationParameter("junit.jupiter.conditions.deactivate", "org.junit.*DisabledCondition")
            .configurationParameter("junit.jupiter.execution.parallel.enabled", "true")
            .configurationParameter("junit.jupiter.execution.parallel.mode.default", "concurrent")
            .selectors(selectClass(Test1.class),
                    selectClass(Test2.class),
                    selectClass(Test3.class),
                    selectClass(Test4.class))
            .execute()
            .testEvents()
            .debug()
            .assertStatistics(stats -> stats.succeeded(4));
}
 
源代码2 项目: ogham   文件: LoggingExtensionTest.java
@Test
void checkSuccessLogs() {
	EngineTestKit.engine("junit-jupiter")
		.selectors(selectMethod(FakeTest.class, "success"))
		.execute()
			.testEvents()
				.assertStatistics(s -> s.aborted(0).failed(0).succeeded(1).skipped(0));
	String logs = writer.toString();
	assertThat(logs).contains(SUCCESS_HEADER);
	assertThat(logs).contains(SUCCESS_FOOTER);
}
 
源代码3 项目: ogham   文件: LoggingExtensionTest.java
@Test
void checkFailureLogs() {
	EngineTestKit.engine("junit-jupiter")
		.selectors(selectMethod(FakeTest.class, "failure"))
		.execute()
			.testEvents()
				.assertStatistics(s -> s.aborted(0).failed(1).succeeded(0).skipped(0));
	String logs = writer.toString();
	assertThat(logs).contains(FAILURE_HEADER);
	assertThat(logs).contains(FAILURE_FOOTER);
}
 
源代码4 项目: ogham   文件: LoggingExtensionTest.java
@Test
void checkCaughtLogs() {
	EngineTestKit.engine("junit-jupiter")
		.selectors(selectMethod(FakeTest.class, "caught"))
		.execute()
			.testEvents()
				.assertStatistics(s -> s.aborted(0).failed(0).succeeded(1).skipped(0));
	String logs = writer.toString();
	assertThat(logs).contains(CAUGHT_HEADER);
	assertThat(logs).contains(CAUGHT_FOOTER);
}
 
源代码5 项目: ogham   文件: LoggingRuleTest.java
@Test
public void checkSuccessLogs() {
	EngineTestKit.engine("junit-vintage")
		.selectors(selectMethod(FakeTest.class, "success"))
		.execute()
			.testEvents()
				.assertStatistics(s -> s.aborted(0).failed(0).succeeded(1).skipped(0));
	String logs = writer.toString();
	assertThat(logs).contains(SUCCESS_HEADER);
	assertThat(logs).contains(SUCCESS_FOOTER);
}
 
源代码6 项目: ogham   文件: LoggingRuleTest.java
@Test
public void checkFailureLogs() {
	EngineTestKit.engine("junit-vintage")
		.selectors(selectMethod(FakeTest.class, "failure"))
		.execute()
			.testEvents()
				.assertStatistics(s -> s.aborted(0).failed(1).succeeded(0).skipped(0));
	String logs = writer.toString();
	assertThat(logs).contains(FAILURE_HEADER);
	assertThat(logs).contains(FAILURE_FOOTER);
}
 
源代码7 项目: ogham   文件: LoggingRuleTest.java
@Test
public void checkCaughtLogs() {
	EngineTestKit.engine("junit-vintage")
		.selectors(selectMethod(FakeTest.class, "caught"))
		.execute()
			.testEvents()
				.assertStatistics(s -> s.aborted(0).failed(0).succeeded(1).skipped(0));
	String logs = writer.toString();
	assertThat(logs).contains(CAUGHT_HEADER);
	assertThat(logs).contains(CAUGHT_FOOTER);
}
 
源代码8 项目: ogham   文件: LoggingRuleTest.java
@Test
public void checkCaughtByAnnotationLogs() {
	EngineTestKit.engine("junit-vintage")
		.selectors(selectMethod(FakeTest.class, "caughtByAnnotation"))
		.execute()
			.testEvents()
				.assertStatistics(s -> s.aborted(0).failed(0).succeeded(1).skipped(0));
	String logs = writer.toString();
	assertThat(logs).contains(CAUGHT_ANNOTATION_HEADER);
	assertThat(logs).contains(CAUGHT_ANNOTATION_FOOTER);
}
 
源代码9 项目: ogham   文件: LoggingRuleTest.java
@Test
public void checkAnnotatedSuccessLogs() {
	EngineTestKit.engine("junit-vintage")
		.selectors(selectMethod(FakeTest.class, "success"))
		.execute()
			.testEvents()
				.assertStatistics(s -> s.aborted(0).failed(0).succeeded(1).skipped(0));
	String logs = writer.toString();
	assertThat(logs).contains(SUCCESS_HEADER);
	assertThat(logs).contains(SUCCESS_FOOTER);
}
 
源代码10 项目: ogham   文件: LoggingRuleTest.java
@Test
public void checkAnnotatedFailureLogs() {
	EngineTestKit.engine("junit-vintage")
		.selectors(selectMethod(FakeTest.class, "failure"))
		.execute()
			.testEvents()
				.assertStatistics(s -> s.aborted(0).failed(1).succeeded(0).skipped(0));
	String logs = writer.toString();
	assertThat(logs).contains(FAILURE_HEADER);
	assertThat(logs).contains(FAILURE_FOOTER);
}
 
源代码11 项目: ogham   文件: LoggingRuleTest.java
@Test
public void checkAnnotatedCaughtLogs() {
	EngineTestKit.engine("junit-vintage")
		.selectors(selectMethod(FakeTest.class, "caught"))
		.execute()
			.testEvents()
				.assertStatistics(s -> s.aborted(0).failed(0).succeeded(1).skipped(0));
	String logs = writer.toString();
	assertThat(logs).contains(CAUGHT_HEADER);
	assertThat(logs).contains(CAUGHT_FOOTER);
}
 
源代码12 项目: ogham   文件: LoggingRuleTest.java
@Test
public void checkAnnotatedCaughtByAnnotationLogs() {
	EngineTestKit.engine("junit-vintage")
		.selectors(selectMethod(FakeTest.class, "caughtByAnnotation"))
		.execute()
			.testEvents()
				.assertStatistics(s -> s.aborted(0).failed(0).succeeded(1).skipped(0));
	String logs = writer.toString();
	assertThat(logs).contains(CAUGHT_ANNOTATION_HEADER);
	assertThat(logs).contains(CAUGHT_ANNOTATION_FOOTER);
}
 
@Test
void checkIncorrectFieldDetection() {
    EngineTestKit
            .engine("junit-jupiter")
            .configurationParameter("junit.jupiter.conditions.deactivate", "org.junit.*DisabledCondition")
            .selectors(selectClass(Test1.class))
            .execute()
            .testEvents()
            .debug()
            .assertStatistics(stats -> stats.succeeded(0));
}
 
@Test
void checkParallelExecution() {
    EngineTestKit
            .engine("junit-jupiter")
            .selectors(selectClass(Test1.class))
            .execute()
            .testEvents()
            .debug()
            .assertStatistics(stats -> stats.succeeded(1));

    Assertions.assertTrue(App.shutdown);
}
 
源代码15 项目: exonum-java-binding   文件: TestKitExtensionTest.java
private EngineExecutionResults getTestCaseEngineExecutionResults(Class<?> testCaseClass) {
  return EngineTestKit.engine("junit-jupiter")
      .selectors(selectClass(testCaseClass))
      .execute();
}
 
 类所在包
 类方法
 同包方法