OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / sdk / ddms / libs / ddmlib / src / com / android / ddmlib / testrunner / ITestRunListener.java
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package com.android.ddmlib.testrunner;
18
19 /**
20  * Receives event notifications during instrumentation test runs. 
21  * Patterned after {@link junit.runner.TestRunListener}.
22  */
23 public interface ITestRunListener {
24
25     /**
26      *  Types of test failures.
27      */
28     enum TestFailure {
29         /** Test failed due to unanticipated uncaught exception. */
30         ERROR,
31         /** Test failed due to a false assertion. */
32         FAILURE
33     }
34
35     /** 
36      * Reports the start of a test run.
37      * 
38      * @param testCount total number of tests in test run
39      */
40     public void testRunStarted(int testCount);
41     
42     /**
43      * Reports end of test run.
44      * 
45      * @param elapsedTime device reported elapsed time, in milliseconds
46      */
47     public void testRunEnded(long elapsedTime);
48
49     /**
50      * Reports test run stopped before completion.
51      * 
52      * @param elapsedTime device reported elapsed time, in milliseconds
53      */
54     public void testRunStopped(long elapsedTime);
55
56     /**
57      * Reports the start of an individual test case.
58      * 
59      * @param test identifies the test
60      */
61     public void testStarted(TestIdentifier test);
62
63     /**
64      * Reports the execution end of an individual test case.
65      * If {@link #testFailed} was not invoked, this test passed.
66      * 
67      * @param test identifies the test
68      */
69     public void testEnded(TestIdentifier test);
70
71     /**
72      * Reports the failure of a individual test case.
73      * Will be called between testStarted and testEnded.
74      * 
75      * @param status failure type
76      * @param test identifies the test
77      * @param trace stack trace of failure
78      */
79     public void testFailed(TestFailure status, TestIdentifier test, String trace);
80     
81     /** 
82      * Reports test run failed to execute due to a fatal error.
83      */
84     public void testRunFailed(String errorMessage);
85 }