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
- 公共技术点之 Java 注解 Annotation Dagger discreteSeekBar PagerSlidingTabStrip SlidingMenu Android-Universal-Image-Loader DynamicLoadApk xUtils Jave Proxy 公共技术点之依赖注入 公共技术点之 View 绘制流程 公共技术点之 View 事件传递 Side Menu.Android android-lockpattern cling CalendarListView 公共技术点之 Java 反射 Reflection ViewPagerIndicator NineOldAnimations EventBus android-Ultra-Pull-To-Refresh 公共技术点之 Android 动画基础 Volley BaseAdapterHelper CircularFloatingActionMenu PhotoView HoloGraphLibrary