Comments (2)
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]
modified last part of the orchestrate.bash script
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'
from testing-samples.
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:
orchestrate.bash - working
#!/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'
I realized this after I got curious about SpeakEasy, and found its README.
from testing-samples.
Related Issues (20)
- Could not resolve com.android.tools.utp:android-test-plugin-host-additional-test-output:30.3.1 HOT 1
- `captureToBitmap` clips the image to the device screen size HOT 1
- testInstrumentationRunnerArguments clearPackageData in kotlin dsl and recent gradle HOT 1
- Support test validation on GitHub Actions HOT 2
- instrumentation app can use proguard?
- A
- Test HOT 1
- A HOT 1
- Run HOT 1
- Test HOT 1
- A
- Aa
- A
- My sample
- ScreenshotTestSample with Gradle Manged Devices and several shards generates screenshots for last shard only
- Not compiling test class with a fragment that not inherits directly but indirectly from Fragment class
- Gradle Managed Device not able to run with Orchestrator HOT 8
- [Bazel CI] Error: 'android_instrumentation_test' is not defined with bazel@HEAD HOT 1
- test HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testing-samples.