Documentation

Test and maintain

v3 · Preview

Framework v3 is an opt-in preview available to everyone. New games use the stable framework by default.

Write game tests

1. Choose the cases

Cover setup, legal actions, refusals, scoring, the ending, and hidden information. Include deterministic cases for random behavior.

Done when the list names the state invariant each test will check.

2. Write tests beside the game logic

Use #[test] inside a #[cfg(test)] module. Follow the compiling example in Unit tests. Drive Match::new and apply for behavior a player can reach.

Done when each case asserts the result of an action or the validity of a position.

3. Run validation

Call validate_code. Read the compiler diagnostics and the returned test counts. Fix failures before committing.

Done when the build succeeds and the intended tests ran and passed.

4. Check the client too

Use Test a game with MCP to inspect rendered views and interaction. Unit tests do not prove that controls fit a phone.

Done when both game logic and the player experience pass their checks.

Need a hand with this?

Join our Discord