Skip to content

Testing and Debugging

mike-snhu edited this page Aug 16, 2026 · 1 revision

Testing and Debugging

Testing is easier when you know exactly what behavior you are checking.

Test One Requirement at a Time

Instead of only playing the game randomly, create small tests for specific behavior.

Examples:

  • One valid movement command
  • One invalid movement command
  • One valid item command
  • One invalid item command
  • One inventory update
  • One winning playthrough
  • One losing playthrough

This makes it easier to identify which part failed.

Use Your Map as a Test Tool

Your Project One map is more than a design picture. It gives you known expected room transitions.

For a movement test:

  1. Identify the starting room.
  2. Pick one direction shown on your map.
  3. Predict the destination room.
  4. Run the command.
  5. Compare the actual room with the expected room.

If they differ, compare the map, dictionary, and movement branch.

Test Invalid Input

Input validation is part of both the milestone and Project Two.

Try commands that should not work, such as a direction not connected to the current room or an item that is not in the current room.

A good invalid-input test checks two things:

  • The player receives an appropriate response.
  • The game state does not change as though the invalid command had succeeded.

Test Complete Endings

For Project Two, create two planned routes:

  • A route that collects all required items before reaching the villain
  • A route that reaches the villain too early

Both outcomes need to work.

Debugging Cycle

Use a small cycle:

Reproduce → Locate → Change one thing → Test again

When a test fails:

  1. Repeat the same failure.
  2. Read the current values or output carefully.
  3. Find the earliest place where behavior differs from what you expected.
  4. Make one focused change.
  5. Rerun the same test before trying something else.

Large groups of changes make it harder to know which change fixed or caused a problem.

Keep Notes When Useful

The repository includes tests/game_test_plan.md for optional manual test notes. Recording a few planned tests can save time when you return to the project later.

Clone this wiki locally