1

官方网站: https://google.github.io/android-testing-support-library/docs/espresso/setup/index.htmlAndroid的仪器测试,图书馆的选择。我应该使用库:测试:测试支持或测试:规则或测试:跑步者?

他们说,我要补充一点:

androidTestCompile 'com.android.support.test:runner:0.5' 

但在教程,我发现:

androidTestCompile 'com.android.support.test:rules:0.3' 
androidTestCompile 'com.android.support.test:testing-support-lib:0.1' 

我需要哪个库?

回答

0

我最新的项目中,我使用这些androidTest依赖关系:

androidTestCompile 'com.android.support.test:runner:0.5' 
androidTestCompile 'com.squareup.spoon:spoon-client:1.6.2' 
androidTestCompile "com.android.support:support-annotations:$SUPPORT_VERSION" 
androidTestCompile "com.android.support.test.espresso:espresso-core:$ESPRESSO_VERSION" 

要注意的是一些教程,也许真的过时了。请注意,我用com.android.support.test子库,在其最新的0.5版本,而不是0.3

此外,提防rulesrunner都已经diferrent内容,所以你可以同时使用,但一个代替另一个

我也敢肯定,谷歌的教程约Espresso是足够的,你不需要使用他人。检查:https://google.github.io/android-testing-support-library/docs/espresso/

希望它会帮助