Build 1.0_r1(from source)

android.test
Class TestRunner

java.lang.Object
  extended by android.test.TestRunner
All Implemented Interfaces:
PerformanceTestCase.Intermediates

public class TestRunner
extends Object
implements PerformanceTestCase.Intermediates

Support class that actually runs a test. Android uses this class, and you probably will not need to instantiate, extend, or call this class yourself. See the full android.test package description to learn more about testing Android applications. Not needed for 1.0 SDK.


Nested Class Summary
static class TestRunner.IntermediateTime
          Listener.performance() 'intermediates' argument is a list of these.
 class TestRunner.JunitTestSuite
           
static interface TestRunner.Listener
          Support class that receives status on test progress.
 
Field Summary
static int CLEARSCREEN
           
(package private)  List<TestRunner.IntermediateTime> mIntermediates
           
static int PERFORMANCE
           
static int PROFILING
           
static int REGRESSION
           
 
Constructor Summary
TestRunner(Context context)
           
 
Method Summary
 void addIntermediate(String name)
           
 void addIntermediate(String name, long timeInNS)
           
 void addListener(TestRunner.Listener listener)
           
static int countJunitTests(Class clazz)
           
static int countTests(Context c, String className)
          Returns the number of tests that will be run if you try to do this.
 void failed(String className, Throwable exception)
           
 int failedCount()
           
 void finishProfiling()
           
 void finishTiming(boolean realTime)
           
static Method[] getAllTestMethods(Class clazz)
           
static String[] getChildren(Context c, String className)
           
static String[] getChildren(Method m)
           
static Method getChildrenMethod(Class clazz)
           
static Method getChildrenMethod(Context c, String className)
           
static String[] getTestChildren(Class clazz)
           
static String[] getTestChildren(Context c, String className)
           
static String getTitle(String className)
          Returns a title to display given the className of a test.
 boolean isJunitTest(String className)
           
static boolean isTestSuite(Context c, String className)
           
 void passed(String className)
           
 int passedCount()
           
 void run(String className)
           
 void run(String[] classes)
           
 void runInPerformanceMode(Object testCase, String className, boolean junitTest, String testNameInDb)
           
 void runSingleJunitTest(String className)
           
 void setInternalIterations(int count)
           
 void setPerformanceMode(int mode)
           
 void startProfiling()
           
 void startTiming(boolean realTime)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REGRESSION

public static final int REGRESSION
See Also:
Constant Field Values

PERFORMANCE

public static final int PERFORMANCE
See Also:
Constant Field Values

PROFILING

public static final int PROFILING
See Also:
Constant Field Values

CLEARSCREEN

public static final int CLEARSCREEN
See Also:
Constant Field Values

mIntermediates

List<TestRunner.IntermediateTime> mIntermediates
Constructor Detail

TestRunner

public TestRunner(Context context)
Method Detail

addListener

public void addListener(TestRunner.Listener listener)

startProfiling

public void startProfiling()

finishProfiling

public void finishProfiling()

passed

public void passed(String className)

failed

public void failed(String className,
                   Throwable exception)

passedCount

public int passedCount()

failedCount

public int failedCount()

run

public void run(String[] classes)

setInternalIterations

public void setInternalIterations(int count)
Specified by:
setInternalIterations in interface PerformanceTestCase.Intermediates

startTiming

public void startTiming(boolean realTime)
Specified by:
startTiming in interface PerformanceTestCase.Intermediates

addIntermediate

public void addIntermediate(String name)
Specified by:
addIntermediate in interface PerformanceTestCase.Intermediates

addIntermediate

public void addIntermediate(String name,
                            long timeInNS)
Specified by:
addIntermediate in interface PerformanceTestCase.Intermediates

finishTiming

public void finishTiming(boolean realTime)
Specified by:
finishTiming in interface PerformanceTestCase.Intermediates

setPerformanceMode

public void setPerformanceMode(int mode)

run

public void run(String className)

runInPerformanceMode

public void runInPerformanceMode(Object testCase,
                                 String className,
                                 boolean junitTest,
                                 String testNameInDb)
                          throws Exception
Throws:
Exception

runSingleJunitTest

public void runSingleJunitTest(String className)

getChildrenMethod

public static Method getChildrenMethod(Class clazz)

getChildrenMethod

public static Method getChildrenMethod(Context c,
                                       String className)

getChildren

public static String[] getChildren(Context c,
                                   String className)

getChildren

public static String[] getChildren(Method m)

getTestChildren

public static String[] getTestChildren(Context c,
                                       String className)

getTestChildren

public static String[] getTestChildren(Class clazz)

getAllTestMethods

public static Method[] getAllTestMethods(Class clazz)

countJunitTests

public static int countJunitTests(Class clazz)

isTestSuite

public static boolean isTestSuite(Context c,
                                  String className)

isJunitTest

public boolean isJunitTest(String className)

countTests

public static int countTests(Context c,
                             String className)
Returns the number of tests that will be run if you try to do this.


getTitle

public static String getTitle(String className)
Returns a title to display given the className of a test.

Currently this function just returns the portion of the class name after the last '.'


Build 1.0_r1(from source)

Please submit a feedback, bug or feature