Make Android tests run faster

Hi everyone,
I know that iOS has a way to make the tests run faster by configuring the instruments-without-delay file for the simulator. I am looking for something similar with Android…to see if there is a way to make the tests run faster than the usual speed. Is there anything that can be done/configured for Android…similar to iOS?

Thanks.

Go to the device settings. Under the developer options, disable all animations.

Instruments-without-delay was created in the first place because there was an artificial 1 second waiting period added to every action in the official Instruments library that was completely unnecessary.

AFAIK, there is no unnecessary sleeps inside UiAutomator, so there is no such thing as a “Uiautomator-without-delay”.

2 Likes

you could look into the ignoreUnimportantViews capability:
Calls the setCompressedLayoutHierarchy()
uiautomator function. This capability can speed up test execution,
since Accessibility commands will run faster ignoring some elements. The
ignored elements will not be findable, which is why this capability has
also been implemented as a toggle-able setting as well as a capability. Defaults to false

and
disableAndroidWatchers
Disables android watchers that watch for application not responding
and application crash, this will reduce cpu usage on android
device/emulator. This capability will work only with UiAutomator and not
with selendroid, default false

see
http://appium.io/slate/en/master/?java#android-only

but these may have sideeffects (e.g. items not found or crashes not detected) so be careful.

Thanks @afwang. Did you try that and does it make a difference?

Thanks @rompic
So I see you’re basically saying that I set the ignoreUnimportantViews capability to true. But my question about this is what kind of elements does it ignore automatically? Wouldn’t this be dangerous where it could ignore some element that is actually needed for a test?

If disableAndroidWatchers capability is set to true is that a good thing to do too? As in is it ok to ignore application crash or application not responding?

i guess that really depends on your test. I noticed that my drawer menu button is not visible after activating this setting, so it does not make sense or rather i may have to toggle it to make use of it.

I think that disabling the android watchers could also not be a good idea as actually we are testing to find crashes etc.

How does your setup look like? do you use emulators or real devices? I really saw an acceleration using emulators of the latest android sdk (with haxm) and appium 1.5.

The android watchers will only detect an ANR that shows on the screen. I’ve found android crashes in logcat after the fact that were never reported on the screen.