Keybinds Test Plan - UQcsse3200/2024-studio-3 GitHub Wiki

Test Environment

Framework: JUnit 5

  • Objects Used:
    • KeybindsButtonDisplay (under test)
    • Stage, Spritebatch, Table, Skin, Texture (mocked)
    • ServiceLocator, RenderService, ResourceService (mocked)

Test Cases

1. testBatchIsNotNull():

Purpose: check if Spritebatch initialised through mocking is not null.

Setup: mocks Spritebatch in setup(), then verifies if not null.

Expected Outcome: batch should not be null.

2. testInitialiseComponents():

Purpose: checks mocked initialised components are not null.

Setup: mocks instance of KeybindsButtonDisplay class, its stage, KeybindButton, KeybindMenu, KeybindText, in setup(). Then ensures values are not null.

Expected Outcome: initialised components should not be null.

3. testButtonToggling():

Purpose: checks if button toggles the visibility of keybinds' menu and text display.

Setup: checks if menu and text are not visible, then calls showKeybinds(true) to trigger the visibility of menu and text.

Expected Outcome: menu and text should be visible if showKeybinds is triggered, not visible if not.

4. testDisposeClearsTables():

Purpose: checks if tables dispose.

Setup: calls dispose, which disposes tables of KeybindsButtonDisplay class: Button, Menu and Text.

Expected Outcome: tables should dispose.