Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.
         
       
     
  
  
  
  
  
    
    
      
    
    
      
      Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
  
  
    
    
  
  
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
| 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. | 
    
    
 
    getAmInstrumentCommand
    
public String getAmInstrumentCommand ()
    
    
    
  
    
 
    getCoverageOutputType
    
public IRemoteAndroidTestRunner.CoverageOutput getCoverageOutputType ()
    
    
    
  
    
      | Returns | 
|---|
      
        | IRemoteAndroidTestRunner.CoverageOutput |  | 
    
 
    getPackageName
    
public String getPackageName ()
    
    
    
  
    
 
    getRunOptions
    
public String getRunOptions ()
    
    
    
  Returns options for the am instrument command.
    
 
    getRunnerName
    
public String getRunnerName ()
    
    
    
  
    
 
    removeInstrumentationArg
    
public void removeInstrumentationArg (String name)
    
    
    
  
    
 
    run
    
public void run (ITestRunListener... listeners)
    
    
    
  
    
    | Parameters | 
|---|
      
        | listeners | ITestRunListener | 
    
      
      | Throws | 
|---|
        
          | AdbCommandRejectedException |  | 
        
          | ShellCommandUnresponsiveException |  | 
        
          | TimeoutException |  | 
      
  
 
    run
    
public void run ( 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)
    
    
    
  
    
 
    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.
    
 
    getRunnerPath
    
protected String getRunnerPath ()
    
    
    
  Returns the complete instrumentation component path.
    
 
 
 
  
  
 
  
    
    
      
    
    
  
       
    
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-03-19 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-19 UTC."],[],[]]