test-on-device
Skill1 starsChanged 21 days agoMITView on GitHub
Verify an Android app change on the user's real Android phone - build, install, open, drive the changed screens with CodeDroid, check logcat for crashes, run instrumentation tests, run the app's CUJ test cases from cujs/, and report what was seen. Use after changing Android app code, when asked to test, reproduce or verify something on a device, to run an app's CUJs or test cases, or before saying an Android change works.
In this repository3 other files it gives its agents.
- codedroid-phoneSkill
- create-cujsSkill
- create-testsSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
If adb is not in your tool list, the user turned it off (--no-adb or CODEDROID_MCP_ADB=0): ask them to turn it back on, or to run the adb …
- Very specific: line 33
If the phone is on adb, adb logcat -c to clear the logs, so what you read later is from this run.
- Very specific: line 42
Check what the change should show: the text and state in get_screen (a switch is checked or unchecked, a field shows its text), and …
- Very specific: line 71
Read the CUJ file: its Starts line is where every test begins, and each ### under ## Tests is one test, with its Steps and Expected lines.
- Very specific: line 74
Put the app in the Starts state before each test: open_app, then back to its first screen or sign in as Starts says (Back out of the app …
- Distinctive: line 79
If Starts needs an account you have not been given, ask the user.
- Very specific: line 80
Follow the Steps one at a time with get_screen, tap, type_text, swipe, press_key and wait_for, as section 3 does.
- Very specific: line 85
Check each Expected line against get_screen, or take_screenshot for anything visual.
- Distinctive: line 87
Read the crash buffer after the run, as in section 4.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Testing an Android change on the phone
You have two kinds of tools: CodeDroid's (get_screen, tap, type_text, wait_for,
take_screenshot, ...), which see and drive the screen exactly as it is, and adb, which runs
this computer's adb. Use install_apk to install; use adb to start and inspect; use CodeDroid to look and act.
The codedroid-phone skill covers driving the screen.
If adb is not in your tool list, the user turned it off (--no-adb or CODEDROID_MCP_ADB=0): ask
them to turn it back on, or to run the adb commands themselves.
1. Know the phone
CodeDroid reaches the phone through the CodeDroid server; adb needs it on this computer, over USB
or Wireless debugging. Call codedroid_status and device_info for the phone's model and
Android user, and adb devices -l to find the same model there. If adb lists none, go on
without it, or ask the user to connect it for logs and instrumentation tests; if it lists several, pass the same device to adb as to the phone tools, or -s <serial> when two are the same model. On a phone with
several users (a Googlebook runs as user 10), adb's settings, content, pm grant and
appops default to user 0: add --user <user> to them. adb install covers every user.
2. Build and install
- Build with the project's own task, e.g.
./gradlew :app:assembleDebug(check the module and variant names in the project first). - Install with
install_apk:app/build/outputs/apk/debug/app-debug.apk. It needs no cable, keeps the app's data, and says what went in. A signature mismatch means the phone has another build: ask the user before removing it, which deletes the app's data. On a phone attached to adb,install -r -g <apk>also grants the runtime permissions. - If the phone is on adb,
adblogcat -cto clear the logs, so what you read later is from this run.
3. Open it and drive the change
open_appwith the package, oradbshell am start -W -n <package>/<activity>. For a deep link:shell am start -W -a android.intent.action.VIEW -d "<uri>" <package>.wait_fortext on the first screen, rather than sleeping.- Walk to the changed screen with
get_screenandtap/type_text/swipe, readingaftereach time. - Check what the change should show: the text and state in
get_screen(a switch ischeckedorunchecked, a field shows its text), andtake_screenshotfor anything visual. - Try the edges the change touches: empty input, rotation (
adbshell settings put system user_rotation 1aftershell settings put system accelerometer_rotation 0), dark theme (shell cmd uimode night yes), back navigation. Put settings back afterwards.
4. Check the logs
- Crashes:
adblogcat -d -b crash. A crash kills the process, so read the crash buffer rather than filtering by process id. - Errors:
logcat -d -t 300 *:E; one app's lines:shell pidof <package>, thenlogcat -d --pid=<pid>. - ANRs:
shell logcat -d -b system | grep -A5 "ANR in"(aftershell, the pipe runs on the phone).
5. Instrumentation tests
adb shell am instrument -w -r -e class <fully.qualified.TestClass> <test-package>/androidx.test.runner.AndroidJUnitRunner
with timeout_s set for the run (install the test APK first:
./gradlew :app:installDebugAndroidTest). The reply sums up the run: the counts and each failure's
stack. An error means the run itself did not finish (a crash, a timeout, no tests ran), so read the
crash buffer as in section 4. Tests that use UiAutomator suspend CodeDroid's accessibility
while they run: call codedroid_status before using its tools again.
6. CUJ test cases
The app's journeys and their tests are markdown files in its repo, cujs/ unless the user says
otherwise (the create-cujs and create-tests skills write them). To run them, all or the ones the
user names:
- Read the CUJ file: its Starts line is where every test begins, and each
###under## Testsis one test, with its Steps and Expected lines. adblogcat -cbefore the first test, so the crashes you read later are from this run.- Put the app in the Starts state before each test:
open_app, then back to its first screen or sign in as Starts says (Back out of the app andopen_appagain is fine too).open_appresumes the app where it was, and some screens keep Back for themselves: if Back does not get there,adbshell am force-stop <package>(the app under test, never com.codedroid.agent) andopen_appagain. That keeps its data; don't clear the data to get there without asking. If Starts needs an account you have not been given, ask the user. - Follow the Steps one at a time with
get_screen,tap,type_text,swipe,press_keyandwait_for, as section 3 does. A step you cannot do as written (the button is not there, the screen differs) fails the test: stop it there and say which step. Before a step that would send, buy, post or delete for real, ask the user, every time, even though the test says to; if they say no, report the test as not run. - Check each Expected line against
get_screen, ortake_screenshotfor anything visual. Each line passes or fails on what you saw, not on what the steps should have done. - Read the crash buffer after the run, as in section 4.
Report each test as passed or failed, with the failing step or Expected line and what the screen showed. Leave the files as they are unless the user asks you to update a test that is out of date.
7. Report
Say what you checked and what you saw, step by step, and whether the change works. Include a
screenshot when the change is visual (take_screenshot; if CodeDroid is suspended, adb
exec-out screencap -p with save_to), and the crash's stack trace (from logcat -d -b crash)
when there was one. If something could not be checked (the phone was locked, a screen could not
be reached), say so rather than guessing.
Never
- Force-stop, clear, uninstall or
am instrumentcom.codedroid.agent: it switches CodeDroid off. - Uninstall an app, clear its data, reboot or delete files without asking the user first.
- Stream:
logcatwithout-dandscreenrecordwithout--time-limitrun until the call times out.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

