com.android.ddmlib.testrunner
Interface IRemoteAndroidTestRunner

All Known Implementing Classes:
RemoteAndroidTestRunner

public interface IRemoteAndroidTestRunner

Interface for running a Android test command remotely and reporting result to a listener.


Nested Class Summary
static class IRemoteAndroidTestRunner.TestSize
           
 
Method Summary
 void addBooleanArg(String name, boolean value)
          Adds a boolean argument to include in instrumentation command.
 void addInstrumentationArg(String name, String value)
          Adds a argument to include in instrumentation command.
 void cancel()
          Requests cancellation of this test run.
 String getPackageName()
          Returns the application package name.
 String getRunnerName()
          Returns the runnerName.
 void removeInstrumentationArg(String name)
          Removes a previously added argument.
 void run(Collection<ITestRunListener> listeners)
          Execute this test run.
 void run(ITestRunListener... listeners)
          Execute this test run.
 void setClassName(String className)
          Sets to run only tests in this class Must be called before 'run'.
 void setClassNames(String[] classNames)
          Sets to run only tests in the provided classes Must be called before 'run'.
 void setCoverage(boolean coverage)
          Sets this code coverage mode of this test run.
 void setDebug(boolean debug)
          Sets this debug mode of this test run.
 void setLogOnly(boolean logOnly)
          Sets this test run to log only mode - skips test execution.
 void setMaxtimeToOutputResponse(int maxTimeToOutputResponse)
          Sets the maximum time allowed between output of the shell command running the tests on the devices.
 void setMethodName(String className, String testName)
          Sets to run only specified test method Must be called before 'run'.
 void setRunName(String runName)
          Set a custom run name to be reported to the ITestRunListener on run(com.android.ddmlib.testrunner.ITestRunListener...)

If unspecified, will use package name

 void setTestPackageName(String packageName)
          Sets to run all tests in specified package Must be called before 'run'.
 void setTestSize(IRemoteAndroidTestRunner.TestSize size)
          Sets to run only tests of given size.
 

Method Detail

getPackageName

String getPackageName()
Returns the application package name.


getRunnerName

String getRunnerName()
Returns the runnerName.


setClassName

void setClassName(String className)
Sets to run only tests in this class Must be called before 'run'.

Parameters:
className - fully qualified class name (eg x.y.z)

setClassNames

void setClassNames(String[] classNames)
Sets to run only tests in the provided classes Must be called before 'run'.

If providing more than one class, requires a InstrumentationTestRunner that supports the multiple class argument syntax.

Parameters:
classNames - array of fully qualified class names (eg x.y.z)

setMethodName

void setMethodName(String className,
                   String testName)
Sets to run only specified test method Must be called before 'run'.

Parameters:
className - fully qualified class name (eg x.y.z)
testName - method name

setTestPackageName

void setTestPackageName(String packageName)
Sets to run all tests in specified package Must be called before 'run'.

Parameters:
packageName - fully qualified package name (eg x.y.z)

setTestSize

void setTestSize(IRemoteAndroidTestRunner.TestSize size)
Sets to run only tests of given size. Must be called before 'run'.

Parameters:
size - the IRemoteAndroidTestRunner.TestSize to run.

addInstrumentationArg

void addInstrumentationArg(String name,
                           String value)
Adds a argument to include in instrumentation command.

Must be called before 'run'. If an argument with given name has already been provided, it's value will be overridden.

Parameters:
name - the name of the instrumentation bundle argument
value - the value of the argument

removeInstrumentationArg

void removeInstrumentationArg(String name)
Removes a previously added argument.

Parameters:
name - the name of the instrumentation bundle argument to remove

addBooleanArg

void addBooleanArg(String name,
                   boolean value)
Adds a boolean argument to include in instrumentation command.

Parameters:
name - the name of the instrumentation bundle argument
value - the value of the argument
See Also:
RemoteAndroidTestRunner.addInstrumentationArg(java.lang.String, java.lang.String)

setLogOnly

void setLogOnly(boolean logOnly)
Sets this test run to log only mode - skips test execution.


setDebug

void setDebug(boolean debug)
Sets this debug mode of this test run. If true, the Android test runner will wait for a debugger to attach before proceeding with test execution.


setCoverage

void setCoverage(boolean coverage)
Sets this code coverage mode of this test run.


setMaxtimeToOutputResponse

void setMaxtimeToOutputResponse(int maxTimeToOutputResponse)
Sets the maximum time allowed between output of the shell command running the tests on the devices.

This allows setting a timeout in case the tests can become stuck and never finish. This is different from the normal timeout on the connection.

By default no timeout will be specified.

See Also:
IDevice#executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, int)}

setRunName

void setRunName(String runName)
Set a custom run name to be reported to the ITestRunListener on run(com.android.ddmlib.testrunner.ITestRunListener...)

If unspecified, will use package name

Parameters:
runName -

run

void run(ITestRunListener... listeners)
         throws TimeoutException,
                AdbCommandRejectedException,
                ShellCommandUnresponsiveException,
                IOException
Execute this test run.

Convenience method for run(Collection).

Parameters:
listeners - listens for test results
Throws:
TimeoutException - in case of a timeout on the connection.
AdbCommandRejectedException - if adb rejects the command
ShellCommandUnresponsiveException - if the device did not output any test result for a period longer than the max time to output.
IOException - if connection to device was lost.
See Also:
setMaxtimeToOutputResponse(int)

run

void run(Collection<ITestRunListener> listeners)
         throws TimeoutException,
                AdbCommandRejectedException,
                ShellCommandUnresponsiveException,
                IOException
Execute this test run.

Parameters:
listeners - collection of listeners for test results
Throws:
TimeoutException - in case of a timeout on the connection.
AdbCommandRejectedException - if adb rejects the command
ShellCommandUnresponsiveException - if the device did not output any test result for a period longer than the max time to output.
IOException - if connection to device was lost.
See Also:
setMaxtimeToOutputResponse(int)

cancel

void cancel()
Requests cancellation of this test run.



Copyright © 2008-2012. All Rights Reserved.