use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class StandardTestClassTests method moreThanOneTestClassIsExecuted.
@Test
void moreThanOneTestClassIsExecuted() {
LauncherDiscoveryRequest request = request().selectors(selectClass(FirstOfTwoTestCases.class), selectClass(SecondOfTwoTestCases.class)).build();
EngineExecutionResults executionResults = executeTests(request);
Events containers = executionResults.containerEvents();
Events tests = executionResults.testEvents();
assertEquals(6, tests.started().count(), "# tests started");
assertEquals(5, tests.succeeded().count(), "# tests succeeded");
assertEquals(1, tests.failed().count(), "# tests failed");
assertEquals(3, containers.started().count(), "# containers started");
assertEquals(3, containers.finished().count(), "# containers finished");
}
use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class StandardTestClassTests method testsFailWhenAfterEachFails.
@Test
void testsFailWhenAfterEachFails() {
EngineExecutionResults executionResults = executeTestsForClass(TestCaseWithFailingAfter.class);
Events containers = executionResults.containerEvents();
Events tests = executionResults.testEvents();
assertEquals(1, tests.started().count(), "# tests started");
assertEquals(0, tests.succeeded().count(), "# tests succeeded");
assertEquals(1, tests.failed().count(), "# tests failed");
assertEquals(2, containers.started().count(), "# containers started");
assertEquals(2, containers.finished().count(), "# containers finished");
assertTrue(TestCaseWithFailingAfter.testExecuted, "test executed?");
}
use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class StandardTestClassTests method testsFailWhenBeforeEachFails.
@Test
void testsFailWhenBeforeEachFails() {
EngineExecutionResults executionResults = executeTestsForClass(TestCaseWithFailingBefore.class);
Events containers = executionResults.containerEvents();
Events tests = executionResults.testEvents();
assertEquals(2, tests.started().count(), "# tests started");
assertEquals(0, tests.succeeded().count(), "# tests succeeded");
assertEquals(2, tests.failed().count(), "# tests failed");
assertEquals(2, containers.started().count(), "# containers started");
assertEquals(2, containers.finished().count(), "# containers finished");
assertEquals(2, TestCaseWithFailingBefore.countBefore, "# before each calls");
}
use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class TestInstanceLifecycleConfigurationTests method performAssertions.
private void performAssertions(Class<?> testClass, Map<String, String> configParams, int numContainers, int numFailedContainers, int numTests, String... methods) {
// @formatter:off
EngineExecutionResults executionResults = executeTests(request().selectors(selectClass(testClass)).configurationParameters(configParams).build());
// @formatter:on
//
executionResults.containerEvents().assertStatistics(stats -> stats.started(numContainers).finished(numContainers).failed(numFailedContainers));
//
executionResults.testEvents().assertStatistics(stats -> stats.started(numTests).finished(numTests));
assertEquals(Arrays.asList(methods), methodsInvoked);
}
use of org.junit.platform.testkit.engine.EngineExecutionResults in project junit5 by junit-team.
the class DisabledTests method executeTestsWithDisabledTestClass.
@Test
void executeTestsWithDisabledTestClass() {
EngineExecutionResults results = executeTestsForClass(DisabledTestClassTestCase.class);
results.containerEvents().assertStatistics(stats -> stats.skipped(1));
results.testEvents().assertStatistics(stats -> stats.started(0));
}
Aggregations