Shuttle SDK

Android QA SDK that plays the scenarios Selvage compiles

Kotlin libraries that read the scenario JSON the Selvage scenario compiler writes, so one scenario format serves an iOS app and an Android app. 3 library modules and a sample Compose app.

  • •Reads compiled scenario JSON with its own reader and no third-party dependency
  • •Plays steps against a ScenarioDriver the app supplies
  • •Pause, single step and breakpoints during a run
  • •An OkHttp interceptor keeps a redacted traffic log and applies interception rules
  • •A debug dependency: nothing in it belongs in a release build
Private RepositoryThis is a private repository. Its source code on GitHub is visible once the owner grants you access.
3
Modules
1
Standalone
26
Sample minSdk
MIT
License
0.1.0
Version
WIP
Status

Tech Stack

KotlinOkHttpJetpack ComposeJUnit 5Gradle KTS + Version Catalog

A scenario, step by step

02-save-an-item.jsonjson
  1. {
  2. "id": "02-save-an-item",
  3. "name": "A typed item is saved to the list",
  4. "platforms": ["ios", "android"],
  5. "steps": [
  6. {"command": "launchApp", "args": {"clearState": true, "permissions": {"location": "unset"}}},
  7. {"command": "assertVisible", "args": {"selector": {"id": "checklist_title_label"}}},
  8. {"command": "tapOn", "args": {"selector": {"id": "checklist_add_button"}}},
  9. {"command": "inputText", "args": {"selector": {"id": "item_title_field"}, "text": "Water the plants"}},
  10. {"command": "hideKeyboard"},
  11. {"command": "tapOn", "args": {"selector": {"id": "item_save_button"}}},
  12. {"command": "assertVisible", "args": {"selector": {"id": "checklist_item_label", "text": "Water the plants"}}},
  13. {"command": "takeScreenshot", "args": {"name": "item-saved"}}
  14. ]
  15. }
Step 1 of 8
The compiled scenario JSON that Shuttle reads, played on a made-up checklist app. An illustration, not a recording.

How it works

A scenario is written once in YAML, compiled to canonical JSON and played against the app. Every run leaves evidence and a verdict.

Authorscenario YAMLSelvage kernelcompile.py · in-appAndroid · Shuttlethe app's driverEvidenceredactedReportverdict · filesJSON
The same scenario files also run on iOS with Selvage and on the web with Heddle.

A run, step by step

  1. 01

    Write the scenario

    One file holds two YAML documents split by ---: the config (appId, name, tags, seed, mocks, lanes) and the list of steps. It sits at Scenarios/Modules/<Module>/<Screen>/<id>.yaml. Sub-flows live in Common/Shared and are pulled in with runFlow, and Common/compiler.yaml holds the settings both compilers read.

    Never parses YAML on the device. It reads the JSON the Selvage kernel writes.

  2. 02

    Compile and check

    The compiler turns each file into canonical JSON with its sub-flows inlined. An unknown key, command or argument is an error that names file:line:column, prints the line and puts a caret under the fault.

    Takes the output of compile.py --out. Its conformance fixtures are compiler output and must read back and re-serialise byte for byte.

  3. 03

    Gates before anything runs

    Cheap checks come first, so a broken catalogue never costs a build or a device.

    No gate stage. A command the runner does not know fails its step instead of being skipped.

  4. 04

    Seed and launch

    After sub-flows are inlined the first step is launchApp, exactly one per scenario, and an openLink right after it is folded into the launch. The seed (locale, link and the app's own values) travels with the launch. onFlowStart runs before it, onFlowComplete after the steps whether they passed or not.

    The sample reads a LaunchEnvelope from its launch intent; that is how the seed's greeting prefix reaches the screen.

  5. 05

    Play the steps

    Each step resolves its selector (id, text, index and the rest) and acts: tap, type, scroll, wait. repeat, retry, runFlow and measure nest, and ${VARIABLES} resolve at run time.

    ScenarioRunner hands each step to the ScenarioDriver the app supplies. RunGate gives pause, single step and breakpoints.

  6. 06

    Assert

    assertVisible, assertNotVisible, assertCount, assertTrue and assertNetwork check what the screen and the network promised. A failed assertion fails the scenario on that step.

    An element that is not found fails the step unless its selector is optional. A driver that cannot do a command returns unsupported, which the report marks as a runner failure.

  7. 07

    Collect evidence, redacted

    While the steps run, each SDK records what happened: screens, network, logs. Secrets are masked before anything is written to disk.

    A RunReport with each step's status, time and message. The OkHttp interceptor keeps a traffic log that is masked before it is truncated, and the run journal masks secret-looking variables.

  8. 08

    Verdict and report

    The run ends with a status per scenario and files a person and a machine can both read.

    The RunReport status is PASSED, FAILED, CANCELLED or SKIPPED. The app decides how to show or ship it.

Locally and in CI

ShuttleAndroid

Locally

JDK 17 and the Android SDK. The sample app bundles compiled scenarios under assets/scenarios.

./gradlew check
./gradlew check :sample:assembleDebug
  • check runs the unit tests of every module, Android lint for the sample, the scrub gate and its self-test.
  • The bundled scenarios also run as JVM tests against the sample's own driver, so check plays them without a device.
  • On a device, install the sample and press Run scenarios: each scenario prints passed or failed, with the failing step's message.
In CI
Workflow: .github/workflows/ci.yml · Triggers: push to main, pull_request

GitHub Actions on every push to main and every pull request: ubuntu-latest, Temurin JDK 17 and the Android SDK, with every action pinned to a commit SHA and the Gradle wrapper validated first.

bash scripts/scrub-gate.sh
bash scripts/scrub-gate-test.sh
bash ./gradlew check :sample:assembleDebug --no-daemon
  • There is no emulator in CI. The scenarios run as JVM tests inside check.
  • The build fails on a failing test, a lint error, the scrub gate or a wrapper that does not validate.
  • A push with an empty deny-list secret fails. A pull request without the secret, as from a fork, warns and runs the other checks.
  • No artifacts are uploaded.

What Shuttle adds

  • A strict, bounded reader for the compiled scenario JSON, with no third-party dependency
  • A runner that plays steps against a driver the app supplies, with pause, single step and breakpoints
  • A crash-safe journal of the active run
  • An OkHttp interceptor: a redacted traffic log, plus rules that answer locally, rewrite, delay or fail a call
  • Not in Shuttle: a UI driver (the app supplies one), a bug-report archive and a dashboard; YAML is compiled by the Selvage kernel

Features

Scenario Contracts

shuttle-contracts reads what the Selvage scenario compiler writes.

  • •Scenarios, sub-flows, steps, selectors, seed and mocks
  • •The launch envelope and the run report types
  • •Compiled fixtures must read back and re-serialise byte for byte

Scenario Runner

shuttle-runner plays a scenario against a ScenarioDriver the app provides.

  • •Hooks, repeat, retry, runFlow and measure
  • •Variables and expressions
  • •Pause, single step and breakpoints through RunGate, and a journal of the active run
  • •A command the runner does not know fails the step

Network Traffic

shuttle-okhttp adds an OkHttp interceptor; OkHttp is a compileOnly dependency.

  • •A redacted traffic log
  • •Rules that answer locally, rewrite the request or the response with JSON patches, delay or fail a call

Privacy & terms