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 test compiles and runs unit tests, integration tests, and documentation tests. cargo test name_filter runs 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 test covers the lib, bins as unit tests, integration tests, and doc tests, and it builds examples. --lib limits to the library. harness = false on a target means you supply main.
  • Profile: the test profile is the default. --profile=debug keeps debug info. -- --no-capture shows 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.

Coming from Godot

Installs
4
GitHub Stars
850
First Seen
3 days ago