RemoteAndroidTestRunner

public class RemoteAndroidTestRunner
extends Object implements IRemoteAndroidTestRunner

java.lang.Object
   ↳ com.android.tradefed.result.ddmlib.RemoteAndroidTestRunner


Runs a Android test command remotely and reports results.

Summary

Public constructors

RemoteAndroidTestRunner(String packageName, IShellEnabledDevice remoteDevice)

Alternate constructor.

RemoteAndroidTestRunner(String packageName, String runnerName, IShellEnabledDevice remoteDevice)

Alternate constructor.

RemoteAndroidTestRunner(String packageName, String runnerName, IShellEnabledDevice remoteDevice, RemoteAndroidTestRunner.StatusReporterMode statusReporterMode)

Creates a remote Android test runner.

Public methods

void addBooleanArg(String name, boolean value)
void addInstrumentationArg(String name, String value)
void cancel()
IInstrumentationResultParser createParser(String runName, listeners)

Create the InstrumentationResultParser that will be used to parse the instrumentation output.

String getAmInstrumentCommand()
IRemoteAndroidTestRunner.CoverageOutput getCoverageOutputType()
String getPackageName()
String getRunOptions()

Returns options for the am instrument command.

String getRunnerName()
void removeInstrumentationArg(String name)
void run(ITestRunListener... listeners)
void run( listeners)
void setAdditionalTestOutputLocation(String additionalTestDataPath)
void setClassName(String className)
void setClassNames(String[] classNames)
void setCoverage(boolean coverage)
void setCoverageReportLocation(String reportPath)
void setDebug(boolean debug)
void setLogOnly(boolean logOnly)
void setMaxTimeToOutputResponse(long maxTimeToOutputResponse, TimeUnit maxTimeUnits)
void setMaxTimeout(long maxTimeout, TimeUnit maxTimeUnits)
void setMaxtimeToOutputResponse(int maxTimeToOutputResponse)
void setMethodName(String className, String testName)
void setRunName(String runName)
void setRunOptions(String options)

Sets options for the am instrument command.

void setTestCollection(boolean collect)
void setTestPackageName(String packageName)
void setTestSize(IRemoteAndroidTestRunner.TestSize size)

Protected methods

String getArgsCommand()

Returns the full instrumentation command line syntax for the provided instrumentation arguments.

String getRunnerPath()

Returns the complete instrumentation component path.

Public constructors

RemoteAndroidTestRunner

public RemoteAndroidTestRunner (String packageName, 
                IShellEnabledDevice remoteDevice)

Alternate constructor. Uses default instrumentation runner.

Parameters
packageName String: the Android application package that contains the tests to run

remoteDevice IShellEnabledDevice: the Android device to execute tests on

RemoteAndroidTestRunner

public RemoteAndroidTestRunner (String packageName, 
                String runnerName, 
                IShellEnabledDevice remoteDevice)

Alternate constructor. Uses default statusReporterMode.

Parameters
packageName String: the Android application package that contains the tests to run

runnerName String: the instrumentation test runner to execute. If null, will use default runner

remoteDevice IShellEnabledDevice: the Android device to execute tests on

RemoteAndroidTestRunner

public RemoteAndroidTestRunner (String packageName, 
                String runnerName, 
                IShellEnabledDevice remoteDevice, 
                RemoteAndroidTestRunner.StatusReporterMode statusReporterMode)

Creates a remote Android test runner.

Parameters
packageName String: the Android application package that contains the tests to run

runnerName String: the instrumentation test runner to execute. If null, will use default runner

remoteDevice IShellEnabledDevice: the Android device to execute tests on

statusReporterMode RemoteAndroidTestRunner.StatusReporterMode: the status reporter mode to be used for am instrument command

Public methods

addBooleanArg

public void addBooleanArg (String name, 
                boolean value)

Parameters
name String

value boolean

addInstrumentationArg

public void addInstrumentationArg (String name, 
                String value)

Parameters
name String

value String

cancel

public void cancel ()

createParser

public IInstrumentationResultParser createParser (String runName, 
                 listeners)

Create the InstrumentationResultParser that will be used to parse the instrumentation output.

Parameters
runName String: The name of the run to use.

listeners : The listeners where to report the results.

Returns
IInstrumentationResultParser An instance of InstrumentationResultParser.

getAmInstrumentCommand

public String getAmInstrumentCommand ()

Returns
String

getCoverageOutputType

public IRemoteAndroidTestRunner.CoverageOutput getCoverageOutputType ()

Returns
IRemoteAndroidTestRunner.CoverageOutput

getPackageName

public String getPackageName ()

Returns
String

getRunOptions

public String getRunOptions ()

Returns options for the am instrument command.

Returns
String

getRunnerName

public String getRunnerName ()

Returns
String

removeInstrumentationArg

public void removeInstrumentationArg (String name)

Parameters
name String

run

public void run (ITestRunListener... listeners)

Parameters
listeners ITestRunListener

Throws
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

run

public void run ( listeners)

Parameters
listeners

Throws
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

setAdditionalTestOutputLocation

public void setAdditionalTestOutputLocation (String additionalTestDataPath)

Parameters
additionalTestDataPath String

setClassName

public void setClassName (String className)

Parameters
className String

setClassNames

public void setClassNames (String[] classNames)

Parameters
classNames String

setCoverage

public void setCoverage (boolean coverage)

Parameters
coverage boolean

setCoverageReportLocation

public void setCoverageReportLocation (String reportPath)

Parameters
reportPath String

setDebug

public void setDebug (boolean debug)

Parameters
debug boolean

setLogOnly

public void setLogOnly (boolean logOnly)

Parameters
logOnly boolean

setMaxTimeToOutputResponse

public void setMaxTimeToOutputResponse (long maxTimeToOutputResponse, 
                TimeUnit maxTimeUnits)

Parameters
maxTimeToOutputResponse long

maxTimeUnits TimeUnit

setMaxTimeout

public void setMaxTimeout (long maxTimeout, 
                TimeUnit maxTimeUnits)

Parameters
maxTimeout long

maxTimeUnits TimeUnit

setMaxtimeToOutputResponse

public void setMaxtimeToOutputResponse (int maxTimeToOutputResponse)

Parameters
maxTimeToOutputResponse int

setMethodName

public void setMethodName (String className, 
                String testName)

Parameters
className String

testName String

setRunName

public void setRunName (String runName)

Parameters
runName String

setRunOptions

public void setRunOptions (String options)

Sets options for the am instrument command. See com/android/commands/am/Am.java for full list of options.

Parameters
options String

setTestCollection

public void setTestCollection (boolean collect)

Parameters
collect boolean

setTestPackageName

public void setTestPackageName (String packageName)

Parameters
packageName String

setTestSize

public void setTestSize (IRemoteAndroidTestRunner.TestSize size)

Parameters
size IRemoteAndroidTestRunner.TestSize

Protected methods

getArgsCommand

protected String getArgsCommand ()

Returns the full instrumentation command line syntax for the provided instrumentation arguments. Returns an empty string if no arguments were specified.

Returns
String

getRunnerPath

protected String getRunnerPath ()

Returns the complete instrumentation component path.

Returns
String