| permalink | /09-testing.html |
|---|---|
| title | Testing |
@test is required for Hypervisor profile conformance.
@test "basic"
vars:
username: "TestUser"
input:
query: "hello"
mock:
WeatherAPI.get_current: { temp: 10, condition: "Rain" }
assert:
- canonical.messages[0].role == "system"
- canonical contains "hello"
- telemetry.gas_used < 5000
- each test runs in isolation
varsoverrides variables in test environment (still type-checked)inputsupplies runtime values for@inputmockintercepts interface calls by fully-qualified name- assertions run against:
canonicaltelemetryexecution(recommended, if artifact exposed)
@vars
query: @input(type="string")
@system
content: "You are helpful."
@user
content: $query
@test "query-roundtrip"
input:
query: "hello"
assert:
- canonical.messages[1].role == "user"
- canonical contains "hello"
Run:
facet-fct test --input test_example.facetIn pure mode tests:
- Level-1 cache miss →
F803 - disallowed I/O →
F801 - policy/guard deny/undecidable →
F454/F455
- keep tests deterministic (fixed inputs/mocks)
- assert on canonical structure and key values
- add policy tests for allow/deny behavior
- use
facet-fct inspectwhen debugging failing assertions