-
Notifications
You must be signed in to change notification settings - Fork 0
Testing and Debugging
Testing is easier when you know exactly what behavior you are checking.
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.
Your Project One map is more than a design picture. It gives you known expected room transitions.
For a movement test:
- Identify the starting room.
- Pick one direction shown on your map.
- Predict the destination room.
- Run the command.
- Compare the actual room with the expected room.
If they differ, compare the map, dictionary, and movement branch.
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.
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.
Use a small cycle:
Reproduce → Locate → Change one thing → Test again
When a test fails:
- Repeat the same failure.
- Read the current values or output carefully.
- Find the earliest place where behavior differs from what you expected.
- Make one focused change.
- Rerun the same test before trying something else.
Large groups of changes make it harder to know which change fixed or caused a problem.
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.