FileDocCategorySizeDatePackage
UiAutomatorTestCase.javaAPI DocAndroid 5.1 API3275Thu Mar 12 22:22:08 GMT 2015com.android.uiautomator.testrunner

UiAutomatorTestCase

public class UiAutomatorTestCase extends android.test.InstrumentationTestCase
UI Automator test case that is executed on the device.

Fields Summary
private android.os.Bundle
mParams
private IAutomationSupport
mAutomationSupport
Constructors Summary
Methods Summary
public IAutomationSupportgetAutomationSupport()
Provides support for running tests to report interim status

return
IAutomationSupport
since
API Level 16
deprecated
Use {@link Instrumentation#sendStatus(int, Bundle)} instead

        if (mAutomationSupport == null) {
            mAutomationSupport = new InstrumentationAutomationSupport(getInstrumentation());
        }
        return mAutomationSupport;
    
public android.os.BundlegetParams()
Get command line parameters. On the command line when passing -e key value pairs, the {@link Bundle} will have the key value pairs conveniently available to the tests.

since
API Level 16

        return mParams;
    
public com.android.uiautomator.core.UiDevicegetUiDevice()
Get current instance of {@link UiDevice}. Works similar to calling the static {@link UiDevice#getInstance()} from anywhere in the test classes.

since
API Level 16

        return UiDevice.getInstance();
    
voidinitialize(android.os.Bundle params)
Initializes this test case.

param
params Instrumentation arguments.

        mParams = params;

        // check if this is a monkey test mode
        String monkeyVal = mParams.getString("monkey");
        if (monkeyVal != null) {
            // only if the monkey key is specified, we alter the state of monkey
            // else we should leave things as they are.
            getInstrumentation().getUiAutomation().setRunAsMonkey(Boolean.valueOf(monkeyVal));
        }

        UiDevice.getInstance().initialize(new InstrumentationUiAutomatorBridge(
                getInstrumentation().getContext(),
                getInstrumentation().getUiAutomation()));
    
voidsetAutomationSupport(IAutomationSupport automationSupport)

        mAutomationSupport = automationSupport;
    
public voidsleep(long ms)
Calls {@link SystemClock#sleep(long)} to sleep

param
ms is in milliseconds.
since
API Level 16

        SystemClock.sleep(ms);