Espresso 2.0 導入
Espresso 2.0 導入時に警告が出たのでメモ
開発環境
- AndroidStudio 2.0 Preview 4
Espresso の設定(Setup Espresso)
1. build.gradle に対して以下の依存関係を記述する
build.gradle
dependencies {
androidTestCompile 'com.android.support:support-annotations:23.0.1'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
// Set this dependency if you want to use Hamcrest matching
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
}
build.gradle
dependencies {
androidTestCompile 'com.android.support:support-annotations:23.0.1'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
// Set this dependency if you want to use Hamcrest matching
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
}
※ com.android.support:support-annotations の警告が出ることがある
Warning:Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app and test app differ.
依存関係を修正する
build.gradle
androidTestCompile 'com.android.support:support-annotations:23.0.1'
androidTestCompile ('com.android.support.test:runner:0.4.1') {
exclude module: 'support-annotations'
}
androidTestCompile ('com.android.support.test:rules:0.4.1') {
exclude module: 'support-annotations'
}
androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2.1') {
exclude module: 'support-annotations'
}
// Set this dependency if you want to use Hamcrest matching
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
Espresso 実行(Run Espresso Tests on a Device or Emulator)
1. build.gradle の defaultConfig に testInstrumentationRunner を指定する
build.gradle
android {
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
2. コマンドラインから実行する
./gradlew cAT
Espresso 2.0 参考
Author And Source
この問題について(Espresso 2.0 導入), 我々は、より多くの情報をここで見つけました https://qiita.com/inuko/items/7893374efbdfcc53fc98著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .