I don't know if there is a better way, but I was able to accomplish this using my own TestRunner.
public class MyInstrumentationTestRunner extends InstrumentationTestRunner {
@Override
public Application newApplication(ClassLoader cl, String className, Context context) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return new MyTestApplication(context);
}
}
AndroidManifest.xml, :
<instrumentation android:name="com.mypackage.test.MyInstrumentationTestRunner" ... />
IDE, . , - :
adb shell am instrument -w com.mypackage/com.mypackage.test.MyInstrumentationTestRunner