Example #1
0
    public void report() throws DispatchStateException {
      if (m_dispatchTime < 0) {
        throw new DispatchStateException("No statistics to report");
      }

      final StatisticsSet statistics = m_statisticsForTest.getStatistics();

      m_testStatisticsHelper.recordTest(statistics, getElapsedTime());

      m_resultReporter.report(getTest(), m_startTime, statistics);

      if (m_testStatisticsHelper.getSuccess(statistics)) {
        getTestStatistics().add(statistics);
      } else {
        // If an error, we consider other information to be unreliable,
        // so do not aggregate it.
        m_testStatisticsHelper.incrementErrors(getTestStatistics());
      }

      // Disassociate ourselves from m_statisticsForTest;
      m_statisticsForTest.freeze();
      m_statisticsForTest = null;

      m_startTime = -1;
      m_dispatchTime = -1;
    }
Example #2
0
    public void end(boolean success) {
      m_dispatchTime = Math.max(m_timeAuthority.getTimeInMilliseconds() - m_startTime, 0);

      if (m_pauseTimer.isRunning()) {
        m_pauseTimer.stop();
      }

      if (!success && m_statisticsForTest != null) {
        // Always mark as an error if the test threw an exception.
        m_testStatisticsHelper.setSuccess(m_statisticsForTest.getStatistics(), false);

        // We don't log the exception. If the script doesn't handle the
        // exception it will be logged when the run is aborted,
        // otherwise we assume the script writer knows what they're
        // doing.
      }
    }