DroidTest is a small command-line runner for Android adb diagnostics. It reads commands from a file, executes them in sequence, and produces a clean pass/fail summary.
- Refactored into a package structure (
droidtest/) instead of one large script. - Safer command parsing with
shlex.split. - Better command file parsing (ignores comments and blank lines).
- Optional per-command timeout.
- Optional
adb -s <serial>device targeting. - Optional stop-on-first-failure mode.
- JSON report export.
- Consistent process exit codes (
0success,2when any command fails).
DroidTest.py— backward-compatible launcher.droidtest/core.py— command loading and execution logic.droidtest/cli.py— argument parsing and output behavior.list.txt— default command list.tests/— unit tests.
- Enable Developer options on the phone:
- Open Settings → About phone.
- Tap Build number 7 times.
- Enable USB debugging:
- Open Settings → Developer options.
- Turn on USB debugging.
- Connect the phone to your machine via USB.
- Accept the RSA authorization prompt on the phone (Allow USB debugging).
- Verify ADB can see your device:
adb devicesYou should see your device serial with device status. If you have multiple connected devices, run DroidTest with --device <serial>.
- If the device shows as
unauthorized, revoke USB debugging authorizations on the phone and reconnect. - If no device appears, check your USB cable/port and ensure ADB is installed and available in
PATH. - Restart ADB if needed:
adb kill-server && adb start-serverpython DroidTest.py [options]-c, --commands-filePath to commands list file (default:list.txt)-d, --deviceADB device serial (adb -s ...)-t, --timeoutPer-command timeout in seconds-v, --verbosePrint command output inline-S, --success-onlyPrint only successful commands-F, --fail-onlyPrint only failed commands--stop-on-failureStop after first failed command--json FILESave full execution report as JSON--success-file FILEAppend pass details to file--fail-file FILEAppend failure details to file
python DroidTest.py -v --timeout 8 --json report.json --fail-file failed.logThe default command file is list.txt. Each non-empty, non-comment line should be an adb subcommand:
# comments are allowed
shell getprop ro.product.model
shell dumpsys battery
DroidTest prefixes each line with adb automatically.
python -m unittest discover -s tests -p 'test_*.py'