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

List a case for each rule: setup at each seat count, the offers in each phase, each refusal, the scores, the end, and what each seat may see. For each case, write down the state or result the test checks.

2. Write tests beside the game logic

Write each case as a #[test] in a #[cfg(test)] module, as in Unit tests. Drive the match with Match::new and apply, as a player would. Start a test at a built position with Match::load (Driving a match in a test).

  • Pass a fixed Seed to new and to each apply, so a case that draws randomness gives the same result on every run.
  • Check what a seat may see with view.
  • Test each bot with play_bots (Testing a bot).

3. Run validation

Run validate_code until it reports no errors. Check that tests.passed counts every test you wrote, and that tests.failed is 0.

4. Check the client too

Play the game and render each seat's view with Test a game with MCP. Follow Client checks for interactions, animations and layout.

Need a hand with this?

Join our Discord