35 import org.gradle.kotlin.dsl.kotlin |
35 import org.gradle.kotlin.dsl.kotlin |
36 |
36 |
37 const val espressoVersion = "3.2.0" |
37 const val espressoVersion = "3.2.0" |
38 const val androidxTestRunnerVersion = "1.3.0-alpha05" |
38 const val androidxTestRunnerVersion = "1.3.0-alpha05" |
39 const val androidxTestCoreVersion = "1.3.0-alpha05" |
39 const val androidxTestCoreVersion = "1.3.0-alpha05" |
40 const val robolectricVersion = "4.3.1" |
40 const val robolectricVersion = "4.6.1" |
41 |
41 |
42 |
42 |
43 /* |
43 /* |
44 * Configuration for espresso and robolectric usage in an Android project |
44 * Configuration for espresso and robolectric usage in an Android project |
45 */ |
45 */ |
46 internal fun Project.configureTests() { |
46 internal fun Project.configureTests() { |
47 extensions.configure<BaseExtension> { |
47 extensions.configure<BaseExtension> { |
48 defaultConfig { |
48 defaultConfig { |
49 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" |
49 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" |
50 testInstrumentationRunnerArgument("clearPackageData", "true") |
50 testInstrumentationRunnerArguments += mapOf( |
51 testInstrumentationRunnerArgument("disableAnalytics", "true") |
51 "clearPackageData" to "true", |
|
52 "disableAnalytics" to "true" |
|
53 ) |
52 } |
54 } |
53 |
55 |
54 testOptions { |
56 testOptions { |
55 execution = "ANDROIDX_TEST_ORCHESTRATOR" |
57 execution = "ANDROIDX_TEST_ORCHESTRATOR" |
56 animationsDisabled = true |
58 animationsDisabled = true |
84 // assertions |
86 // assertions |
85 dualTestImplementation("com.google.truth:truth:1.0") |
87 dualTestImplementation("com.google.truth:truth:1.0") |
86 dualTestImplementation("androidx.test.ext:truth:1.3.0-alpha01") |
88 dualTestImplementation("androidx.test.ext:truth:1.3.0-alpha01") |
87 |
89 |
88 // mock |
90 // mock |
89 testImplementation("io.mockk:mockk:1.9.3") |
91 testImplementation("io.mockk:mockk:1.12.0") |
90 androidTestImplementation("io.mockk:mockk-android:1.9.3") |
92 androidTestImplementation("io.mockk:mockk-android:1.12.0") |
91 testImplementation("org.robolectric:robolectric:$robolectricVersion") |
93 testImplementation("org.robolectric:robolectric:$robolectricVersion") |
92 |
94 |
93 constraints { |
95 constraints { |
94 dualTestImplementation(kotlin("reflect")) { |
96 dualTestImplementation(kotlin("reflect")) { |
95 because("Use the kotlin version that we use") |
97 because("Use the kotlin version that we use") |