Skip to content

Commit 9ee5a21

Browse files
authored
Merge pull request #434 from android/gmd2
Add gradle managed device configs for all samples and update test-all.sh
2 parents 5a799d9 + 5fba65c commit 9ee5a21

File tree

23 files changed

+258
-24
lines changed

23 files changed

+258
-24
lines changed

integration/ServiceTestRuleSample/app/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ android {
1717
}
1818
productFlavors {
1919
}
20+
testOptions {
21+
managedDevices {
22+
devices {
23+
// run with ../gradlew nexusOneApi30DebugAndroidTest
24+
nexusOneApi30(com.android.build.api.dsl.ManagedVirtualDevice) {
25+
// A lower resolution device is used here for better emulator performance
26+
device = "Nexus One"
27+
apiLevel = 30
28+
// Also use the AOSP ATD image for better emulator performance
29+
systemImageSource = "aosp-atd"
30+
}
31+
}
32+
}
33+
}
2034
}
2135

2236
dependencies {

projects.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ ui/espresso/RecyclerViewSample
1515
ui/espresso/ScreenshotSample
1616
ui/espresso/WebBasicSample
1717
ui/uiautomator/BasicSample
18-
unit/BasicSample
19-
unit/BasicUnitAndroidTest

runner/AndroidJunitRunnerSample/app/build.gradle

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,20 @@ android {
2121
}
2222
productFlavors {
2323
}
24-
24+
testOptions {
25+
managedDevices {
26+
devices {
27+
// run with ../gradlew nexusOneApi30DebugAndroidTest
28+
nexusOneApi30(com.android.build.api.dsl.ManagedVirtualDevice) {
29+
// A lower resolution device is used here for better emulator performance
30+
device = "Nexus One"
31+
apiLevel = 30
32+
// Also use the AOSP ATD image for better emulator performance
33+
systemImageSource = "aosp-atd"
34+
}
35+
}
36+
}
37+
}
2538
useLibrary 'android.test.runner'
2639

2740
useLibrary 'android.test.base'

runner/AndroidTestOrchestratorSample/app/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ android {
2424

2525
testOptions {
2626
execution 'ANDROIDX_TEST_ORCHESTRATOR'
27+
managedDevices {
28+
devices {
29+
// run with ../gradlew nexusOneApi30DebugAndroidTest
30+
nexusOneApi30(com.android.build.api.dsl.ManagedVirtualDevice) {
31+
// A lower resolution device is used here for better emulator performance
32+
device = "Nexus One"
33+
apiLevel = 30
34+
// Also use the AOSP ATD image for better emulator performance
35+
systemImageSource = "aosp-atd"
36+
}
37+
}
38+
}
2739
}
2840
}
2941

runner/AndroidTestOrchestratorWithTestCoverageSample/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ dependencies {
3434
androidTestImplementation 'androidx.test.ext:junit:' + rootProject.extJUnitVersion
3535
androidTestImplementation 'androidx.test:runner:' + rootProject.runnerVersion
3636
androidTestImplementation 'androidx.test.espresso:espresso-core:' + rootProject.espressoVersion
37-
androidTestUtil 'androidx.test:orchestrator:' + rootProject.runnerVersion
37+
androidTestUtil 'androidx.test:orchestrator:' + rootProject.orchestratorVersion
3838
androidTestUtil 'androidx.test.services:test-services:' + rootProject.testServicesVersion
3939
}

test_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ for p in $(cat projects.conf); do
99
echo "====================================================================="
1010

1111
pushd $p > /dev/null # Silent pushd
12-
./gradlew $@ testDebug cAT | sed "s@^@$p @" # Prefix every line with directory
12+
./gradlew $@ testDebug nexusOneApi30DebugAndroidTest | sed "s@^@$p @" # Prefix every line with directory
1313
code=${PIPESTATUS[0]}
1414
if [ "$code" -ne "0" ]; then
1515
exit $code

ui/espresso/AccessibilitySample/app/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ android {
2323
unitTests {
2424
includeAndroidResources = true
2525
}
26+
managedDevices {
27+
devices {
28+
// run with ../gradlew nexusOneApi30DebugAndroidTest
29+
nexusOneApi30(com.android.build.api.dsl.ManagedVirtualDevice) {
30+
// A lower resolution device is used here for better emulator performance
31+
device = "Nexus One"
32+
apiLevel = 30
33+
// Also use the AOSP ATD image for better emulator performance
34+
systemImageSource = "aosp-atd"
35+
}
36+
}
37+
}
2638
}
2739
compileOptions {
2840
sourceCompatibility JavaVersion.VERSION_1_8

ui/espresso/BasicSample/app/build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ android {
2525
unitTests {
2626
includeAndroidResources = true
2727
}
28+
managedDevices {
29+
devices {
30+
31+
// run with ../gradlew nexusOneApi30DebugAndroidTest
32+
nexusOneApi30(com.android.build.api.dsl.ManagedVirtualDevice) {
33+
// A lower resolution device is used here for better emulator performance
34+
device = "Nexus One"
35+
apiLevel = 30
36+
// Also use the AOSP ATD image for better emulator performance
37+
systemImageSource = "aosp-atd"
38+
}
39+
}
40+
}
2841
}
2942
}
3043

ui/espresso/CustomMatcherSample/app/build.gradle

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,23 @@ android {
3232
java.srcDir 'src/sharedTest/java'
3333
}
3434
}
35-
testOptions.unitTests.includeAndroidResources = true
35+
testOptions {
36+
unitTests {
37+
includeAndroidResources = true
38+
}
39+
managedDevices {
40+
devices {
41+
// run with ../gradlew nexusOneApi30DebugAndroidTest
42+
nexusOneApi30(com.android.build.api.dsl.ManagedVirtualDevice) {
43+
// A lower resolution device is used here for better emulator performance
44+
device = "Nexus One"
45+
apiLevel = 30
46+
// Also use the AOSP ATD image for better emulator performance
47+
systemImageSource = "aosp-atd"
48+
}
49+
}
50+
}
51+
}
3652
}
3753

3854
dependencies {

ui/espresso/DataAdapterSample/app/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ android {
1818
unitTests {
1919
includeAndroidResources = true
2020
}
21+
managedDevices {
22+
devices {
23+
// run with ../gradlew nexusOneApi30DebugAndroidTest
24+
nexusOneApi30(com.android.build.api.dsl.ManagedVirtualDevice) {
25+
// A lower resolution device is used here for better emulator performance
26+
device = "Nexus One"
27+
apiLevel = 30
28+
// Also use the AOSP ATD image for better emulator performance
29+
systemImageSource = "aosp-atd"
30+
}
31+
}
32+
}
2133
}
2234
// share test source between local test and androidTest
2335
sourceSets {

0 commit comments

Comments
 (0)