Skip to content

feat(examples): adopt GameHarness for scenario-based testing in reference examples #222

Description

@salazarsebas

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:

  1. Add a test module (sandbox_tests.rs or test.rs) using GameHarness and Scenario.
  2. Implement at least one multi-step scenario test (minimum three actions with intermediate assertions).
  3. Document the testing approach in README.md.
  4. 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.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or requestexampleNew game example contracttesting

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions