Closed bartekpacia closed 1 year ago
When I remove that seemingly rogue /
from the last adb
invocation in the script, I get:
05-08 22:05:39.785 30804 30804 E appproc : ERROR: could not find class 'am'
05-08 22:05:39.785 30804 30804 F app_process: thread.cc:2468] No pending exception expected: java.lang.ClassNotFoundException: am
05-08 22:05:39.785 30804 30804 F app_process: thread.cc:2468] (Throwable with empty stack trace)
05-08 22:05:39.785 30804 30804 F app_process: thread.cc:2468]
Ugh, I got the order wrong.
Good: app_process / androidx.test.services.shellexecutor.ShellMain
Bad: app_process androidx.test.services.shellexecutor.ShellMain /
This is the working version:
I realized this after I got curious about SpeakEasy, and found its README.
Hi!
I'm trying to run tests of the
AndroidTestOrchestratorSample
app using this guide (specifically: this section of it). Unfortunately, it doesn't work: all I get isAborted
onam instrument
s stdout, and a very cryptic native stack trace in logcat.Here's the shell script I have currently:
orchestrate.bash
```bash #!/usr/bin/env bash set -euo pipefail # This script runs native JUnit tests with the Android Test Orchestrator. # Adapted from: # * https://developer.android.com/training/testing/instrumented-tests/androidx-test-libraries/runner#enable-command # * https://stackoverflow.com/questions/63732977/how-to-use-android-test-orchestrator-in-command-line VERSION="1.5.0-alpha01" ORCHESTRATOR_APK_PATH="$HOME/Desktop/orchestrator.apk" TEST_SERVICES_APK_PATH="$HOME/Desktop/test-services.apk" if [ ! -f "$ORCHESTRATOR_APK_PATH" ]; then curl -o "$ORCHESTRATOR_APK_PATH" "https://dl.google.com/dl/android/maven2/androidx/test/orchestrator/$VERSION/orchestrator-$VERSION.apk" 2>/dev/null fi if [ ! -f "$TEST_SERVICES_APK_PATH" ]; then curl -o "$TEST_SERVICES_APK_PATH" "https://dl.google.com/dl/android/maven2/androidx/test/services/test-services/$VERSION/test-services-$VERSION.apk" 2>/dev/null fi DEVICE_API_LEVEL="$(adb shell getprop ro.build.version.sdk)" FORCE_QUERYABLE_OPTION="" if [[ "$DEVICE_API_LEVEL" -ge 30 ]]; then FORCE_QUERYABLE_OPTION="--force-queryable" fi # uninstall old versions adb uninstall androidx.test.services || true adb uninstall androidx.test.orchestrator || true # Install the test orchestrator. adb install "$FORCE_QUERYABLE_OPTION" -r "$ORCHESTRATOR_APK_PATH" # Install test services. adb install "$FORCE_QUERYABLE_OPTION" -r "$TEST_SERVICES_APK_PATH" # app_process spawns a new process # Add "-e clearPackageData true" to clear your app's data in between runs. adb shell 'CLASSPATH=$(pm path androidx.test.services) app_process androidx.test.services.shellexecutor.ShellMain / \ am instrument -w \ -e targetInstrumentation com.example.android.testing.androidtestorchestratorsample.test/androidx.test.runner.AndroidJUnitRunner \ -e clearPackageData true \ androidx.test.orchestrator/.AndroidTestOrchestrator' ```When I run it, all I get is
Aborted
(from the lastadb
invocation –adb shell 'CLASSPATH ...
)Full logs of running the script above
```console $ bash -x ./orchestrate + set -euo pipefail + VERSION=1.5.0-alpha01 + ORCHESTRATOR_APK_PATH=/Users/bartek/Desktop/orchestrator.apk + TEST_SERVICES_APK_PATH=/Users/bartek/Desktop/test-services.apk + '[' '!' -f /Users/bartek/Desktop/orchestrator.apk ']' + curl -o /Users/bartek/Desktop/orchestrator.apk https://dl.google.com/dl/android/maven2/androidx/test/orchestrator/1.5.0-alpha01/orchestrator-1.5.0-alpha01.apk + '[' '!' -f /Users/bartek/Desktop/test-services.apk ']' + curl -o /Users/bartek/Desktop/test-services.apk https://dl.google.com/dl/android/maven2/androidx/test/services/test-services/1.5.0-alpha01/test-services-1.5.0-alpha01.apk ++ adb shell getprop ro.build.version.sdk + DEVICE_API_LEVEL=33 + FORCE_QUERYABLE_OPTION= + [[ 33 -ge 30 ]] + FORCE_QUERYABLE_OPTION=--force-queryable + adb uninstall androidx.test.services Failure [DELETE_FAILED_INTERNAL_ERROR] + true + adb uninstall androidx.test.orchestrator Failure [DELETE_FAILED_INTERNAL_ERROR] + true + adb install --force-queryable -r /Users/bartek/Desktop/orchestrator.apk Performing Streamed Install Success + adb install --force-queryable -r /Users/bartek/Desktop/test-services.apk Performing Streamed Install Success + adb shell 'CLASSPATH=$(pm path androidx.test.services) app_process androidx.test.services.shellexecutor.ShellMain / \ am instrument -w \ -e targetInstrumentation com.example.android.testing.androidtestorchestratorsample.test/androidx.test.runner.AndroidJUnitRunner \ -e clearPackageData true \ androidx.test.orchestrator/.AndroidTestOrchestrator' Aborted ```And here's the logcat excerpt that I think might be relevant
Details
``` 05-08 21:56:14.935 30629 30629 E appproc : ERROR: could not find class '/' 05-08 21:56:14.935 30629 30629 F app_process: thread.cc:2468] No pending exception expected: java.lang.ClassNotFoundException: . 05-08 21:56:14.935 30629 30629 F app_process: thread.cc:2468] (Throwable with empty stack trace) 05-08 21:56:14.935 30629 30629 F app_process: thread.cc:2468] ... 05-08 21:56:14.970 30629 30629 F app_process: runtime.cc:676] Runtime aborting... 05-08 21:56:14.970 30629 30629 F app_process: runtime.cc:676] All threads: 05-08 21:56:14.970 30629 30629 F app_process: runtime.cc:676] DALVIK THREADS (5): 05-08 21:56:14.970 30629 30629 F app_process: runtime.cc:676] "main" prio=5 tid=1 Runnable ...I'd appreciate any help getting this script to work.