Skip to content

Commit 4132118

Browse files
committed
Add gradle managed device configs for all samples and update test-all.sh
to use them to run tests.
1 parent fb23d5f commit 4132118

File tree

21 files changed

+260
-12
lines changed

21 files changed

+260
-12
lines changed

integration/ServiceTestRuleSample/app/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@ android {
1717
}
1818
productFlavors {
1919
}
20+
testOptions {
21+
devices {
22+
// run with ../gradlew nexusOneApi30DebugAndroidTest
23+
nexusOneApi30 (com.android.build.api.dsl.ManagedVirtualDevice) {
24+
// A lower resolution device is used here for better emulator performance
25+
device = "Nexus One"
26+
apiLevel = 30
27+
// Also use the AOSP ATD image for better emulator performance
28+
// The androidx.test screenshot APIs will automatically enable hardware rendering
29+
// to take a screenshot
30+
systemImageSource = "aosp-atd"
31+
abi = "x86"
32+
}
33+
}
34+
}
2035
}
2136

2237
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: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,21 @@ android {
2121
}
2222
productFlavors {
2323
}
24-
24+
testOptions {
25+
devices {
26+
// run with ../gradlew nexusOneApi30DebugAndroidTest
27+
nexusOneApi30 (com.android.build.api.dsl.ManagedVirtualDevice) {
28+
// A lower resolution device is used here for better emulator performance
29+
device = "Nexus One"
30+
apiLevel = 30
31+
// Also use the AOSP ATD image for better emulator performance
32+
// The androidx.test screenshot APIs will automatically enable hardware rendering
33+
// to take a screenshot
34+
systemImageSource = "aosp-atd"
35+
abi = "x86"
36+
}
37+
}
38+
}
2539
useLibrary 'android.test.runner'
2640

2741
useLibrary 'android.test.base'

runner/AndroidTestOrchestratorSample/app/build.gradle

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

2525
testOptions {
2626
execution 'ANDROIDX_TEST_ORCHESTRATOR'
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+
// The androidx.test screenshot APIs will automatically enable hardware rendering
35+
// to take a screenshot
36+
systemImageSource = "aosp-atd"
37+
abi = "x86"
38+
}
39+
}
2740
}
2841
}
2942

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 $@ 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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ android {
2323
unitTests {
2424
includeAndroidResources = true
2525
}
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+
// The androidx.test screenshot APIs will automatically enable hardware rendering
34+
// to take a screenshot
35+
systemImageSource = "aosp-atd"
36+
abi = "x86"
37+
}
38+
}
2639
}
2740
compileOptions {
2841
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+
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+
// The androidx.test screenshot APIs will automatically enable hardware rendering
36+
// to take a screenshot
37+
systemImageSource = "aosp-atd"
38+
abi = "x86"
39+
}
40+
}
2841
}
2942
}
3043

ui/espresso/CustomMatcherSample/app/build.gradle

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,24 @@ android {
3232
java.srcDir 'src/sharedTest/java'
3333
}
3434
}
35-
testOptions.unitTests.includeAndroidResources = true
35+
testOptions {
36+
unitTests {
37+
includeAndroidResources = true
38+
}
39+
devices {
40+
// run with ../gradlew nexusOneApi30DebugAndroidTest
41+
nexusOneApi30(com.android.build.api.dsl.ManagedVirtualDevice) {
42+
// A lower resolution device is used here for better emulator performance
43+
device = "Nexus One"
44+
apiLevel = 30
45+
// Also use the AOSP ATD image for better emulator performance
46+
// The androidx.test screenshot APIs will automatically enable hardware rendering
47+
// to take a screenshot
48+
systemImageSource = "aosp-atd"
49+
abi = "x86"
50+
}
51+
}
52+
}
3653
}
3754

3855
dependencies {

ui/espresso/DataAdapterSample/app/build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ android {
1818
unitTests {
1919
includeAndroidResources = true
2020
}
21+
devices {
22+
// run with ../gradlew nexusOneApi30DebugAndroidTest
23+
nexusOneApi30(com.android.build.api.dsl.ManagedVirtualDevice) {
24+
// A lower resolution device is used here for better emulator performance
25+
device = "Nexus One"
26+
apiLevel = 30
27+
// Also use the AOSP ATD image for better emulator performance
28+
// The androidx.test screenshot APIs will automatically enable hardware rendering
29+
// to take a screenshot
30+
systemImageSource = "aosp-atd"
31+
abi = "x86"
32+
}
33+
}
2134
}
2235
// share test source between local test and androidTest
2336
sourceSets {

0 commit comments

Comments
 (0)