Background
cougr-core 1.1.0 provides test::GameHarness, Scenario, and ReplayLog behind the testutils feature. spawn_and_move includes sandbox_tests.rs demonstrating this pattern. Other reference examples rely on ad-hoc test helpers, which limits their utility as testing references for external developers.
Objective
Introduce GameHarness-based scenario tests in high-traffic reference examples to establish a consistent, replayable testing pattern.
In scope — Phase 1
Examples: spawn_and_move, tic_tac_toe, snake, battleship
Per example:
- Add a test module (
sandbox_tests.rs or test.rs) using GameHarness and Scenario.
- Implement at least one multi-step scenario test (minimum three actions with intermediate assertions).
- Document the testing approach in
README.md.
- Declare
cougr-core = { version = "1.1.0", features = ["testutils"] } under dev-dependencies.
Out of scope
- Adoption across all 39 examples (future phases).
- Changes to production contract code beyond what tests require.
Definition of done
cargo test passes with harness-based scenario tests in all four examples.
- Each
README.md documents GameHarness as the recommended testing approach.
- Redundant custom test fixtures superseded by
GameHarness are removed.
Background
cougr-core1.1.0 providestest::GameHarness,Scenario, andReplayLogbehind thetestutilsfeature.spawn_and_moveincludessandbox_tests.rsdemonstrating this pattern. Other reference examples rely on ad-hoc test helpers, which limits their utility as testing references for external developers.Objective
Introduce
GameHarness-based scenario tests in high-traffic reference examples to establish a consistent, replayable testing pattern.In scope — Phase 1
Examples:
spawn_and_move,tic_tac_toe,snake,battleshipPer example:
sandbox_tests.rsortest.rs) usingGameHarnessandScenario.README.md.cougr-core = { version = "1.1.0", features = ["testutils"] }underdev-dependencies.Out of scope
Definition of done
cargo testpasses with harness-based scenario tests in all four examples.README.mddocumentsGameHarnessas the recommended testing approach.GameHarnessare removed.