Skip to content

Android Test

jugg instrument runs class- or method-level tests from an androidTest source-file anchor. It reuses Jugg's compilation and deployment flow to update the app and test APKs on the device before executing instrumentation.

Run entry points and supported scope

Run entry pointCurrent supportInput boundary
Run by androidTest source fileSupported--source-path is required
Run by test classSupported--source-path + --class
Run by test methodSupported--source-path + --class + --method
Specify the instrumentation runnerSupported--runner
Pass -e extrasBatch arguments supported--extras 'k=v;k2=v2'
Use a package / regex as the Jugg target entry pointNot supportedRefresh APKs with sourcePath first, then use native adb shell am instrument for broader filtering if needed

Command format

text
jugg instrument --source-path app/src/androidTest/kotlin/com/example/FooTest.kt
jugg instrument --source-path app/src/androidTest/kotlin/com/example/FooTest.kt --class com.example.FooTest
jugg instrument --source-path app/src/androidTest/kotlin/com/example/FooTest.kt --class com.example.FooTest --method testSomething
jugg instrument --source-path app/src/androidTest/kotlin/com/example/FooTest.kt --runner androidx.test.runner.AndroidJUnitRunner --extras 'size=large;clearPackageData=true'

sourcePath identifies the test module, target test APK, test class, and method ownership. Scenarios with multiple test APKs require it to select the target; a package or regex alone is insufficient.

Prerequisites

The project must already have an AndroidTest full-build baseline. Run:

text
jugg status --console=json

and read data.enabledAndroidTest. If it is false, enable Android Test / enableAndroidTest in the Jugg App Run Configuration, run one full build or gradle-build, and then check the status again.

IMPORTANT

When enabledAndroidTest=false, instrument returns INVALID_PARAMS and does not infer or build an AndroidTest baseline automatically.

Run result

instrument is a build-related command and blocks until a terminal state. A successful jugg instrument means that app source and androidTest source were compiled and deployed to the corresponding APKs before instrumentation ran. If only broader native test filtering is needed afterward, use native adb shell am instrument once the APKs have been refreshed.