org.junit.platform.engine.TestExecutionResult Java Examples
The following examples show how to use
org.junit.platform.engine.TestExecutionResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AllureJunitPlatform.java From allure-java with Apache License 2.0 | 6 votes |
@Override public void executionFinished(final TestIdentifier testIdentifier, final TestExecutionResult testExecutionResult) { // skip root if (!testIdentifier.getParentId().isPresent()) { return; } final Status status = extractStatus(testExecutionResult); final StatusDetails statusDetails = testExecutionResult.getThrowable() .flatMap(ResultsUtils::getStatusDetails) .orElse(null); if (testIdentifier.isTest()) { stopTestCase(testIdentifier, status, statusDetails); } else if (testExecutionResult.getStatus() != TestExecutionResult.Status.SUCCESSFUL) { // report failed containers as fake test results startTestCase(testIdentifier); stopTestCase(testIdentifier, status, statusDetails); } stopTestContainer(testIdentifier); }
Example #2
Source File: TestPlanExecutionReport.java From junit5-extensions with MIT License | 6 votes |
public final Builder addResult(TestIdentifier identifier, TestExecutionResult result) { DisplayName displayName = getDisplayName(identifier); if (identifier.isTest()) { testsBuilder().add(displayName); } switch (result.getStatus()) { case SUCCESSFUL: successfulBuilder().add(displayName); return this; case FAILED: failuresBuilder().put(displayName, result.getThrowable().orElse(null)); return this; default: throw new AssertionError("Unhandled case in enum: " + result.getStatus()); } }
Example #3
Source File: OutputCapturingTestListener.java From sbt-jupiter-interface with Apache License 2.0 | 6 votes |
@Override public void executionFinished(TestIdentifier identifier, TestExecutionResult result) { CapturedOutputStream outputStream = outputStreamMap.remove(identifier.getUniqueId()); if (null == outputStream) { return; } OutputCapture.deregister(); if (isQuiet) { if (identifier.isTest()) { if (!SUCCESSFUL.equals(result.getStatus())) { outputStream.output.forEach(testLogger::info); outputStream.output.clear(); } } } }
Example #4
Source File: ProgressListeners.java From jeka with Apache License 2.0 | 5 votes |
@Override public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { if (testIdentifier.getType().isTest()) { System.out.println(testExecutionResult.getStatus()); System.out.println(); } }
Example #5
Source File: AllureJunitPlatform.java From allure-java with Apache License 2.0 | 5 votes |
private Status extractStatus(final TestExecutionResult testExecutionResult) { switch (testExecutionResult.getStatus()) { case FAILED: return testExecutionResult.getThrowable().isPresent() ? getStatus(testExecutionResult.getThrowable().get()) : FAILED; case SUCCESSFUL: return PASSED; default: return SKIPPED; } }
Example #6
Source File: ProgressListeners.java From jeka with Apache License 2.0 | 5 votes |
@Override public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { if (testIdentifier.getType().isTest()) { silencer.silent(false); System.out.println(" : " + testExecutionResult.getStatus()); } if(testIdentifier.getType().isContainer()) { nestedLevel --; } }
Example #7
Source File: FooTestListener.java From sbt-jupiter-interface with Apache License 2.0 | 5 votes |
@Override public void executionFinished(TestIdentifier identifier, TestExecutionResult result) { try { String name = identifier.getDisplayName(); Writer writer = new FileWriter("target/testsrun", true); writer.write(name + "\n"); writer.close(); } catch (Exception e) { throw new RuntimeException(e); } }
Example #8
Source File: Dispatcher.java From sbt-jupiter-interface with Apache License 2.0 | 5 votes |
@Override public void executionFinished(TestIdentifier identifier, TestExecutionResult result) { reportedIds.computeIfAbsent(identifier, key -> { final Status status; final Throwable throwable = result.getThrowable().orElse(null); final TaskName taskName = TaskName.of(testSuiteName, identifier); final long duration = calculateDuration(identifier); // dispatch only tests by default so that number of executed tests // match those from junit-interface boolean dispatch = identifier.isTest(); switch (result.getStatus()) { case ABORTED: status = Status.Canceled; dispatch = true; break; case FAILED: status = Status.Failure; dispatch = true; break; case SUCCESSFUL: status = Status.Success; break; default: status = Status.Pending; dispatch = true; break; } if (dispatch) { eventHandler.handle(new DispatchEvent(taskName, status, duration, throwable)); } return true; }); }
Example #9
Source File: FlatPrintingTestListener.java From sbt-jupiter-interface with Apache License 2.0 | 5 votes |
@Override public void executionFinished(TestIdentifier identifier, TestExecutionResult result) { String duration = calculateDurationSuffix(identifier.getUniqueId()); Throwable throwable = result.getThrowable().orElse(null); String fqn, message; switch (result.getStatus()) { case ABORTED: fqn = configuration.buildErrorName(identifier); message = configuration.buildErrorMessage(throwable); message = "Test assumption in test " + fqn + " failed: " + message + duration; logger.warn(message); break; case FAILED: fqn = configuration.buildErrorName(identifier); message = configuration.buildErrorMessage(throwable); message = "Test " + fqn + " failed: " + message + duration; logger.error(configuration.extractClassName(identifier), message, throwable); break; case SUCCESSFUL: fqn = configuration.formatIdentifier(testPlan, identifier); message = "Test " + fqn + " finished" + duration; logger.debug(message); break; } }
Example #10
Source File: TreePrintingTestListener.java From sbt-jupiter-interface with Apache License 2.0 | 5 votes |
@Override public void executionFinished(TestIdentifier identifier, TestExecutionResult result) { Throwable throwable = result.getThrowable().orElse(null); String fqn, message; switch (result.getStatus()) { case ABORTED: fqn = configuration.buildErrorName(identifier); message = configuration.buildErrorMessage(throwable); message = "Test assumption in test " + fqn + " failed: " + message; logger.warn(message); break; case FAILED: fqn = configuration.buildErrorName(identifier); message = configuration.buildErrorMessage(throwable); message = "Test " + fqn + " failed: " + message; logger.error(configuration.extractClassName(identifier), message, throwable); break; case SUCCESSFUL: fqn = identifier.getLegacyReportingName(); message = "Test " + fqn + " finished"; logger.debug(message); break; } maybeDecreaseIndent(identifier); }
Example #11
Source File: TestClassExecutor.java From webtester2-core with Apache License 2.0 | 5 votes |
@Override public void executionFinished(TestDescriptor testDescriptor, TestExecutionResult testExecutionResult) { Optional<Throwable> throwable = testExecutionResult.getThrowable(); if (throwable.isPresent()) { throw new UndeclaredThrowableException(throwable.get()); } }
Example #12
Source File: ProgressListeners.java From jeka with Apache License 2.0 | 4 votes |
@Override public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { if(testIdentifier.getType().isTest()) { silencer.silent(false); } }
Example #13
Source File: FailingBeforeAndAfterMethodsSpringExtensionTests.java From spring-analysis-note with MIT License | 4 votes |
@Override public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { super.executionFinished(testIdentifier, testExecutionResult); testExecutionResult.getThrowable().ifPresent(exceptions::add); }
Example #14
Source File: ReactorTestExecutionListener.java From reactor-core with Apache License 2.0 | 4 votes |
@Override public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { reset(); }
Example #15
Source File: ZeroCodeTestReportJupiterListener.java From zerocode with Apache License 2.0 | 4 votes |
@Override public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { if(testExecutionResult.getStatus().equals(FAILED)){ passed = false; } }
Example #16
Source File: JupiterExecutionListener.java From junit5-docker with Apache License 2.0 | 4 votes |
@Override public void executionFinished(TestDescriptor testDescriptor, TestExecutionResult testExecutionResult) { allTestsPassed = allTestsPassed && testExecutionResult.getStatus() == SUCCESSFUL; }
Example #17
Source File: RoboZonkyTestExecutionListener.java From robozonky with Apache License 2.0 | 4 votes |
@Override public void executionFinished(final TestIdentifier testIdentifier, final TestExecutionResult testExecutionResult) { final String id = identifyTest(testIdentifier); LOGGER.info("Finished {}.", id); }
Example #18
Source File: TestKitExtensionTest.java From exonum-java-binding with Apache License 2.0 | 4 votes |
private String getFailedEventExceptionMessage(Event event) { return event.getPayload(TestExecutionResult.class) .flatMap(TestExecutionResult::getThrowable) .map(Throwable::getMessage) .orElseThrow(); }
Example #19
Source File: EngineExecutionTestListener.java From ArchUnit with Apache License 2.0 | 4 votes |
FinishedTest(TestDescriptor testDescriptor, TestExecutionResult result) { this.testDescriptor = testDescriptor; this.result = result; }
Example #20
Source File: EngineExecutionTestListener.java From ArchUnit with Apache License 2.0 | 4 votes |
@Override public void executionFinished(TestDescriptor testDescriptor, TestExecutionResult testExecutionResult) { finishedTests.add(new FinishedTest(testDescriptor, testExecutionResult)); }
Example #21
Source File: ExecutionReportListener.java From junit5-extensions with MIT License | 4 votes |
@Override public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { executionReportBuilder.addResult(testIdentifier, testExecutionResult); }
Example #22
Source File: WireMockExtensionTest.java From wiremock-extension with MIT License | 4 votes |
@Override public void executionFinished(final TestIdentifier testIdentifier, final TestExecutionResult testExecutionResult) { super.executionFinished(testIdentifier, testExecutionResult); testExecutionResult.getThrowable().ifPresent(throwables::add); }
Example #23
Source File: FailingBeforeAndAfterMethodsSpringExtensionTests.java From java-technology-stack with MIT License | 4 votes |
@Override public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { super.executionFinished(testIdentifier, testExecutionResult); testExecutionResult.getThrowable().ifPresent(exceptions::add); }