Gradle Managed Devices with Test Orchestrator

33 Views Asked by At

I'm looking at moving some of our UI tests to use Gradle Managed Devices. I've defined a device as follows in the app build.gradle.kts.

    testOptions {
        execution = "ANDROIDX_TEST_ORCHESTRATOR"
        animationsDisabled = true
        managedDevices {
            localDevices {
                create("pixel2api30") {
                    device = "Pixel 2"
                    apiLevel = 30
                    systemImageSource = "google-atd"
                }
            }
        }
    }

However, when I run it on the command line with ./gradlew app:pixel2api30DebugAndroidTest it says Starting 0 tests on pixel2api30 and then says the Build failed with an exception.

If I comment out the execution line then 94 tests are started (but they fail because of the reasons that I need test orchestrator). How can I run GMDs with Test Orchestrator? If I run with --info on I can see the following output

INFO: Installing [/Users/barryirvine/StudioProjects/Go City/app/build/outputs/apk/debug/app-debug.apk] on device emulator-5554.
INFO: Installing [/Users/barryirvine/.gradle/caches/modules-2/files-2.1/androidx.test/orchestrator/1.4.2/e39fb0a062aa533b8c2805bbf9648829a9cd977e/orchestrator-1.4.2.apk, /Users/barryirvine/.gradle/caches/modules-2/files-2.1/androidx.test.services/test-services/1.4.2/d051210a53d266ad436e79bea473cc5e843245b8/test-services-1.4.2.apk] on device emulator-5554.
INFO: Installing [/Users/barryirvine/StudioProjects/Go City/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk] on device emulator-5554.
INFO: Start logcat streaming.
INFO: Running Android Instrumentation driver.
SEVERE: Fatal error while executing main with args: --proto_config=/Users/barryirvine/.android/utp/runnerConfig14768629602247508805.pb --proto_server_config=/Users/barryirvine/.android/utp/serverConfig9633560546492066251.pb
SEVERE: Fatal error while executing main with args: --proto_config=/Users/barryirvine/.android/utp/runnerConfig14768629602247508805.pb --proto_server_config=/Users/barryirvine/.android/utp/serverConfig9633560546492066251.pb
WARNING: Cancellation triggered in Android Instrumentation Driver.
WARNING: "Instrumentation command failed with non zero exit code:
Instrumentation command: CLASSPATH=$(pm path androidx.test.services) app_process / androidx.test.services.shellexecutor.ShellMain am instrument -w -r --no-window-animation -e clearPackageData true -e useTestStorageService true -e additionalTestOutputDir /sdcard/Android/media/com.gocitypass.debug/additional_test_output -e testTimeoutSeconds 31536000 -e targetInstrumentation com.gocitypass.debug.test/com.gocitypass.HiltTestRunner androidx.test.orchestrator/androidx.test.orchestrator.AndroidTestOrchestrator
StatusCode: 143
INFO: Stop logcat stream

0

There are 0 best solutions below