Browse the docs

POST /tests

Runs the tests macros declare, sealed off from the Mac, and optionally checks the elements and menus they depend on, then returns every result.

Details #

Runs macro tests in the engine and answers when they are done. A test is a sealed dry run: nothing touches the Mac. A check looks for what the macro depends on (an element, a menu item, an app, a shortcut, an extension, a called macro, a hotkey) and never acts.

The body is optional JSON. All keys are optional.

{ "macros": ["Slugify"], "tests": true, "checks": false }
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
  -d '{"macros":["Slugify"]}' http://127.0.0.1:48080/tests

The answer has reports (one per macro: its results, each with its expectations and the sealed run) and checks (one per macro: items with a status of pass, warn, fail or skipped).

Parameters #

curl --unix-socket "$SWITCHBOARD_HOME/engine.sock" -X POST http://localhost/tests

Run the macros' tests, sealed off from the Mac, and optionally check what they depend on. The Unix socket needs no token; loopback 127.0.0.1:48080 needs Authorization: Bearer <api-token>.

Gotchas #

  • 404 with no macro <name> when a name matches nothing; 400 when a name matches two macros.

  • A test run is kept in the trace store as a run of kind test. It does not appear in GET /runs.

  • A failing test is a normal answer (200), not an error.

See also #