Search in sources :

Example 6 with EngineExecutionResults

use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.

the class DynamicNodeGenerationTests method dynamicContainersChildrenMustNotBeNull.

@Test
void dynamicContainersChildrenMustNotBeNull() {
    EngineExecutionResults executionResults = executeTests(selectMethod(MyDynamicTestCase.class, "dynamicContainerWithNullChildren"));
    // 
    executionResults.allEvents().assertEventsMatchExactly(// 
    event(engine(), started()), // 
    event(container(MyDynamicTestCase.class), started()), // 
    event(container("dynamicContainerWithNullChildren"), started()), // 
    event(dynamicTestRegistered("dynamic-container:#1")), // 
    event(container("dynamic-container:#1"), started()), event(// 
    container("dynamic-container:#1"), // 
    finishedWithFailure(message("individual dynamic node must not be null"))), // 
    event(container("dynamicContainerWithNullChildren"), finishedSuccessfully()), // 
    event(container(MyDynamicTestCase.class), finishedSuccessfully()), event(engine(), finishedSuccessfully()));
}
Also used : EngineExecutionResults(org.junit.platform.testkit.engine.EngineExecutionResults) DynamicTest.dynamicTest(org.junit.jupiter.api.DynamicTest.dynamicTest) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Example 7 with EngineExecutionResults

use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.

the class DynamicNodeGenerationTests method dynamicTestsAreExecutedFromStream.

@Test
void dynamicTestsAreExecutedFromStream() {
    EngineExecutionResults executionResults = executeTests(selectMethod(MyDynamicTestCase.class, "dynamicStream"));
    // 
    executionResults.allEvents().assertEventsMatchExactly(// 
    event(engine(), started()), // 
    event(container(MyDynamicTestCase.class), started()), // 
    event(container("dynamicStream"), started()), // 
    event(dynamicTestRegistered("dynamic-test:#1")), // 
    event(test("dynamic-test:#1", "succeedingTest"), started()), // 
    event(test("dynamic-test:#1", "succeedingTest"), finishedSuccessfully()), // 
    event(dynamicTestRegistered("dynamic-test:#2")), // 
    event(test("dynamic-test:#2", "failingTest"), started()), // 
    event(test("dynamic-test:#2", "failingTest"), finishedWithFailure(message("failing"))), // 
    event(container("dynamicStream"), finishedSuccessfully()), // 
    event(container(MyDynamicTestCase.class), finishedSuccessfully()), event(engine(), finishedSuccessfully()));
}
Also used : EngineExecutionResults(org.junit.platform.testkit.engine.EngineExecutionResults) DynamicTest.dynamicTest(org.junit.jupiter.api.DynamicTest.dynamicTest) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Example 8 with EngineExecutionResults

use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.

the class DynamicNodeGenerationTests method dynamicContainersAreExecutedFromExceptionThrowingStream.

@Test
void dynamicContainersAreExecutedFromExceptionThrowingStream() {
    EngineExecutionResults executionResults = executeTests(selectMethod(MyDynamicTestCase.class, "dynamicContainerWithExceptionThrowingStream"));
    assertTrue(MyDynamicTestCase.exceptionThrowingStreamClosed.get(), "stream should be closed");
    // 
    executionResults.allEvents().assertEventsMatchExactly(// 
    event(engine(), started()), // 
    event(container(MyDynamicTestCase.class), started()), // 
    event(container("dynamicContainerWithExceptionThrowingStream"), started()), // 
    event(dynamicTestRegistered("dynamic-container:#1")), // 
    event(container("dynamic-container:#1"), started()), // 
    event(dynamicTestRegistered("dynamic-test:#1")), // 
    event(test("dynamic-test:#1", "succeedingTest"), started()), // 
    event(test("dynamic-test:#1", "succeedingTest"), finishedSuccessfully()), // 
    event(dynamicTestRegistered("dynamic-test:#2")), // 
    event(test("dynamic-test:#2", "failingTest"), started()), // 
    event(test("dynamic-test:#2", "failingTest"), finishedWithFailure(message("failing"))), event(container("dynamic-container:#1"), // 
    finishedWithFailure(instanceOf(ArrayIndexOutOfBoundsException.class))), // 
    event(container("dynamicContainerWithExceptionThrowingStream"), finishedSuccessfully()), // 
    event(container(MyDynamicTestCase.class), finishedSuccessfully()), event(engine(), finishedSuccessfully()));
    Events containers = executionResults.containerEvents();
    Events tests = executionResults.testEvents();
    assertAll(() -> assertEquals(4, containers.started().count(), "# container started"), () -> assertEquals(1, containers.dynamicallyRegistered().count(), "# dynamic containers registered"), () -> assertEquals(2, tests.dynamicallyRegistered().count(), "# dynamic tests registered"), () -> assertEquals(2, tests.started().count(), "# tests started"), () -> assertEquals(1, tests.succeeded().count(), "# tests succeeded"), () -> assertEquals(1, tests.failed().count(), "# tests failed"), () -> assertEquals(4, containers.finished().count(), "# container finished"));
}
Also used : EngineExecutionResults(org.junit.platform.testkit.engine.EngineExecutionResults) Events(org.junit.platform.testkit.engine.Events) DynamicTest.dynamicTest(org.junit.jupiter.api.DynamicTest.dynamicTest) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Example 9 with EngineExecutionResults

