Class TestResult


  • public class TestResult
    extends java.lang.Object
    A TestResult collects the results of executing a test case. It is an instance of the Collecting Parameter pattern. The test framework distinguishes between failures and errors. A failure is anticipated and checked for with assertions. Errors are unanticipated problems like an ArrayIndexOutOfBoundsException.
    See Also:
    Test
    • Method Detail

      • addError

        public void addError​(Test test,
                             java.lang.Throwable e)
        Adds an error to the list of errors. The passed in exception caused the error.
      • endTest

        public void endTest​(Test test)
        Informs the result that a test was completed.
      • errorCount

        public int errorCount()
        Gets the number of detected errors.
      • errors

        public java.util.Enumeration<TestFailureerrors()
        Returns an Enumeration for the errors.
      • failureCount

        public int failureCount()
        Gets the number of detected failures.
      • failures

        public java.util.Enumeration<TestFailurefailures()
        Returns an Enumeration for the failures.
      • run

        protected void run​(TestCase test)
        Runs a TestCase.
      • runCount

        public int runCount()
        Gets the number of run tests.
      • shouldStop

        public boolean shouldStop()
        Checks whether the test run should stop.
      • startTest

        public void startTest​(Test test)
        Informs the result that a test will be started.
      • stop

        public void stop()
        Marks that the test run should stop.
      • wasSuccessful

        public boolean wasSuccessful()
        Returns whether the entire test was successful or not.