1. Start with the contract boundary
OpenAPI describes the HTTP contract: routes, operation IDs, request schemas, response statuses, media types, and response schemas. Simile HCL describes public behavior that cannot be proved from those schemas alone.createOrder must exactly match an OpenAPI operationId. The HCL cannot invent a route or choose a
status that OpenAPI does not declare.
Question 1. Where should a required JSON request field be defined?
- A. In the OpenAPI request schema
- B. In a
behaviorblock - C. In a scenario
Show answer
Show answer
A. OpenAPI owns the HTTP shape. HCL may refine behavior, but it does not replace the contract.
response.status = 201 is not declared by that OpenAPI operation?
- A. Simile silently adds it
- B. Compilation fails
- C. Simile changes it to
200
Show answer
Show answer
B. Cross-source contradictions fail before the service starts.
2. Name reachable outcomes
An outcome is one concrete result the operation can publicly produce.when.path is a JSON Pointer into Simile’s normalized request document. Multiple when blocks are
combined with logical AND: all predicates must match. The body is provider-authored and must
validate against the OpenAPI response schema for the selected status and media type.
Question 3. Two when blocks appear in one outcome. When is it eligible?
- A. When either predicate matches
- B. When both predicates match
- C. Only when a scenario selects it
Show answer
Show answer
B. Conditions within one outcome are conjunctive.
3. Reuse error families
Anerror_set collects named outcomes that many operations can share. Attach it to one behavior or
apply it by OpenAPI tag.
protocol_error for failures discovered by the protocol adapter—malformed JSON, unsupported
media types, authentication failure—not for an ordinary domain outcome.
Question 4. A card is valid JSON but the provider declines it. Which construct fits?
- A.
protocol_error - B. A named outcome, possibly in an
error_set - C. A stochastic fault
Show answer
Show answer
B. Decline is a service result. Protocol errors describe failures at the request/transport
boundary.
4. Use scenarios for exact tests
A scenario is an opaque, deterministic test control. It can select named outcomes and inject named environmental faults for several operations.run:
- A. Yes
- B. No; it names a public test case and its observable result
- C. Only in verbose mode
Show answer
Show answer
B. Scenarios preserve the public behavior while hiding private rules and thresholds.
simile start inttegro --scenario payment_declines do?
- A. Activates that scenario for the lifetime of the server process
- B. Applies it only to the first request
- C. Rewrites the registered configuration
Show answer
Show answer
A. The selection is process-wide for that invocation and does not mutate the registry.
5. Model effects without vendors
Backends name supporting systems. Effects attach consequences to committed operations. Async units describe actions that run outside the response-critical path.queue, not SQS; db, not PostgreSQL; cache, not Redis. The emulator needs the capability,
not a leak of the production implementation. The synchronous database action commits and
checkpoints before delivery. The named queue action dispatches afterwards, so it does not add
response latency.
Question 7. Which backend declaration is portable?
- A.
backend "db" "orders" {} - B.
backend "postgres" "orders" {} - C.
backend "rds" "orders" {}
Show answer
Show answer
A. Backend kinds deliberately describe provider-neutral capabilities.
6. Separate service results from environmental faults
A domain error is a deterministic outcome. A fault changes how an otherwise valid operation is delivered: delay, disconnection, or another environmental disruption.description explicitly.
Question 8. A request commits successfully, but the caller never receives the response. Is
that an outcome or a fault?
- A. Outcome
- B. Fault
- C. Protocol error
Show answer
Show answer
B. The service result exists; delivery was disrupted after commit.
7. Bound stochastic testing
Fault profiles opt a service into controlled random environmental failures.payment_method_declined for a valid payment method?
- A. Yes
- B. No
- C. Only with a seed
Show answer
Show answer
B. Domain outcomes require a matching public condition or an explicit scenario.
8. Compose and compile the service
The service block connects the listener, OpenAPI source, and HCL modules.simile describe; they never influence behavior.
- A. The original files at their old paths
- B. The compiled artifact installed in the registry revision
- C. The current working directory
Show answer
Show answer
B. Registration is a compiled, immutable snapshot.
describe reads that same artifact.9. Capstone
You need a test that creates an order, forces a publicrequires_payment result, persists the
committed order, queues follow-up work, and independently tests a response lost after commit.
Which design is sound today?
- A. Put every rule and vendor name into one large
scenario - B. Define HTTP shapes in OpenAPI; define the named outcome, effect, and async unit in HCL; use one scenario to select the outcome and another to inject the environmental fault
- C. Return a random valid response and let the client infer what happened
Show answer
Show answer
B. Each unit owns one concern, and their composition expresses a larger public behavior
without exposing private implementation details.