Java Code Examples for org.junit.runner.Result#getIgnoreCount()
The following examples show how to use
org.junit.runner.Result#getIgnoreCount() .
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: TestRunner.java From calcite-avatica with Apache License 2.0 | 6 votes |
/** * Updates the current state of <code>this</code> with the <code>result</code>. * * @param testClass The test class executed. * @param result The results of the test class execution. * @return <code>this</code> */ public TestResults merge(Class<?> testClass, Result result) { LOG.info("Tests run: {}, Failures: {}, Skipped: {}, Time elapsed: {} - in {}", result.getRunCount(), result.getFailureCount(), result.getIgnoreCount(), TimeUnit.SECONDS.convert(result.getRunTime(), TimeUnit.MILLISECONDS), testClass.getName()); numRun += result.getRunCount(); numFailed += result.getFailureCount(); numIgnored += result.getIgnoreCount(); // Collect the failures if (!result.wasSuccessful()) { failures.addAll(result.getFailures()); } return this; }
Example 2
Source File: TestListener.java From bazel with Apache License 2.0 | 6 votes |
/** * Called when all tests have finished. Prints to stdout if the tests were successful or not. If * not, it also prints the number of failed test cases. Finally, it prints the number of * ignored test cases. * * @param result the summary of the test run, including all the tests that failed */ @Override public void testRunFinished(Result result) throws Exception { if (result.wasSuccessful()) { System.out.println("Successfully finished running " + formatTestCaseCount(result.getRunCount()) + " in " + result.getRunTime() + " ms."); } else { System.out.println("Finished running " + formatTestCaseCount(result.getRunCount()) + " in " + result.getRunTime() + " ms."); int failureCount = result.getFailureCount(); if (failureCount == 1) { System.out.println("There was 1 failed test."); } else { System.out.println("There were " + failureCount + " failed tests."); } } int ignoredCount = result.getIgnoreCount(); if (ignoredCount == 1) { System.out.println(result.getIgnoreCount() + " test case was ignored."); } else if (ignoredCount > 1) { System.out.println(result.getIgnoreCount() + " test cases were ignored."); } }
Example 3
Source File: UnitTestResult.java From camel-spring-boot with Apache License 2.0 | 5 votes |
public UnitTestResult(Result jr) { this.runCount = jr.getRunCount(); this.failureCount = jr.getFailureCount(); this.runTime = jr.getRunTime(); this.ignoreCount = jr.getIgnoreCount(); this.successful = jr.wasSuccessful(); }
Example 4
Source File: TestResult.java From lambda-selenium with MIT License | 5 votes |
public TestResult(Result result) { runCount = result.getRunCount(); failureCount = result.getFailureCount(); ignoreCount = result.getIgnoreCount(); runTime = result.getRunTime(); if (!wasSuccessful()) { throwable = result.getFailures().get(0).getException(); } }
Example 5
Source File: CompoundResult.java From nopol with GNU General Public License v2.0 | 5 votes |
@Override public int getIgnoreCount() { int total = 0; for (Result result : results()) { total += result.getIgnoreCount(); } return total; }
Example 6
Source File: TestRunner.java From at.info-knowledge-base with MIT License | 5 votes |
@Test public void test() { Request request = Request.method(testMethod.getDeclaringClass(), testMethod.getName()); Result result = new JUnitCore().run(request); if (result.getIgnoreCount() > 0) throw new AssumptionViolatedException("Test " + testMethod.getDeclaringClass() + "." + testMethod.getName() + " were ignored"); if (result.getFailureCount() > 0) { Assert.fail(result.getFailures().toString()); } }
Example 7
Source File: TestSuiteExecutor.java From dekaf with Apache License 2.0 | 5 votes |
public static void run(final Class... suites) { boolean underTC = System.getenv(TEAMCITY_DETECT_VAR_NAME) != null; // prepare junit JUnitSystem system = new RealSystem(); JUnitCore core = new JUnitCore(); RunListener listener = underTC ? new TeamCityListener() : new TextListener(system); core.addListener(listener); int success = 0, failures = 0, ignores = 0; // run tests for (Class suite : suites) { sayNothing(); String suiteName = suite.getSimpleName(); if (suiteName.endsWith("Tests")) suiteName = suiteName.substring(0, suiteName.length()-"Tests".length()); if (suiteName.endsWith("Integration")) suiteName = suiteName.substring(0, suiteName.length()-"Integration".length()); if (suiteParameter != null) suiteName = suiteName + '[' + suiteParameter + ']'; if (underTC) say("##teamcity[testSuiteStarted name='%s']", suiteName); Result result = core.run(suite); success += result.getRunCount() - (result.getFailureCount() + result.getIgnoreCount()); failures += result.getFailureCount(); ignores += result.getIgnoreCount(); if (underTC) say("##teamcity[testSuiteFinished name='%s']", suiteName); sayNothing(); } }