Android 仪器测试,库的选择。我应该使用 libs:test:testing-support 还是 test:rules 或 test:runner?
Android instrumentation tests, choice of libraries. Should I use libs:test:testing-support or test:rules or test:runner?
官网:
https://google.github.io/android-testing-support-library/docs/espresso/setup/index.html
他们说,我必须添加:
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'
我需要哪些库?
对于我的最新项目,我使用了这些 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"
请注意,某些教程可能真的已经过时了。请注意,我使用的是最新版本 0.5
的 com.android.support.test
子库,而不是 0.3
.
此外,请注意 rules
和 runner
有不同的内容,因此您可以同时使用两者,但一个而不是另一个
我也很确定 Google 关于 Espresso
的教程就足够了,您不需要使用其他教程。检查:https://google.github.io/android-testing-support-library/docs/espresso/
希望对您有所帮助
官网: https://google.github.io/android-testing-support-library/docs/espresso/setup/index.html
他们说,我必须添加:
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'
我需要哪些库?
对于我的最新项目,我使用了这些 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"
请注意,某些教程可能真的已经过时了。请注意,我使用的是最新版本 0.5
的 com.android.support.test
子库,而不是 0.3
.
此外,请注意 rules
和 runner
有不同的内容,因此您可以同时使用两者,但一个而不是另一个
我也很确定 Google 关于 Espresso
的教程就足够了,您不需要使用其他教程。检查:https://google.github.io/android-testing-support-library/docs/espresso/
希望对您有所帮助