CLI

[ AxiomCore · Documentation ]

Test and mock commands

Reference for axiom test, the axiom scenario subcommands and axiom mock, with every argument, option and default.

These commands test a backend contract without production providers: axiom test runs the HTTP checks declared in the contract, axiom scenario replays scripted development scenarios against exact compiled artifacts, and axiom mock serves simulated responses. This page covers Axiom CLI 0.149.1.

CommandStatusNeeds
axiom testAlphaA running service at each suite's baseUrl.
axiom scenarioExperimentalA compiled contract and private server plan. No listener or network.
axiom mock (local)AlphaNothing remote. Server profiles need a private plan and fixtures.
axiom mock --cloudAlphaNetwork, axiom login and a linked Cloud project.
Which command to use for which kind of test
Which command to use for which kind of test
Diagram source
flowchart TD
  Q{What do you need?} --> L[Live HTTP checks]
  Q --> D[Deterministic replay]
  Q --> F[A fake API for a client]
  L --> T[axiom test]
  D --> SC[axiom scenario check]
  SC --> SR[axiom scenario run]
  F --> MS[axiom mock --profile server]
  F --> MC[axiom mock --profile contract]
  F --> CL[axiom mock --cloud]

Use axiom test against a running service. Use axiom scenario for logical-time replay of managed actions with no listener. Use axiom mock when a client needs an API to call: the server profile runs through the real server boundary with private fixtures, the contract profile serves endpoint scenarios, and --cloud serves the mock configuration stored in Axiom Cloud. Guides: Contract tests, Mocks and Server simulation.

Run contract test suites

axiom test

Run the test suites declared in the contract's testConfig. Each check sends a real request to its suite's baseUrl, so start the service first.

Usage
axiom test [OPTIONS] [FILE]
OptionValueDefaultMeaning
[FILE]pathaxiom.acoreBackend .acore file that declares testConfig.
--tagtextnoneRun only suites that carry this tag. With no match, the command prints a notice and exits 0.
--variantnamenoneContract variant used to resolve endpoint references.

Checks can select a contract route or an explicit URL, send request inputs, assert status, duration, schema, body and headers, and capture response values. A WebSocket endpoint uses its declared WebSocket contract. A failed check exits

  1. Without testConfig, the command fails and shows the declaration to add.

Real requests

Checks can perform real network writes. Verify each suite's baseUrl and credentials before you run it.

Terminal
axiom test axiom.acore --tag auth-critical

Replay development scenarios

axiom scenario

Validate and replay development scenarios against exact compiled artifacts.

Usage
axiom scenario <COMMAND>
SubcommandPurpose
catalogDescribe typed operations and exact artifact identities.
checkValidate every step without running application code.
runRun the scenario with logical time and strict scripts.

All three take the compiled backend contract and its private server plan. axiom build writes both: the contract under .axiom/contracts/ and the backend.server.json plan beside it. Contract and plan files are limited to 16 MiB.

axiom scenario catalog

Describe the typed operations, declared failures, supported controls and exact artifact identities, without executing anything. Copy its artifacts object into your scenario file.

Usage
axiom scenario catalog [OPTIONS] --plan <PLAN> <CONTRACT>
OptionValueDefaultMeaning
<CONTRACT>pathrequiredCompiled backend .axiom contract.
--planpathrequiredPrivate server plan for that contract.
--environmentpathnoneSynthetic expiry environment (axiom-scenario-environment/v1). Adds the environment digest to artifacts.
Terminal
axiom scenario catalog .axiom/contracts/backend.axiom --plan .axiom/contracts/backend.server.json

axiom scenario check

Validate every scripted value and assertion against the catalog. It acquires no resources and does not invoke application code.

Usage
axiom scenario check [OPTIONS] --plan <PLAN> --scenario <SCENARIO> <CONTRACT>
OptionValueDefaultMeaning
<CONTRACT>pathrequiredCompiled backend .axiom contract.
--planpathrequiredPrivate server plan.
--scenariopathrequiredScenario JSON file.
--environmentpathnoneSynthetic expiry environment, when the scenario was written against one.

