Skip to content

Write tests

A test is a JSON file with schema_version: 2, a name, and a non-empty list of steps that run in order. Each step is either an action (do) that drives PuppetXR's simulated devices, or an expectation (expect) that waits for an effect the app reports. geppetto validate checks every field before any input is sent; schemas/test-v2.schema.json describes the same format for editors, and the validator in src/geppetto/spec.py is authoritative.

{
  "schema_version": 2,
  "name": "Open the main menu",
  "description": "Pull the trigger on the menu button and wait for the app to report it.",
  "timeout_seconds": 60,
  "steps": [
    {"id": "aim", "do": "point", "hand": "right", "target": "menu.open"},
    {"id": "click", "do": "click", "hand": "right"},
    {"id": "opened", "expect": "state", "provider": "menu", "path": "open", "equals": true}
  ]
}
Field Meaning
name Shown in output, receipts and the dashboard.
description Optional prose for reviewers.
timeout_seconds Wall-time budget for the whole test, 1–86400; default 300.
steps[].id Optional unique ID used in receipts; generated from the position when omitted.
steps[].note Optional prose kept with the step.

Unknown fields are rejected, so a typo fails validation instead of being ignored.

Actions

Step Fields Does
pose device (head, left, right), position [x, y, z], optional orientation [x, y, z, w], optional over_frames (1–900), optional settle_frames (default 3) Places the head or a hand in stage space, then waits settle_frames. With over_frames it moves there from where it is, eased, one pose a frame, as a person turns or reaches, instead of jumping.
point hand, one of at [u, v] or target, optional eye (left/right, default left), optional from (eye, default, or body), optional over_frames (1–900), optional distance (0.05–10 m, with from: body and at), optional ahead (0–10, with from: eye), optional settle_frames (default 3) Moves the hand so its ray starts at the eye and passes through a point of that eye's image, 0 0 top left. With target, the point is the centre of a Geppetto target as the app projects it; Geppetto asks again for up to 30 frames while the target is unavailable or out of view, then fails without moving the hand. ahead is passed to PuppetXR's point_hand. With from: body the hand points as a person does: it starts below and ahead of the chest and turns so its own aim ray passes through the point, which lies distance metres from the eye, a target's distance coming from the app. over_frames eases the hand there one pose a frame. Then it waits settle_frames.
click hand, optional hold_frames (default 8), settle_frames (default 0) One trigger press: trigger/value pressed, held, released.
press hand, input, optional hold_frames, settle_frames One press of a button or trigger, such as a/click or squeeze/value.
input hand, input, value Holds an input at a value until a later step changes it: true/false for …/click and …/touch, 0–1 for …/value, [x, y] in −1…1 for thumbstick.
wait frames (≥ 1) Lets frames run.
screenshot name (lowercase letters, digits, -, _; unique in the test) Saves the composited left eye as <name>.png next to the receipt.
action action (an action ID such as app.reset), optional arguments (a JSON object, default {}) Runs a fixture the app defines to arrange or reset state. Needs the Unity adapter.
gesture hand, and either name (a built-in or loaded PuppetXR gesture, such as pinch_tap, grab, poke or wave) or file (a PuppetXR gesture .json in or below the test's folder, at most 15 KB as sent), optional params, optional source (hand or controller) Plays the gesture on that hand and waits until it ends. Set source: "hand" for an app that reads hand tracking: a built-in gesture plays on whatever tracks the hand, and on a controller its pinch is not a tracked-hand pinch. params are the gesture's own: a number, a point [x, y, z], or an expression such as "head + forward * 0.4"; PuppetXR checks them. The receipt records the gesture's events, such as pinch and release, and for a file its path and SHA-256.

A pose or point waits 3 frames after moving the device by default, so the app sees it where it was moved before the next input. Without that, a click sent at once can land where the hand aimed before: on the PuppetXR demo player, 3 of 8 fresh runs counted the first targeted click as a miss, against none of 8 with the wait. Set settle_frames to 0 only when a test must move and press in the same frames.

A point with from: body looks like a person pointing, for screenshots and videos. A PuppetXR that aims tracked hands from the shoulder, as a Quest 3 does (PuppetXR after 0.2.0), holds a tracked hand as a person reaching towards the point, and Geppetto uses that pose; the receipt says "aim": "shoulder". Otherwise the aim is a fixed offset in the grip (a controller, or a tracked hand on PuppetXR 0.2.0): the hand rests 0.25 m below the head, 0.42 m ahead along its heading and 0.15 m out to its side, then turns until that aim ray passes through the point ("aim": "grip"). Geppetto asks PuppetXR with point_hand calls while the app is paused, and tells the two apart by pointing at two distances. It puts the hand back before any frame, so the app only ever sees the hand at rest or easing. A target's distance comes from the app (eyeDistance, from Geppetto 0.5 on); with at, give distance. A point at a target from the eye sends that distance too, as a shoulder-aimed hand hits the target only there.

A gesture file travels with the test, so a run needs nothing loaded into PuppetXR first. Its path is relative to the test, with / between folders and only letters, digits, _, - and . in names; it must stay inside the test's folder, symlinks included, and be a regular file; the gesture format is PuppetXR's (docs/hand-motion.md there, and puppetxrctl gesture check <file>). When a directory of tests runs, a JSON file that one of its tests plays as a gesture is not run as a test.

A gesture step from a file: at 0:36 Singularity waits for cupped, palms-up hands; the test cups both tracked hands with cup_hands.json and passes when Unframed reports three bites. Footage: Unframed by Ambient Intent on PuppetXR, recorded by Geppetto; Singularity (2026) © Blender Studio / Blender Foundation, CC BY 4.0.

Input names are <control>/click, <control>/value, <control>/touch, or thumbstick.

An action is never allowed to change project files: Geppetto never confirms one, so the app refuses any action it marks as a project mutation. If the app refuses or fails an action, the test stops with an error before the next step. An action is not an expectation; its success does not count toward a pass.

A press or click is a single pulse and is never sent again. Inputs held by input, or a press cut short by an error, are released when the test ends, whatever the outcome. A pose, point or gesture moves its device for the rest of the test; afterwards Geppetto puts each moved device back where it was before the test, and the hand's source (controller or tracked hand) too, so the next test does not depend on the order they run in. A gesture still playing when a test ends is stopped.

Expectations

Step Fields Passes when
log pattern (Python regular expression), optional within_frames (default 180), optional absent A line the app logged after the last input began matches. With absent: true, it passes when no line matches within the frames. Needs --app-log.
state provider, path, one comparison (below), optional within_frames (default 180) The app's state provider reports a value at path that satisfies the comparison within the frames. Needs the Unity adapter.

A key may appear only once in an object: geppetto validate rejects a repeated one rather than keeping the last value silently.

path is dot-separated keys or list indices, such as level or items.0.name. A state expectation takes exactly one comparison:

Comparison Passes when the value
equals is the same JSON value, with types kept apart: true does not equal 1, and "3" does not equal 3
near with tolerance is a number within tolerance of near, or, when near is a list of up to 16 numbers, a list of as many numbers within tolerance of it by straight-line distance
at_least, at_most (either or both) is a number no smaller than at_least and no larger than at_most
changed_from (an earlier state expectation's id), optional by_at_least differs from the value that step saw; with by_at_least, numbers or lists of numbers moved at least that far

changed_from proves an input moved a value without knowing where it started: read it once, interact, then expect it changed. The earlier step must read the same provider and path, and the value must actually differ, even with by_at_least: 0. Use it for values that do not change on their own, such as a setting, not for a clock or a playing film.

{"id": "before", "expect": "state", "provider": "settings", "path": "volume", "at_least": 0},
{"id": "aim", "do": "point", "hand": "right", "target": "settings.volume_up"},
{"id": "press", "do": "click", "hand": "right"},
{"expect": "state", "provider": "settings", "path": "volume", "changed_from": "before", "by_at_least": 0.1}

Use near for positions, sizes and angles the engine computes, which rarely come out exact:

{"expect": "state", "provider": "film", "path": "screen.position",
 "near": [0, 1.6, 2.2], "tolerance": 0.02}

A true or false, a string, or a non-finite number never satisfies near, at_least or at_most. A failed near reports how far away the value was.

Log expectations read only what the app wrote after the most recent pose, point, press, click or input began, so waits and screenshots in between do not hide the response, and an earlier line cannot satisfy a later check. An action does not start a new scope, so a line a fixture logs before the next input can still match.

To find the target IDs, state paths and action IDs a running app offers, run geppetto inspect (or geppetto inspect --json).

Make a pass mean something

  • Use action only to reach the starting state. It must never perform the interaction under test.
  • Every interaction (click, press, input, gesture) needs an expectation after it; geppetto validate rejects a test with an interaction nothing checks afterwards, so an expectation made before the input cannot pass it. pose, point, wait and screenshot may come after the last expectation. A test with no interaction and no expectation is inconclusive and does not pass.
  • Assert a fact the app owns. Do not add a test-only success flag.
  • If a state value might already be true, assert the opposite before the input, so an unchanged value cannot pass.
  • A negative test must prove the attempt reached the app: pair absent: true, or an unchanged value, with a positive check that the app saw the attempt.
  • Prefer target to fixed at coordinates once the app has stable targets.
  • Keep every wait bounded. within_frames, wait.frames and timeout_seconds are the only clocks.