DocsHIL Testing
HIL Testing
Hardware-in-the-loop (HIL) testing automates the cycle of build → flash → stimulus → observe → evaluate against real hardware.
Test Definition
HIL tests are defined as JSON files in .inverse/hil-tests/:
{
"name": "uart_loopback",
"description": "Verify UART TX/RX loopback at 115200 baud",
"steps": [
{ "action": "build" },
{ "action": "flash" },
{ "action": "wait", "duration": "500ms" },
{ "action": "serial_send", "port": "/dev/ttyUSB0", "data": "HELLO\\r\\n" },
{ "action": "serial_expect", "port": "/dev/ttyUSB0", "pattern": "HELLO", "timeout": "2s" }
],
"pass_criteria": "all_steps_pass"
}Step Actions
| Action | Description |
|---|---|
build | Compile the project |
flash | Flash binary to target |
wait | Wait for a duration |
serial_send | Send data on serial port |
serial_expect | Wait for pattern on serial |
gpio_set | Set GPIO pin state (via debug probe) |
gpio_read | Read GPIO pin state |
measure_power | Measure power consumption |
capture_logic | Capture logic analyzer data |
read_register | Read a peripheral register |
evaluate | Custom evaluation expression |
Creating Tests
> fw_hil_define name=uart_loopbackInteractive test definition — the agent helps build the step sequence.
Running Tests
Single Test
> fw_hil_run uart_loopbackExecutes the test and reports pass/fail with detailed step results.
Full Suite
> fw_hil_run_suiteRuns all tests in .inverse/hil-tests/ sequentially.
Results
Results are stored in .inverse/hil-results/<timestamp>_<name>.json:
{
"test": "uart_loopback",
"timestamp": 1742300000000,
"duration_ms": 3450,
"result": "pass",
"steps": [
{ "action": "build", "result": "pass", "duration_ms": 2100 },
{ "action": "flash", "result": "pass", "duration_ms": 800 },
{ "action": "serial_expect", "result": "pass", "matched": "HELLO" }
]
}Agent Tools
| Tool | Description |
|---|---|
fw_hil_define | Define a new HIL test |
fw_hil_list | List defined tests |
fw_hil_run | Run a single test |
fw_hil_run_suite | Run all tests |
Was this page helpful?
Last edited