bevy-testing-patterns
Installation
SKILL.md
Bevy testing patterns
When to use
Load this when a Bevy crate needs unit or integration tests. The Cargo book page for cargo test is the source. Check the Bevy docs for App::update inside #[test] before writing that harness.
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: not specified here. Do not copy an
App::new()test from an old discussion. Bevy's own crates contain#[cfg(test)]modules. Check those helpers before treating them as a public guide.