Skip to content

Commit a316749

Browse files
committed
Merge remote-tracking branch 'upstream/master'
Conflicts: AndroidTestingBlueprint/app/build.gradle AndroidTestingBlueprint/module-android-library/build.gradle AndroidTestingBlueprint/module-flavor1-androidTest-only/build.gradle
2 parents 98f78b9 + 127b24b commit a316749

File tree

6 files changed

+35
-28
lines changed

6 files changed

+35
-28
lines changed

AndroidTestingBlueprint/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,9 @@ Run normally (see above).
114114
Execute:
115115

116116
```
117-
./gradlew module-flavor1-androidTest-only:assembleDebug module-flavor1-androidTest-only:connectedCheck
117+
./gradlew module-flavor1-androidTest-only:connectedAndroidTest
118118
```
119119

120-
Note: `assembleDebug` has to be run before `connectedCheck`. See [bug](https://code.google.com/p/android/issues/detail?id=180689), which will be fixed in 1.3.1 .
121-
122120
##### From command-line via adb
123121
You need to install the app and test app first:
124122

@@ -181,7 +179,7 @@ Since Gradle Android Plugin version 1.2.0 using ProGuard has become a lot easier
181179
To try it out just uncomment the minify section for the debug build type in the app modules `build.gradle` file.
182180

183181
## Custom Gradle command-line arguments
184-
Gradle allows you to pass custom arguments to `AndroidJUnitRunner`. This is equivalent to running `adb shell am instrument -w -e <argName> <argValue>`.
182+
Gradle allows you to pass custom arguments to `AndroidJUnitRunner`. This is equivalent to running `adb shell am instrument -w -e <argName> <argValue> com.example.android.testing.blueprint.test/android.support.test.runner.AndroidJUnitRunner`.
185183
Custom arguments can be particularly useful when you just want to run a specific test class/method/qualifier.
186184

187185
To pass a custom argument the -Pcom.android.tools.instrumentationTestRunnerArgs=argName=argValue
@@ -190,19 +188,19 @@ property needs to be used, in conjunction with `argName` and `argValue`. Multipl
190188
For instance, to run all tests annotated with the `@Large` test size qualifier in the app module, execute:
191189

192190
``` sh
193-
`./gradlew app:connectedCheck -Pcom.android.tools.instrumentationTestRunnerArgs=size=large`
191+
./gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.size=large
194192
```
195193

196194
To only run tests for a specific test class, i.e. EspressoTest, execute:
197195

198196
``` sh
199-
`./gradlew app:connectedCheck -Pcom.android.tools.instrumentationTestRunnerArgs=class=com.example.android.testing.blueprint.ui.espresso.EspressoTest`
197+
./gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.example.android.testing.blueprint.ui.espresso.EspressoTest
200198
```
201199

202200
To pass in an arbitrary argument which can be accessed in a test at runtime, execute:
203201

204202
``` sh
205-
`./gradlew module-flavor1-androidTest-only:connectedCheck -Pcom.android.tools.instrumentationTestRunnerArgs=argument1=make_test_fail`
203+
./gradlew module-flavor1-androidTest-only:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.argument1=make_test_fail
206204
```
207205
All arguments passed through command line can also be specified in the project's build.gradle file, which is
208206
great for specifying values which are required by the test harness itself. The `argument1` from the previous

AndroidTestingBlueprint/app/build.gradle

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,30 +68,30 @@ android {
6868

6969
dependencies {
7070
// App's dependencies, including test
71-
compile 'com.android.support:appcompat-v7:22.2.0'
71+
compile 'com.android.support:appcompat-v7:' + rootProject.ext.supportLibVersion
7272

7373
compile project(':module-plain-java') // Optional module for non-Android code
7474
compile project(':module-android-library') // Optional module for additional Android code
7575

7676
// Dependencies for local unit tests
77-
testCompile 'junit:junit:4.12'
78-
testCompile 'org.mockito:mockito-all:1.10.19'
79-
testCompile 'org.hamcrest:hamcrest-all:1.3'
77+
testCompile 'junit:junit:' + rootProject.ext.junitVersion
78+
testCompile 'org.mockito:mockito-all:' + rootProject.ext.mockitoVersion
79+
testCompile 'org.hamcrest:hamcrest-all:' + rootProject.ext.hamcrestVersion
8080

8181
// Android Testing Support Library's runner and rules
82-
androidTestCompile 'com.android.support.test:runner:0.3'
83-
androidTestCompile 'com.android.support.test:rules:0.3'
82+
androidTestCompile 'com.android.support.test:runner:' + rootProject.ext.runnerVersion
83+
androidTestCompile 'com.android.support.test:rules:' + rootProject.ext.rulesVersion
8484

8585
// Espresso UI Testing
86-
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
86+
androidTestCompile 'com.android.support.test.espresso:espresso-core:' + rootProject.ext.espressoVersion
8787

8888
// Espresso-Contrib, Intents and Web dependencies are not used in this project.
8989
/*
90-
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2'
91-
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2'
92-
androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2'
90+
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:' + rootProject.ext.espressoVersion
91+
androidTestCompile 'com.android.support.test.espresso:espresso-intents:' + rootProject.ext.espressoVersion
92+
androidTestCompile 'com.android.support.test.espresso:espresso-web:' + rootProject.ext.espressoVersion
9393
*/
9494

9595
// UIAutomator Testing. Learn about this dependency in this projects README file.
96-
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
96+
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:' + rootProject.ext.uiautomatorVersion
9797
}

AndroidTestingBlueprint/build.gradle

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:1.3.0'
8+
classpath 'com.android.tools.build:gradle:1.3.1'
99

1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files
@@ -20,7 +20,16 @@ allprojects {
2020

2121
ext {
2222
minSdkVersion = 10
23-
targetSdkVersion = 22
23+
targetSdkVersion = 23
2424
compileSdkVersion = 23
25-
buildToolsVersion = "23.0.0"
25+
buildToolsVersion = "23.0.1"
26+
27+
supportLibVersion = "23.0.1"
28+
junitVersion = "4.12"
29+
mockitoVersion = "1.10.19"
30+
hamcrestVersion = "1.3"
31+
runnerVersion = "0.4"
32+
rulesVersion = "0.4"
33+
espressoVersion = "2.2.1"
34+
uiautomatorVersion = "2.1.2"
2635
}

AndroidTestingBlueprint/module-android-library/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ android {
2121

2222
dependencies {
2323
// Android Testing Support Library's runner and rules
24-
androidTestCompile 'com.android.support.test:runner:0.3'
25-
androidTestCompile 'com.android.support.test:rules:0.3'
24+
androidTestCompile 'com.android.support.test:runner:' + rootProject.ext.runnerVersion
25+
androidTestCompile 'com.android.support.test:rules:' + rootProject.ext.rulesVersion
2626
}

AndroidTestingBlueprint/module-flavor1-androidTest-only/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ android {
2222

2323
dependencies {
2424
// Android Testing Support Library's runner and rules and hamcrest matchers
25-
compile 'com.android.support.test:runner:0.3'
26-
compile 'com.android.support.test:rules:0.3'
27-
compile 'org.hamcrest:hamcrest-core:1.3'
25+
compile 'com.android.support.test:runner:' + rootProject.ext.runnerVersion
26+
compile 'com.android.support.test:rules:' + rootProject.ext.rulesVersion
27+
compile 'org.hamcrest:hamcrest-core:' + rootProject.ext.hamcrestVersion
2828
}

AndroidTestingBlueprint/module-plain-java/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ targetCompatibility = 1.7
77

88
dependencies {
99
// Dependencies for local unit tests
10-
testCompile 'junit:junit:4.12'
11-
testCompile 'org.hamcrest:hamcrest-core:1.3'
10+
testCompile 'junit:junit:' + rootProject.ext.junitVersion
11+
testCompile 'org.hamcrest:hamcrest-core:' + rootProject.ext.hamcrestVersion
1212
}

0 commit comments

Comments
 (0)