Testing Plan for Item Usage Functionality - UQcsse3200/2024-studio-1 GitHub Wiki

Overview

This manual testing plan details the process for verifying the functionality of item usage in the KeyboardPlayerInputComponent, PlayerActions, KeyMapping and InventoryComponent classes within a game. The tests will ensure that key bindings for item usage work correctly and that items are used and removed from the inventory as expected. This plan will include steps for both functional and edge-case testing.

Testing Environment

  • GUI

Testing Goals

  1. Verify Key Bindings: Ensure that the correct key bindings trigger the usage of items.
  2. Verify Inventory Management: Confirm that items are used and removed from the inventory correctly.
  3. Verify UI Updates: Ensure that the UI reflects the correct state of the inventory and player actions.
  4. Test Edge Cases: Handle scenarios where items are not available, inventory is null, or invalid inputs are provided.

Set Up

Before the start of every test, this is UI is initialised and displayed: image

Test Scenarios

  1. Functional Tests

    • Scenario 1: Basic Item Usage

      • Objective: Verify that pressing the correct key triggers the usage of Medkit.
      • Steps:
        1. Start the game and navigate to the main screen.
        2. Open the inventory UI.
        3. Collect MedKit and Ensure the inventory contains a MedKit by checking the count of MedKit displayed in the UI.
        4. Press 1 as it is the first item collected.
        5. Observe the UI to confirm the MedKit is removed from the inventory.
        6. Verify that any effects of using the MedKit (e.g., health restoration) are applied to the player.
      • Expected Result: The MedKit is removed from the inventory, and the player's health is updated.
    • Evidence: Successful upon testing Before Key Press: image

After Key Press:

image


  • Scenario 2: Basic Item Usage
    • Objective: Verify that pressing the correct key triggers the usage of Shield Potion.
    • Steps:
      1. Start the game and navigate to the main screen.
      2. Open the inventory UI.
      3. Collect Shield potion and Ensure the inventory contains a Shield Potion by checking the count of Shield Potion displayed in the UI.
      4. Press 2 as it is the second item collected.
      5. Observe the UI to confirm the Shield Potion is removed from the inventory.
      6. Verify that any effects of using this item are applied to the player.
    • Expected Result: The Shield Potion is removed from the inventory, and the player's health is updated.

Successful upon testing Evidence: When shield is picked up:

image

When 2 is pressed, the shield is applied to the player: image

after the shield is depicted, it is removed from player: image


  • Scenario 3: Basic Item Usage
    • Objective: Verify that pressing the correct key triggers the usage of Bandage.

    • Steps:

      1. Start the game and navigate to the main screen.
      2. Open the inventory UI.
      3. Collect Bandage and Ensure the inventory contains a Bandage by checking the count of MedKitbandagedisplayed in the UI.
      4. Press 3 as it is the third item collected.
      5. Observe the UI to confirm the bandage is removed from the inventory.
      6. Verify that any effects of using the bandage ( are applied to the player.
    • Expected Result: The Bandage is removed from the inventory, and the player's health is updated. Successful upon testing Evidence: (note: this test was added later after merging with other other teams, so the UI is different in this class) SetUp: when the game begins:

When a bandage is picked up: As expected, the bandage count is incremented, implying that it has been added but not used image

When a bandage is used: After pressing 3 on keyboard the player's health is increased, demonstrating expected functionality of keybinding and apply method of bandage image


  • Scenario 4: Multiple Items
    • Objective: Ensure that using one item does not affect other items in the inventory.
    • Steps:
      1. Start the game and navigate to the main screen.
      2. Open the inventory UI.
      3. Pick up a MedKit and Shield Potion and ensure the inventory contains a MedKit by checking the count of MedKit displayed in the UI.
      4. Press 1
      5. Verify the MedKit is removed from the inventory but the Shield remains.
      6. Ensure the Shield is still usable if its key is pressed.
    • Expected Result: The MedKit is removed from the inventory, and the Bandage remains. Successful when tested Evidence: A Medkit and a Shield Potion is picked up image

Medkit is used by pressing 1, causing player's health to increase to 100, but shield potion is still in player's inventory image

Press 2 to verify that shield potion is still usable. image

  • Scenario 5: Non-Existent Item Usage
    • Objective: Verify that trying to use an item not present in the inventory has no effect.
    • Steps:
      1. Start the game and navigate to the main screen.
      2. Ensure the inventory does not contain any inventory
      3. Press 1 (key press for MedKit)
      4. Observe the UI and player actions to confirm no changes occur.
    • Expected Result: No changes in the inventory or player state. Successful upon testing Evidence: After pressing 1, 2, 3, no effects on player's state were observed as the inventory. image

  1. Edge Case Tests

    • Scenario 6: Invalid Key Binding
      • Objective: Ensure the system handles invalid key presses properly.
      • Steps:
        1. Start the game and navigate to the main screen.
        2. Press a key not bound to any action .
        3. Observe the UI and player actions.
      • Expected Result: The system ignores the invalid key press without any impact on the inventory or player actions. Successful Upon Testing Evidence: After pressing numeric keys 4 - 7 and many different alphabetic keys: No increase or change in health was observed other than the effects of animal attack as expected: image

This plan provides a comprehensive approach to manually testing the item usage functionality, covering both normal and edge cases to ensure robustness and reliability. Adjustments may be necessary based on your specific game's implementation and requirements.