use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.

the class DynamicNodeGenerationTests method testFactoryMethodsMayReturnSingleDynamicTest.

@Test
void testFactoryMethodsMayReturnSingleDynamicTest() {
    EngineExecutionResults executionResults = executeTests(selectMethod(MyDynamicTestCase.class, "singleTest"));
    // 
    executionResults.allEvents().assertEventsMatchExactly(// 
    event(engine(), started()), // 
    event(container(MyDynamicTestCase.class), started()), // 
    event(container("singleTest"), started()), // 
    event(dynamicTestRegistered("dynamic-test:#1")), // 
    event(test("dynamic-test:#1", "succeedingTest"), started()), // 
    event(test("dynamic-test:#1", "succeedingTest"), finishedSuccessfully()), // 
    event(container("singleTest"), finishedSuccessfully()), // 
    event(container(MyDynamicTestCase.class), finishedSuccessfully()), event(engine(), finishedSuccessfully()));
}
Also used : EngineExecutionResults(org.junit.platform.testkit.engine.EngineExecutionResults) DynamicTest.dynamicTest(org.junit.jupiter.api.DynamicTest.dynamicTest) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Example 10 with EngineExecutionResults

use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.

the class DynamicNodeGenerationTests method testFactoryMethodsMayReturnSingleDynamicContainer.

@Test
void testFactoryMethodsMayReturnSingleDynamicContainer() {
    EngineExecutionResults executionResults = executeTests(selectMethod(MyDynamicTestCase.class, "singleContainer"));
    // 
    executionResults.allEvents().assertEventsMatchExactly(// 
    event(engine(), started()), // 
    event(container(MyDynamicTestCase.class), started()), // 
    event(container("singleContainer"), started()), // 
    event(dynamicTestRegistered("dynamic-container:#1")), // 
    event(container("dynamic-container:#1"), started()), // 
    event(dynamicTestRegistered("dynamic-test:#1")), // 
    event(test("dynamic-test:#1", "succeedingTest"), started()), // 
    event(test("dynamic-test:#1", "succeedingTest"), finishedSuccessfully()), // 
    event(dynamicTestRegistered("dynamic-test:#2")), // 
    event(test("dynamic-test:#2", "failingTest"), started()), // 
    event(test("dynamic-test:#2", "failingTest"), finishedWithFailure(message("failing"))), // 
    event(container("dynamic-container:#1"), finishedSuccessfully()), // 
    event(container("singleContainer"), finishedSuccessfully()), // 
    event(container(MyDynamicTestCase.class), finishedSuccessfully()), event(engine(), finishedSuccessfully()));
}
Also used : EngineExecutionResults(org.junit.platform.testkit.engine.EngineExecutionResults) DynamicTest.dynamicTest(org.junit.jupiter.api.DynamicTest.dynamicTest) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Aggregations

EngineExecutionResults (org.junit.platform.testkit.engine.EngineExecutionResults)139 Test (org.junit.jupiter.api.Test)134 LauncherDiscoveryRequest (org.junit.platform.launcher.LauncherDiscoveryRequest)32 DynamicTest (org.junit.jupiter.api.DynamicTest)30 DynamicTest.dynamicTest (org.junit.jupiter.api.DynamicTest.dynamicTest)30 Events (org.junit.platform.testkit.engine.Events)27 DisplayName (org.junit.jupiter.api.DisplayName)15 RepeatedTest (org.junit.jupiter.api.RepeatedTest)15 IOException (java.io.IOException)12 Execution (org.junit.platform.testkit.engine.Execution)12 TimeoutException (java.util.concurrent.TimeoutException)10 List (java.util.List)8 ExtensionConfigurationException (org.junit.jupiter.api.extension.ExtensionConfigurationException)8 ArrayList (java.util.ArrayList)7 AfterAll (org.junit.jupiter.api.AfterAll)7 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)7 BeforeAll (org.junit.jupiter.api.BeforeAll)7 BeforeEach (org.junit.jupiter.api.BeforeEach)7 Nested (org.junit.jupiter.api.Nested)7 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)7