Skip to content

Test Plan for QuickTimeEvent

Alexander Johnson edited this page Sep 12, 2024 · 1 revision

Objective

To validate the functionality and correctness of the QuickTimeEventDisplay and QuickTimeEventActions classes, ensuring that it correctly handles events, and updates gui components used for testing the QuickTimeEvent.

Test Coverage

  1. Exit button returns to main menu

    • Test Case: exitButtonShouldReturnToMenu()
    • Purpose: Verify that the exit button returns user to main menu.

    Steps:

    1. Trigger an "exit" event
    2. Verify that the screen is changed to ScreenType.MAIN_MENU

    Verification:

    • Use Mockito to check that the mock game calls its setScreen() method with parameter ScreenType.MAIN_MENU

  1. Start button begins count down

    • Test Case: startButtonShouldDecCounter
    • Purpose: Verify that the start button will begin a count down process and that the gui display is updated with the correct time each second.

    Steps:

    1. Trigger a "start" event
    2. Verify that counter display is no longer blank
    3. Add 1 sec to game time
    4. Verify that counter display is decremented by 1

    Verification:

    • Check that the text in the counter Label is no longer the empty string ""
    • Ensure that when 1 second passes, the counter text is updated with a number equal to one less it's previous value

  1. Count down transitions to quick-time event

    • Test Case: shouldStartQuickTimeEvent
    • Purpose: Verify that once the counter reaches zero, the quick-time events begin

    Steps:

    1. Trigger a "start" event
    2. Continue adding 1 sec to game time until an event other than "editLabel" is triggered
    3. Verify that a "startQuickTime" event is triggered

    Verification:

    • Use getLastTriggeredEvent() to determine what event was last triggered on ui component
    • Ensure that we keep updating the ui until a new event is spotted

  1. Display handles fast input on quick-time event

    • Test Case: shouldHandleFastQuickTimeEvent
    • Purpose: Verify that QuickTimeEventDisplay correctly handles fast button press that are too fast

    Steps:

    1. Create an example quick-time event with duration 1 sec and delay 0.1 secs
    2. Trigger a "startQuickTime" event
    3. Increase the game and action times to 0.5 secs
    4. Initiate a key down event with Keys.W
    5. Verify that "target_fast" image is displayed

    Verification:

    • Use Mockito to check that the spy display calls its setTargetImage() method with parameter "target_fast"

  1. Display handles correct input on quick-time event

    • Test Case: shouldHandlePerfectQuickTimeEvent
    • Purpose: Verify that QuickTimeEventDisplay correctly handles button presses that are within the right time window

    Steps:

    1. Create an example quick-time event with duration 1 sec and delay 0.1 secs
    2. Trigger a "startQuickTime" event
    3. Increase the game and action times to 0.995 secs
    4. Initiate a key down event with Keys.W
    5. Verify that "target_perfect" image is displayed

    Verification:

    • Use Mockito to check that the spy display calls its setTargetImage() method with parameter "target_perfect"
Clone this wiki locally