bevy-testing-patterns
Installation
SKILL.md
Bevy testing patterns
When to use
Load this when a Bevy crate needs unit or integration tests. cargo test runs #[test] functions. A headless App with MinimalPlugins is the harness for schedule logic.
ECS shape
- Command:
cargo testcompiles and runs unit tests, integration tests, and documentation tests.cargo test name_filterruns names that contain the filter. Arguments after--go to libtest (cargo test -- --help). - What runs: functions annotated with
#[test]. The harness runs them in multiple threads. The working directory for each test is the package root, so relative paths resolve from that root no matter where you invoked Cargo. - Scope: default
cargo testcovers the lib, bins as unit tests, integration tests, and doc tests, and it builds examples.--liblimits to the library.harness = falseon a target means you supplymain. - Profile: the
testprofile is the default.--profile=debugkeeps debug info.-- --no-captureshows test output. - Bevy types inside a test: build an
App, insert the resource, add the system, callupdate, then readworld(). Keep the window out of the harness withMinimalPlugins.