コード例 #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
 public ERXTestResult doRun(Test suite) {
   testResult.addListener(this);
   long startTime = System.currentTimeMillis();
   suite.run(testResult);
   long endTime = System.currentTimeMillis();
   runTime = endTime - startTime;
   return testResult;
 }
コード例 #3
0
 /** Overrides parent method to pass in device to included test */
 @Override
 public void runTest(Test test, TestResult result) {
   if (test instanceof IDeviceTest) {
     IDeviceTest deviceTest = (IDeviceTest) test;
     deviceTest.setDevice(mDevice);
   }
   test.run(result);
 }
コード例 #4
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);
 }
コード例 #5
0
ファイル: TestRunner.java プロジェクト: league/rngzip
  public TestResult doRun(Test suite, boolean wait) {
    TestResult result = createTestResult();
    result.addListener(fPrinter);
    long startTime = System.currentTimeMillis();
    suite.run(result);
    long endTime = System.currentTimeMillis();
    long runTime = endTime - startTime;
    fPrinter.print(result, runTime);

    pause(wait);
    return result;
  }
コード例 #6
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());
 }
コード例 #7
0
ファイル: TestExecutor.java プロジェクト: billyma/aura
    @Override
    public TestResult call() throws Exception {
      Lock lock;
      if (isThreadHostile(test)) {
        // Thread hostile tests need to run alone and therefore require the write lock.
        lock = globalStateLock.writeLock();
      } else {
        // Regular tests can run concurrently
        lock = globalStateLock.readLock();
      }

      // Run the test.
      lock.lock();
      try {
        test.run(result);
        return result;
      } finally {
        lock.unlock();
      }
    }
コード例 #8
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);
    }
  }
コード例 #9
0
ファイル: GwtTest.java プロジェクト: MaxDhn/gwt-test-utils
 /** Runs a test and collects its result in a TestResult instance. */
 public void run(TestResult result) {
   test.run(result);
 }
コード例 #10
0
 public void run() {
   status = RUNNING;
   timestamp = new Date();
   test.run(result);
 }
コード例 #11
0
 @Override
 public void run(TestResult result) {
   mDelegate.run(result);
   mDelegate = null;
 }