On success it prints axiom-development-scenario-check/v1 JSON with "validated": true, "executed": false and the scenario hash.

axiom scenario run

Run the scenario through the native managed query fixture, with logical time and strict scripts. It opens no listener and uses no external provider or live credential.

Usage
axiom scenario run [OPTIONS] --plan <PLAN> --deployment <DEPLOYMENT> --scenario <SCENARIO> <CONTRACT>
OptionValueDefaultMeaning
<CONTRACT>pathrequiredCompiled backend .axiom contract.
--planpathrequiredPrivate server plan.
--deploymentpathrequiredReviewed deployment. Scenario data cannot grant permissions or create a principal.
--scenariopathrequiredScenario JSON file.
--environmentpathnoneReviewed, development-only synthetic expiry environment; no live credentials. It sets the clock epoch and seed, so it conflicts with --epoch-ms and --seed.
--epoch-msmilliseconds0Synthetic wall-clock epoch.
--seednumber7Test-only policy jitter seed. It never replaces secure randomness.
--reportpathnoneSave the bounded, payload-free report, including on assertion failure.
--observationspathnoneSave payload-free host observations, labeled scripted-provider.

Reports use axiom-development-scenario-report/v1 and label the executed level compiler-host. Unexpected calls, unused replies, stale artifacts, zero assertions and leaked owners fail the run. Cleanup also runs after a failed assertion, and Ctrl+C cancels owned work and still writes --report.

Terminal
axiom scenario run backend.axiom --plan backend.server.json \
  --deployment deployment.json --scenario retry.scenario.json \
  --epoch-ms 0 --seed 7 --report retry.report.json

Serve mock APIs

axiom mock

Run an isolated server simulation, a local contract mock, or a Cloud contract mock. It never starts real business execution and never uses production providers.

Usage
axiom mock [OPTIONS] [INPUT]
OptionValueDefaultMeaning
[INPUT]pathaxiom.acore.acore source or compiled .axiom artifact.
--profileauto, server, contractautoSimulation profile. See the table below.
--fixturespathadjacent mock.jsonPrivate typed fixtures for the server profile.
--identitiespathadjacent mock-identities.jsonReviewed mock identities.
--planpathadjacent <name>.server.jsonExact private plan. Artifact input only.
--variantnamedefaultSource variant to compile. Rejected for an artifact, whose variant is immutable.
--watchflagoffReload source and fixtures, keeping the last valid session. Source input only.
--hostIP address127.0.0.1Listener address.
-p, --portnumber8080Listener port. 0 selects an ephemeral port, except with --watch.
-d, --debugflagoffRedacted diagnostics. Never prints raw credentials or bodies.
--cloudflagoffServe Cloud contract mocks. Needs network, axiom login and a linked project.
--deploymentpathnoneRejected in mock mode: a real deployment is never reused.
--bindingspathnoneRejected in mock mode.
--deliverypathnoneRejected in mock mode.
ProfileSelected whenBehavior
serverThe input has a compiled private server plan (auto picks it).Full simulation inside the real server boundary. Keeps action guards and supported transport enforcement. Requires --fixtures or an adjacent mock.json.
contractThe input has no server plan (auto picks it).Endpoint scenarios from the contract. Rejects an input with a server plan, and rejects --fixtures and --identities.
Cloud--cloudContract mocks stored in Axiom Cloud, with cache and ETag retrieval. Conflicts with every local input, --variant and --watch, and supports only the contract profile.

A successful source reload with --watch resets simulation state and issues fresh credentials. A rejected reload keeps the last valid session. Input files must be regular files no larger than 16 MiB.

Terminal
axiom mock axiom.acore --profile server --fixtures mock.json
axiom mock api.acore --profile contract
axiom mock --cloud

To publish the Cloud mock configuration, use axiom deploy mock-server. To run the same simulation through axiom serve, see axiom serve --mock.