Java Code Examples for org.junit.platform.launcher.listeners.TestExecutionSummary#Failure
The following examples show how to use
org.junit.platform.launcher.listeners.TestExecutionSummary#Failure .
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: RunSellContractTests.java From btdex with GNU General Public License v3.0 | 6 votes |
private static void printReport(TestExecutionSummary summary) { System.out.println( "\n------------------------------------------" + "\nTests started: " + summary.getTestsStartedCount() + "\nTests failed: " + summary.getTestsFailedCount() + "\nTests succeeded: " + summary.getTestsSucceededCount() + "\n------------------------------------------" ); if(summary.getTestsFailedCount() > 0) { for(TestExecutionSummary.Failure f: summary.getFailures()){ System.out.println(f.getTestIdentifier().getSource() + "\nException " + f.getException()); } } }
Example 2
Source File: JunitPlatformDoer.java From jeka with Apache License 2.0 | 6 votes |
private static JkTestResult.JkFailure toFailure(TestExecutionSummary.Failure failure) { JkTestResult.JkTestIdentifier.JkType type; switch (failure.getTestIdentifier().getType()) { case CONTAINER: type = JkTestResult.JkTestIdentifier.JkType.CONTAINER; break; case CONTAINER_AND_TEST: type = JkTestResult.JkTestIdentifier.JkType.CONTAINER_AND_TEST; break; default: type = JkTestResult.JkTestIdentifier.JkType.TEST; break; } String testId = failure.getTestIdentifier().getUniqueId(); String displayName = failure.getTestIdentifier().getDisplayName(); Set<String> tags = failure.getTestIdentifier().getTags().stream().map(TestTag::toString) .collect(Collectors.toSet()); JkTestResult.JkTestIdentifier id = JkTestResult.JkTestIdentifier.of(type, testId, displayName, tags); return JkTestResult.JkFailure.of(id, failure.getException().getMessage(), failure.getException().getStackTrace()); }
Example 3
Source File: JUnit5Tests.java From quickperf with Apache License 2.0 | 4 votes |
public int getNumberOfFailures() { List<TestExecutionSummary.Failure> failures = testExecutionSummary.getFailures(); return failures.size(); }
Example 4
Source File: JUnit5TestRunner.java From quickperf with Apache License 2.0 | 4 votes |
private List<Throwable> convertToThrowables(List<TestExecutionSummary.Failure> failures) { return failures.stream() .map(TestExecutionSummary.Failure::getException) .collect(toList()); }
Example 5
Source File: TestRunner.java From meghanada-server with GNU General Public License v3.0 | 4 votes |
private void runJUnit(String arg, LauncherDiscoveryRequest request) { Stopwatch stopwatch = Stopwatch.createStarted(); System.out.println(String.format("Running %s", arg)); System.out.println(); Launcher launcher = LauncherFactory.create(); SummaryGeneratingListener listener = new SummaryGeneratingListener(); launcher.execute(request, listener); TestExecutionSummary summary = listener.getSummary(); this.runCnt += summary.getTestsFoundCount(); this.failureCnt += summary.getTestsFailedCount(); this.ignoreCnt += summary.getTestsSkippedCount(); this.ignoreCnt += summary.getTestsSkippedCount(); System.out.println(); if (summary.getTestsFailedCount() > 0) { System.out.println( String.format( "FAIL Tests run: %d, Failures: %d, Ignore: %d, Time elapsed: %s", summary.getTestsFoundCount(), summary.getTestsFailedCount(), summary.getTestsSkippedCount(), stopwatch.stop())); System.out.println("Failures:"); for (TestExecutionSummary.Failure failure : summary.getFailures()) { System.out.println(failure.getTestIdentifier().getDisplayName()); failure.getException().printStackTrace(); System.out.println(); } } else { System.out.println( String.format( "Tests run: %d, Failures: %d, Ignore: %d, Time elapsed: %s", summary.getTestsFoundCount(), summary.getTestsFailedCount(), summary.getTestsSkippedCount(), stopwatch.stop())); System.out.println("Success"); } System.out.println(Strings.repeat("-", 80)); }
Example 6
Source File: JunitRunner.java From vespa with Apache License 2.0 | 4 votes |
private void serializeFailure(TestExecutionSummary.Failure failure, Cursor slime) { var testIdentifier = failure.getTestIdentifier(); slime.setString("testName", testIdentifier.getUniqueId()); slime.setString("testError",failure.getException().getMessage()); slime.setString("exception", ExceptionUtils.getStackTraceAsString(failure.getException())); }
Example 7
Source File: JUnit5TestRunner.java From quickperf with Apache License 2.0 | 3 votes |
@Override public TestIssue executeTestMethod(Class<?> testClass, String methodName) { TestExecutionSummary testResult = runTestMethod(testClass, methodName); List<TestExecutionSummary.Failure> failures = testResult.getFailures(); List<Throwable> jUnit5failuresAsThrowables = convertToThrowables(failures); return TestIssue.buildInNewJvmFrom(jUnit5failuresAsThrowables); }