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