public void testActiveRepeatedTest1() { Test test = new RepeatedTest(createActiveTestSuite(), 1); TestResult result = new TestResult(); test.run(result); assertEquals(100, result.runCount()); assertEquals(0, result.failureCount()); assertEquals(0, result.errorCount()); }
public void testNoArgTestCasePasses() { Test t = new TestSuite(NoArgTestCaseTest.class); TestResult result = new TestResult(); t.run(result); assertTrue(result.runCount() == 1); assertTrue(result.failureCount() == 0); assertTrue(result.errorCount() == 0); }
public static void main(String args[]) throws Exception { final TestRunner runner = new TestRunner(); final TestResult result = runner.doRun(StopDomainCommandTest.suite(), false); System.exit(result.errorCount() + result.failureCount()); }
private void runNextTest(final TestResult testResult, int totalTests, Class testCaseClass) { myRunTests++; if (!checkAvaliableMemory(35, testResult)) { testResult.stop(); return; } if (testResult.errorCount() + testResult.failureCount() > MAX_FAILURE_TEST_COUNT) { addErrorMessage( testResult, "Too many errors. Tests stopped. Total " + myRunTests + " of " + totalTests + " tests run"); testResult.stop(); return; } if (myStartTime == 0) { boolean ourClassLoader = getClass().getClassLoader().getClass().getName().startsWith("com.intellij."); if (!ourClassLoader) { beforeFirstTest(); } } else { if (myInterruptedByOutOfTime) { addErrorMessage( testResult, "Current Test Interrupted: OUT OF TIME! Class = " + myLastTestClass + " Total " + myRunTests + " of " + totalTests + " tests run"); testResult.stop(); return; } } log("\nRunning " + testCaseClass.getName()); final Test test = getTest(testCaseClass); if (test == null) return; myLastTestClass = null; myLastTestClass = testCaseClass.getName(); myLastTestStartTime = System.currentTimeMillis(); myLastTestTestMethodCount = test.countTestCases(); try { test.run(testResult); } catch (Throwable t) { if (t instanceof OutOfMemoryError) { if ((ourMode & SAVE_MEMORY_SNAPSHOT) != 0) { try { mySavingMemorySnapshot = true; log("OutOfMemoryError detected. Saving memory snapshot started"); } finally { log("Saving memory snapshot finished"); mySavingMemorySnapshot = false; } } } testResult.addError(test, t); } }
public static void main(String[] args) throws RuntimeException { TestResult tr = junit.textui.TestRunner.run(suite()); if ((tr.errorCount() != 0) || (tr.failureCount() != 0)) { throw new RuntimeException("### Unexpected JUnit errors or failures."); } }
void verifySuccess(TestCase test) { TestResult result = test.run(); assertTrue(result.runCount() == 1); assertTrue(result.failureCount() == 0); assertTrue(result.errorCount() == 0); }