We run android espresso instrumentation tests on bamboo. This worked extremely randomly due to a few issues that we've tried to solve with this app.
We start the emulators on our build server with these arguments:
emulator -avd AVDNAME -no-window -no-audio -sdcard sdcard.img -qemu
We wait for the devices to be booted (right now we check shell getprop init.svc.bootanim, which is suboptimal.. emulator boots faster without boot screen. Suggestions are welcome).
Installing and starting the apk:
Then we install this app, and execute it like this:
adb install -r android_emulator_hacks.apk adb shell pm grant no.finn.android_emulator_hacks android.permission.SET_ANIMATION_SCALE adb shell am start -n no.finn.android_emulator_hacks/no.finn.android_emulator_hacks.HackActivity
This will make sure the keyguard is off (which sometimes, randomly, seem to be on in different emulators). It ensures the screen is on (again, sometimes it just isn't. And it turns off animations which can also cause unittests to fail).
Problems we had with espresso+build server:
- emulator without --no-audio will sometimes fail, not always. Causing a crash in package acore, which will cause the tests to fail.
- emulator images without google services causes a "You need to install google play services" dialog, which causes tests to fail. NB : We used spoon to take screenshots to debug this particular bug, but spoon grabs the activity's decor view. Causing screenshots to look as if everything is fine.
- Keyguard sometimes turned itself on or was on after boot. - Fixed by app
- Screen sometimes turned itself off before the tests started. - Fixed by app
- Animations caused espresso onView failures (the actions generally worked, but they had no effect, causing the next onView call to fail). - Fixed by app
- DynamicLoadApk CalendarListView Jave Proxy android-lockpattern Side Menu.Android 公共技术点之 Java 反射 Reflection CircularFloatingActionMenu BaseAdapterHelper 公共技术点之 View 事件传递 PhotoView 公共技术点之依赖注入 公共技术点之 View 绘制流程 discreteSeekBar android-Ultra-Pull-To-Refresh HoloGraphLibrary Volley 公共技术点之 Java 注解 Annotation NineOldAnimations EventBus Dagger xUtils PagerSlidingTabStrip SlidingMenu 公共技术点之 Android 动画基础 Android-Universal-Image-Loader ViewPagerIndicator cling