Interface ITestRunListener

  • All Known Implementing Classes:
    TestRunResult, XmlTestRunListener

    public interface ITestRunListener
    Receives event notifications during instrumentation test runs.

    Patterned after org.junit.runner.notification.RunListener

    The sequence of calls will be:

    • testRunStarted
    • testStarted
    • [testFailed]
    • [testAssumptionFailure]
    • [testIgnored]
    • testEnded
    • ....
    • [testRunFailed]
    • testRunEnded
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void testAssumptionFailure​(TestIdentifier test, java.lang.String trace)
      Called when an atomic test flags that it assumes a condition that is false
      void testEnded​(TestIdentifier test, java.util.Map<java.lang.String,​java.lang.String> testMetrics)
      Reports the execution end of an individual test case.
      void testFailed​(TestIdentifier test, java.lang.String trace)
      Reports the failure of a individual test case.
      void testIgnored​(TestIdentifier test)
      Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore.
      void testRunEnded​(long elapsedTime, java.util.Map<java.lang.String,​java.lang.String> runMetrics)
      Reports end of test run.
      void testRunFailed​(java.lang.String errorMessage)
      Reports test run failed to complete due to a fatal error.
      void testRunStarted​(java.lang.String runName, int testCount)
      Reports the start of a test run.
      void testRunStopped​(long elapsedTime)
      Reports test run stopped before completion due to a user request.
      void testStarted​(TestIdentifier test)
      Reports the start of an individual test case.
    • Method Detail

      • testRunStarted

        void testRunStarted​(java.lang.String runName,
                            int testCount)
        Reports the start of a test run.
        Parameters:
        runName - the test run name
        testCount - total number of tests in test run
      • testStarted

        void testStarted​(TestIdentifier test)
        Reports the start of an individual test case.
        Parameters:
        test - identifies the test
      • testFailed

        void testFailed​(TestIdentifier test,
                        java.lang.String trace)
        Reports the failure of a individual test case.

        Will be called between testStarted and testEnded.

        Parameters:
        test - identifies the test
        trace - stack trace of failure
      • testAssumptionFailure

        void testAssumptionFailure​(TestIdentifier test,
                                   java.lang.String trace)
        Called when an atomic test flags that it assumes a condition that is false
        Parameters:
        test - identifies the test
        trace - stack trace of failure
      • testIgnored

        void testIgnored​(TestIdentifier test)
        Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore.
        Parameters:
        test - identifies the test
      • testEnded

        void testEnded​(TestIdentifier test,
                       java.util.Map<java.lang.String,​java.lang.String> testMetrics)
        Reports the execution end of an individual test case.

        If testFailed(com.android.ddmlib.testrunner.TestIdentifier, java.lang.String) was not invoked, this test passed. Also returns any key/value metrics which may have been emitted during the test case's execution.

        Parameters:
        test - identifies the test
        testMetrics - a Map of the metrics emitted
      • testRunFailed

        void testRunFailed​(java.lang.String errorMessage)
        Reports test run failed to complete due to a fatal error.
        Parameters:
        errorMessage - String describing reason for run failure.
      • testRunStopped

        void testRunStopped​(long elapsedTime)
        Reports test run stopped before completion due to a user request.

        TODO: currently unused, consider removing

        Parameters:
        elapsedTime - device reported elapsed time, in milliseconds
      • testRunEnded

        void testRunEnded​(long elapsedTime,
                          java.util.Map<java.lang.String,​java.lang.String> runMetrics)
        Reports end of test run.
        Parameters:
        elapsedTime - device reported elapsed time, in milliseconds
        runMetrics - key-value pairs reported at the end of a test run