由于NoMatchingViewException,我目前在Travis-CI上运行Espresso测试时遇到问题,而在本地运行它们运行正常。 看起来我的.travis.yml没有任何问题,因为我已经用travis + espresso检查了一些其他的存储库,它非常相似。
language: android
jdk: oraclejdk8
sudo: false
env:
global:
- ANDROID_TARGET=android-19
- ANDROID_ABI=armeabi-v7a
android:
components:
# Update Android SDK Tools
- tools
- platform-tools
- build-tools-23.0.3
- android-23
# Support library
- extra-android-support
- extra-google-google_play_services
- extra-android-m2repository
- extra-google-m2repository
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
before_script:
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script:
- ./gradlew connectedAndroidTest jacocoTestReport
after_success:
- bash <(curl -s https://codecov.io/bash)
在我的测试中,我只是打这样的电话,一切都很好
onView(withId(R.id.email_edittext)).check(matches(hasErrorText(text)))
但是在Travis-CI上我仍然没有通过测试
com.tests.LoginTest > test_invalidPassword[test(AVD) - 4.4.4] FAILED
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: mob.prokky.gameshare:id/email_edittext
完整测试在here
时,可以使用完整Travis-CI日志github