Test Plan: StoryActions and StoryDisplay Class - UQcsse3200/2023-studio-2 GitHub Wiki
Introduction
This wiki page outlines the test plan for the implementation and testing of the StoryDisplayTest and StoryActionsTest classes in the game codebase.
Table of contents
Story Display (StoryDisplayTest)
Implementation Details
The StoryDisplayTest class is responsible for displaying the story scenes in the game. It uses a Table to manage the layout and handles the rendering of story images. The class also includes buttons for navigation, including "Next," "Previous," and "Skip" buttons.
Test Plan
Test Case 1: Testing Story Scene Navigation
Objective: Verify that the StoryDisplayTest class correctly displays story scenes and handles navigation.
Steps:
- Create an instance of StoryDisplayTest.
- Ensure that the initial story scene is displayed correctly.
- Simulate button clicks for "Next," "Previous," and "Skip" buttons.
- Verify that the scenes change appropriately when buttons are clicked.
- Ensure that the "Skip" button triggers the "skip" event.
Test Case 2: Testing Cleanup
Objective: Verify that the StoryDisplayTest class properly cleans up resources.
Steps:
- Create an instance of StoryDisplayTest.
- Display several story scenes.
- Dispose of the StoryDisplayTest instance.
- Verify that resources are cleared, and the stage is empty.
Story Actions (StoryActionsTest)
Implementation Details
The StoryActionsTest class handles actions related to story progression. It contains methods for navigating to the next scene or skipping the story.
Test Plan
Test Case 1: Testing onNext Action
Objective: Verify that the onNext method correctly sets the screen to the MAIN_GAME screen when invoked.
Steps:
- Create an instance of StoryActionsTest with a mock GdxGame.
- Invoke the private onNext method using reflection.
- Verify that the setScreen method of the mock GdxGame is called with GdxGame.ScreenType.MAIN_GAME.
Test Case 2: Testing onSkip Action
Objective: Verify that the onSkip method correctly sets the screen to the MAIN_GAME screen when invoked.
Steps:
- Create an instance of StoryActionsTest with a mock GdxGame.
- Invoke the private onSkip method using reflection.
- Verify that the setScreen method of the mock GdxGame is called with GdxGame.ScreenType.MAIN_GAME.
Conclusion
This test plan outlines the testing approach and test cases for the StoryDisplayTest and StoryActionsTest classes. By following these tests, we aim to ensure that the story display and actions are functioning correctly within the game.
Contributors
- Aniket Gupta @aniketgupta17