2 * Copyright (C) 2008 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.ddmlib.testrunner;
20 * Receives event notifications during instrumentation test runs.
21 * Patterned after {@link junit.runner.TestRunListener}.
23 public interface ITestRunListener {
26 * Types of test failures.
29 /** Test failed due to unanticipated uncaught exception. */
31 /** Test failed due to a false assertion. */
36 * Reports the start of a test run.
38 * @param testCount total number of tests in test run
40 public void testRunStarted(int testCount);
43 * Reports end of test run.
45 * @param elapsedTime device reported elapsed time, in milliseconds
47 public void testRunEnded(long elapsedTime);
50 * Reports test run stopped before completion.
52 * @param elapsedTime device reported elapsed time, in milliseconds
54 public void testRunStopped(long elapsedTime);
57 * Reports the start of an individual test case.
59 * @param test identifies the test
61 public void testStarted(TestIdentifier test);
64 * Reports the execution end of an individual test case.
65 * If {@link #testFailed} was not invoked, this test passed.
67 * @param test identifies the test
69 public void testEnded(TestIdentifier test);
72 * Reports the failure of a individual test case.
73 * Will be called between testStarted and testEnded.
75 * @param status failure type
76 * @param test identifies the test
77 * @param trace stack trace of failure
79 public void testFailed(TestFailure status, TestIdentifier test, String trace);
82 * Reports test run failed to execute due to a fatal error.
84 public void testRunFailed(String errorMessage);