运行TravisCI和Espresso测试-Android

时间:2019-02-17 00:32:32

标签: android travis-ci android-espresso

这个问题已经多次提出。但是,版本已更改,并且我有一个旧版本(但比以前提出此问题的大多数人都要新)

我正在寻求社区的帮助,因为尝试每个版本都变得很耗时。

对于我的build.gradle:

...

android {
    flavorDimensions "none"
    compileSdkVersion 28
    buildToolsVersion '27.0.3'
    useLibrary 'org.apache.http.legacy'

    dexOptions {
              javaMaxHeapSize project.hasProperty('javaMaxHeapSize') ? project.getProperty('javaMaxHeapSize') : "4g"
    }

...

  }
    /*Espresso UI Testing
    all other required dependencies https://developer.android.com/training/testing/set-up-project */
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.0'
    androidTestImplementation 'androidx.test:rules:1.1.0'

}

...

对于我的travis:

...
"./gradlew connectedAndroidTest"
...

我通常会收到此错误:

org.compname.secureds.ChickenStuff > changeChickenTest[test(AVD) - 5.1.1] FAILED 
    androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with text: is "Chicken"
    If the target view is not part of the view hierarchy, you may need to use Espresso.onData to load it from one of the following AdapterViews:android.support.v7.widget.AppCompatSpinner{73736fc VFED..CL ......I. 24,24-456,60 #7f0900db app:id/country_spinner}

所以我的鸡测试失败了,但是当我在Android Studio上运行它时。它通过了。我不知道为什么它会失败,但是我假设它是版本堆栈(构建工具,平台工具,ndk工具等)。

0 个答案:

没有答案