Search in sources :

Example 1 with ExecutionEventRecorder

use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.

the class ExtensionContextExecutionTests method twoTestClassesCanShareStateViaEngineExtensionContext.

@Test
void twoTestClassesCanShareStateViaEngineExtensionContext() {
    Parent.counter.set(0);
    ExecutionEventRecorder eventRecorder = executeTests(request().selectors(selectClass(A.class), selectClass(B.class)).build());
    assertThat(eventRecorder.getTestFinishedCount()).isEqualTo(2);
    assertThat(Parent.counter).hasValue(1);
}
Also used : ExecutionEventRecorder(org.junit.platform.engine.test.event.ExecutionEventRecorder) Test(org.junit.jupiter.api.Test)

Example 2 with ExecutionEventRecorder

use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.

the class ParameterResolverTests method executeTestsForMethodInjectionInBeforeAndAfterEachMethods.

@Test
void executeTestsForMethodInjectionInBeforeAndAfterEachMethods() {
    ExecutionEventRecorder eventRecorder = executeTestsForClass(BeforeAndAfterMethodInjectionTestCase.class);
    assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started");
    assertEquals(1, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
    assertEquals(0, eventRecorder.getTestSkippedCount(), "# tests skipped");
    assertEquals(0, eventRecorder.getTestAbortedCount(), "# tests aborted");
    assertEquals(0, eventRecorder.getTestFailedCount(), "# tests failed");
}
Also used : ExecutionEventRecorder(org.junit.platform.engine.test.event.ExecutionEventRecorder) Test(org.junit.jupiter.api.Test)

Example 3 with ExecutionEventRecorder

use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.

the class ParameterResolverTests method constructorInjectionWithAnnotatedParameter.

@Test
void constructorInjectionWithAnnotatedParameter() {
    ExecutionEventRecorder eventRecorder = executeTestsForClass(AnnotatedParameterConstructorInjectionTestCase.class);
    assertEquals(2, eventRecorder.getTestStartedCount(), "# tests started");
    assertEquals(2, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
    assertEquals(0, eventRecorder.getTestSkippedCount(), "# tests skipped");
    assertEquals(0, eventRecorder.getTestAbortedCount(), "# tests aborted");
    assertEquals(0, eventRecorder.getTestFailedCount(), "# tests failed");
}
Also used : ExecutionEventRecorder(org.junit.platform.engine.test.event.ExecutionEventRecorder) Test(org.junit.jupiter.api.Test)

Example 4 with ExecutionEventRecorder

use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.

the class ParameterResolverTests method executeTestsForMethodInjectionInBeforeAndAfterAllMethods.

@Test
void executeTestsForMethodInjectionInBeforeAndAfterAllMethods() {
    ExecutionEventRecorder eventRecorder = executeTestsForClass(BeforeAndAfterAllMethodInjectionTestCase.class);
    assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started");
    assertEquals(1, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
    assertEquals(0, eventRecorder.getTestSkippedCount(), "# tests skipped");
    assertEquals(0, eventRecorder.getTestAbortedCount(), "# tests aborted");
    assertEquals(0, eventRecorder.getTestFailedCount(), "# tests failed");
}
Also used : ExecutionEventRecorder(org.junit.platform.engine.test.event.ExecutionEventRecorder) Test(org.junit.jupiter.api.Test)

Example 5 with ExecutionEventRecorder

use of org.junit.platform.engine.test.event.ExecutionEventRecorder in project junit5 by junit-team.

the class ParameterResolverTests method executeTestsForPrimitiveArrayMethodInjectionCases.

@Test
void executeTestsForPrimitiveArrayMethodInjectionCases() {
    ExecutionEventRecorder eventRecorder = executeTestsForClass(PrimitiveArrayMethodInjectionTestCase.class);
    assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started");
    assertEquals(1, eventRecorder.getTestSuccessfulCount(), "# tests succeeded");
    assertEquals(0, eventRecorder.getTestFailedCount(), "# tests failed");
}
Also used : ExecutionEventRecorder(org.junit.platform.engine.test.event.ExecutionEventRecorder) Test(org.junit.jupiter.api.Test)

Aggregations

ExecutionEventRecorder (org.junit.platform.engine.test.event.ExecutionEventRecorder)114 Test (org.junit.jupiter.api.Test)104 LauncherDiscoveryRequest (org.junit.platform.launcher.LauncherDiscoveryRequest)74 DynamicTest (org.junit.jupiter.api.DynamicTest)12 DynamicTest.dynamicTest (org.junit.jupiter.api.DynamicTest.dynamicTest)12 DiscoverySelectors.selectMethod (org.junit.platform.engine.discovery.DiscoverySelectors.selectMethod)12 Method (java.lang.reflect.Method)10 TestDescriptor (org.junit.platform.engine.TestDescriptor)8 IOException (java.io.IOException)6 DiscoverySelectors.selectUniqueId (org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId)5 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)4 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)4 TestInfo (org.junit.jupiter.api.TestInfo)4 UniqueId (org.junit.platform.engine.UniqueId)4 JupiterTestEngine (org.junit.jupiter.engine.JupiterTestEngine)3 LauncherDiscoveryRequestBuilder.request (org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request)3 Map (java.util.Map)2 Optional (java.util.Optional)2 Predicate (java.util.function.Predicate)2 Assertions.allOf (org.assertj.core.api.Assertions.allOf)2