Skip to main content
simile test owns the emulator for the lifetime of one test command. It binds the service first, passes its address to the child process, waits for the child, and shuts the emulator down. The command returns the child’s exit code.
This loads ./Simfile, chooses an available loopback port, and sets SIMILE_BASE_URL for npm test. The same pattern works with any test runner:

Test a registered service

Name a registered service when the test project does not contain its Simfile:
The registered artifact and service state are reused. simile test still selects an available port for the supervised run. Pass --port when a test framework requires a fixed address:

Supply a caller profile

Set up a profile once, then inject it into the test process:
The child receives:
  • SIMILE_BASE_URL, containing the address bound for this run;
  • SIMILE_SERVICE, containing the service name;
  • SIMILE_PROFILE and SIMILE_PRINCIPAL; and
  • every value issued by setup, using its uppercase environment name such as API_KEY.
When --profile is omitted, a registered service’s current profile is used when one exists. Simile keeps issued values out of its status output.

Exercise controlled failures

A scenario selects one documented business case for the complete run:
A fault profile supplies bounded environmental failures:
Use a scenario when the request should reach a particular public outcome. Use a fault profile for latency, disconnects, truncation, and related transport conditions.

Choose the state boundary

The service state lives under SIMILE_HOME. A stable directory lets later runs continue from the same resources and profiles:
Choose a fresh directory for an isolated test run:
Keep each parallel test worker on its own SIMILE_HOME; a durable service database has one writer.

Keep the service running

Use simile start when a developer, browser, or separately managed test process needs a stable address:
The process remains in the foreground until interrupted. See Lifecycle for registration, updates, setup, and long-running startup.

Continue