コード例 #1
0
 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());
 }
コード例 #2
0
ファイル: TestCaseTest.java プロジェクト: MariusCC/JavaGenes
 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);
 }
コード例 #3
0
ファイル: TestCaseTest.java プロジェクト: MariusCC/JavaGenes
 public void testExceptionRunningAndTearDown() {
   // This test documents the current behavior. With 1.4, we should
   // wrap the exception thrown while running with the exception thrown
   // while tearing down
   Test t =
       new TornDown() {
         public void tearDown() {
           throw new Error("tearDown");
         }
       };
   TestResult result = new TestResult();
   t.run(result);
   TestFailure failure = (TestFailure) result.errors().nextElement();
   assertEquals("tearDown", failure.thrownException().getMessage());
 }
コード例 #4
0
ファイル: TestAll.java プロジェクト: rgb/intellij-community
  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);
    }
  }
コード例 #5
0
ファイル: Top.java プロジェクト: kishida/synthesijer
 @auto
 public void main() {
   test.run();
 }