Interface IRemoteAndroidTestRunner

  • All Known Implementing Classes:
    RemoteAndroidTestRunner

    public interface IRemoteAndroidTestRunner
    Interface for running a Android test command remotely and reporting result to a listener.
    • Method Detail

      • getPackageName

        java.lang.String getPackageName()
        Returns the application package name.
      • getRunnerName

        java.lang.String getRunnerName()
        Returns the runnerName.
      • setClassName

        void setClassName​(java.lang.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​(java.lang.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​(java.lang.String className,
                           java.lang.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​(java.lang.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)
      • addInstrumentationArg

        void addInstrumentationArg​(java.lang.String name,
                                   java.lang.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​(java.lang.String name)
        Removes a previously added argument.
        Parameters:
        name - the name of the instrumentation bundle argument to remove
      • 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.
      • setTestCollection

        void setTestCollection​(boolean collection)
        Sets this test run to test collection mode. If true, will skip test execution and will set all appropriate runner arguments required for a successful test collection.
      • setMaxTimeToOutputResponse

        void setMaxTimeToOutputResponse​(long maxTimeToOutputResponse,
                                        java.util.concurrent.TimeUnit maxTimeUnits)
        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.

        Parameters:
        maxTimeToOutputResponse - the maximum amount of time during which the command is allowed to not output any response. A value of 0 means the method will wait forever (until the receiver cancels the execution) for command output and never throw.
        maxTimeUnits - Units for non-zero maxTimeToOutputResponse values.
        See Also:
        IDevice.executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, int)
      • cancel

        void cancel()
        Requests cancellation of this test run.