Synopsis
Description
crucihil scaffold generates boilerplate so you can start writing tests immediately. It has three modes:
| Mode | Flag | What it creates |
|---|---|---|
| Test project | --rig | Full test project tailored to your rig’s hardware |
| Example | --example | Self-contained runnable example with DBC, rig TOML, and test |
| Adapter | --adapter | Custom backend stub implementing the relevant ABC |
Options
Path to a rig TOML. Reads the TOML and generates
suites/smoke.yaml, suites/regression.yaml, tests/smoke.py, and tests/regression.py tailored to the detected hardware (CAN buses, ECUs, power rails). Short form: -r.Drop a self-contained runnable example. Available names:
hello_world, can_signals, fault_injection. Short form: -e.Generate a custom backend adapter stub. Available types:
can, power, gpio, doip, someip, udp, uds. Short form: -a.Class name for an adapter stub. Example:
--adapter can --name RelayBoard generates a RelayBoardBackend class. Defaults to Custom<Type>. Short form: -n.Directory to write generated files into. Short form:
-d.Test project from a rig TOML
bench_01.toml and generates:
[rig.ecus.engine_ecu] and [rig.can.powertrain], the scaffold creates test stubs that reference those.
After scaffolding, fill in the pass stubs with real assertions:
pass), giving you a working baseline to build from.
Examples
hello_world
A minimal three-test suite with a virtual rig and sample DBC:can_signals
Demonstratesrig.can.send, rig.can.expect, rig.sim.set, and rig.sim.override:
fault_injection
Demonstrates the fault injection API —rig.fault.can_dropout, rig.fault.power_cycle, rig.fault.gpio_stuck:
Custom backend adapters
If you have a proprietary CAN adapter, power supply, or GPIO board, you can implement it as a Python class and load it viabackend = "myorg.my_module" in the rig TOML. The scaffold generates the correct boilerplate:
CAN adapter stub
relay_board_backend.py:
Power backend stub
GPIO backend stub
Stub generation (crucihil stub)
After adding new test IDs to a YAML manifest, runcrucihil stub to generate the missing Python function stubs:
async def test_* stubs for every test function that is declared in the YAML but missing from the corresponding Python module.
Use --dry-run to preview what would be written:
See also
- Test Authoring — YAML Manifest
- Test Authoring — Python API
- Rig Backends — custom backend module path format