wokwi-test-harness

Generates ESPHome YAML and Rust qa_test harness for Wokwi custom chip simulation testing.

Updated Mar 15, 2026
One-click install
npx skills add https://github.com/mohankumargupta/skills --skill wokwi-test-harness-mohankumargupta
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: wokwi-test-harness
Source: https://github.com/mohankumargupta/skills/tree/main/wokwi-test-harness
Command: npx skills add https://github.com/mohankumargupta/skills --skill wokwi-test-harness-mohankumargupta

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve? Verifying a Wokwi custom chip against ESPHome firmware requires manually writing both an ESPHome YAML configuration and a host-side Rust test that asserts on serial output, which is error-prone and hard to keep consistent. This Skill builds both halves of the test harness deterministically from a single Canonical Test Specification. ## Core Features & Use Cases - ESPHome YAML generation: Copies a fixed template, applies canonical ESP32-C3 pin assignments, and adds an on_boot/on_value automation that prints observable values in printf-correct format strings. - Rust qa_test project generation: Scaffolds a Rust library with an assert_serial macro that connects to the Wokwi rfc2217 TCP serial stream and asserts expected output lines with timeouts. - Race-condition and format-string safeguards: Enforces on_value triggers instead of fixed delays for sensor reads and translates language-neutral templates like {:.1f} into printf specifiers like %.1f. - Use Case: Given a Canonical Test Specification for an SHT31 sensor chip, generate dut.yaml plus a qa_test crate that boots the firmware in the Wokwi VSCode simulator and asserts the exact temperature and humidity log lines stream over TCP port 4000. ## Quick Start Create the Wokwi test harness for my device using the Canonical Test Specification in the outputs directory.

Frequently Asked Questions about wokwi-test-harness

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test ESPHome firmware in the Wokwi simulator?▼

Generate an ESPHome YAML with an on_boot automation that logs observable values, then run a Rust test using the assert_serial macro. Wokwi exposes serial output over an rfc2217 TCP server on port 4000, which the test connects to and asserts expected lines.

How does the assert_serial macro work in Rust tests?▼

assert_serial lazily connects to 127.0.0.1:4000, reads lines from the TCP stream, and passes when a line contains the expected substring. It panics with a timeout after 60 seconds by default, or a custom Duration you pass as the second argument.

Why does my ESPHome on_boot lambda print nan for sensor values?▼

component.update is asynchronous, so a lambda immediately after it can run before the driver publishes a value. Move the log line into the sensor's on_value trigger and only use on_boot to force the first update.

Why does ESP_LOGI print the literal text {:.1f} instead of the value?▼

ESP_LOGx macros use printf-style format specifiers, so {:.1f} is not valid and gets printed literally. Translate templates to printf form, for example %.1f, and escape literal percent signs as %%.

Which GPIO pins should I use for I2C on the ESP32-C3 in Wokwi?▼

Use GPIO4 for SDA and GPIO5 for SCL as the primary I2C bus. UART0's RX/TX pins are reserved for the logger, and GPIO2, 8, and 9 are strapping pins to avoid unless required.

Should I assert against ESPHome framework log lines in tests?▼

Prefer asserting only against text your own on_boot or on_value lambda prints, since framework log wording varies across ESPHome versions and build backends. If unavoidable, use a short stable substring like an I2C address rather than a full log line.