TestPlan for LoadGameDisplay - UQcsse3200/2024-studio-3 GitHub Wiki

Test Plan for LoadGameDisplay

Objective

The goal of this test plan is to verify the correct functionality of the LoadGameDisplay component. This includes ensuring that save files are correctly loaded, displayed, and selected, and that the back button navigates away from the menu correctly. The following components will be tested

  • Components to be Tested
  • LoadGameDisplay class
  • create() method
  • addActors() method
  • Back button functionality
  • Save file selection functionality

Test Cases

1. Verify UI Elements Creation

Objective: Ensure that the LoadGameDisplay UI elements (title, save slots, back button) are correctly created and added to the stage.

Steps:

  1. Instantiate the LoadGameDisplay component.
  2. Call create() method to initialize the component.
  3. Check that rootTable and savesTable are created and added to the stage.
  4. Verify the "Load Game" title is present.
  5. Verify that the back button is present.

Expected Result: rootTable is populated with the "Load Game" label, the save game slots, and the back button. The rootTable is added to the stage.

2. Load Game Saves Display

Objective: Ensure that the component correctly displays available save files.

Steps:

  1. Place several example save files in the local saves directory.
  2. Instantiate the LoadGameDisplay component.
  3. Call create() method.
  4. Check if the saves are displayed in the savesTable in a neat organized way.

Expected Result:The number of save slots in the UI matches the number of save files. Each save slot displays the correct file name without the .json extension.

3. Handle Save Selection

Objective: Ensure that clicking a save slot triggers the correct event with the save file name.

Steps:

  1. Mock the event system to listen for the "start" event.
  2. Instantiate the LoadGameDisplay component and call create().
  3. Simulate a click on a save slot.
  4. Verify that the correct save file name (e.g., save1.json) is passed to the "start" event.

Expected Result: The "start" event is triggered with the correct save file name.

4. Handle Back Button Click

Objective: Ensure that the back button triggers the correct event to exit the menu.

Steps:

  1. Mock the event system to listen for the "exit" event.
  2. Instantiate the LoadGameDisplay component and call create().
  3. Simulate a click on the back button.
  4. Verify that the "exit" event is triggered.

Expected Result: The "exit" event is triggered when the back button is clicked.

5. Test with No Saves Present

Objective: Verify the behavior when no save files are present.

Steps:

  1. Ensure the saves directory is empty or does not exist.
  2. Instantiate the LoadGameDisplay component.
  3. Call create().

Expected Result: The savesTable is empty or shows a placeholder message (if implemented) indicating no saves are available.