Skip to content

Upgrade Tree Testing Plan

connor-golin edited this page Oct 4, 2023 · 7 revisions

Test Plan for UpgradeNode

Objective:

To validate the correct behavior of the UpgradeNode class ensuring:

  • Upgrade nodes are successfully created and store the correct weapon information.
  • Child nodes can be added to an upgrade node.
  • The x and y coordinates, as well as the depth of a node, can be set and retrieved accurately.

Methodology:

Setup (BeforeEach):

  • Mock necessary components and services.
  • Create a sample WeaponConfig and WeaponType for testing purposes.

Test Case 1: testNodeCreation

Objective: To verify the creation of an upgrade node.

Steps:

  1. Use the UpgradeNode constructor to create a new node.
  2. Validate that the node's imagePath and weaponType matches the respective node data.

Test Case 2: testAddChildNode

Objective: To validate the addition of a child node.

Steps:

  1. Create an upgrade node instance.
  2. Add a child node to the created node using addChild.
  3. Validate that the child node has been added successfully.

Test Case 3: testSetAndGetCoordinates

Objective: To verify setting and getting the x and y coordinates of a node.

Steps:

  1. Create an upgrade node instance.
  2. Set the x and y coordinates using setX and setY.
  3. Validate that the set coordinates match the retrieved values.

Test Case 4: testSetAndGetDepth

Objective: To validate setting and getting the depth of a node.

Steps:

  1. Create an upgrade node instance.
  2. Set a depth value using setDepth.
  3. Validate that the set depth matches the retrieved value.

Dependencies:

  • WeaponConfig and WeaponType are required to test tree nodes.

Test Plan for UpgradeTree

Objective:

To validate the correct behavior of the UpgradeTree class ensuring:

  • Weapons can be unlocked and checked if they are unlocked.
  • Materials can be retrieved and subtracted accurately (with respect to extractor resources)

Methodology:

Setup (BeforeEach):

  • Mock necessary components and services.
  • Initialize a new UpgradeTree instance.

Test Case 1: testUnlockWeapon

Objective: To verify the ability to unlock a weapon.

Steps:

  1. Unlock a weapon using unlockWeapon.
  2. Validate that the weapon is added to the list of unlocked weapons (including default weapons).

Test Case 2: testIsWeaponUnlocked

Objective: To verify if a weapon is unlocked or not.

Steps:

  1. Unlock a weapon using unlockWeapon.
  2. Use isWeaponUnlocked to check if the weapon is unlocked.
  3. Validate that it returns true.

Test Case 3: testGetMaterials

Objective: To validate the retrieval of materials.

Steps:

  1. Mock the game's state observer to return a certain amount of materials.
  2. Use getMaterials to retrieve the amount.
  3. Validate that the retrieved amount matches the mock value.

Test Case 4: testSubtractMaterials

Objective: To verify the subtraction of materials.

Steps:

  1. Mock the game's state observer to return a certain amount of materials.
  2. Subtract a certain amount using subtractMaterials.
  3. Validate that the correct amount has been subtracted.

Dependencies:

  • The UpgradeTreeTest class relies on the game's state observer to function correctly.
  • Mockito is required to mock game state resources.

Test Plan for UpgradeDisplay

Objective:

To validate the displaying of the Upgrade Tree window is correct, including:

  • Weapons not apart of the default unlocked weapons are locked.
  • All locked nodes are greyed out, have a lock overlay, and have a purchase button.
  • The tree draws and spaces the nodes appropriately, ensuring they do not overlap.
  • Lines and node backgrounds are drawn in correct order such that lines do not overlay weapon and background sprites.

Methodology:

As the test class heavily depends on visuals, it is difficult to ensure from unit tests alone - therefore various visual tests were conducted.

Visual Testing

Sprint 2:

1: Basic Tests

  1. Are node sprites, lines, and backgrounds drawn?
  2. Are the default weapons unlocked (stick, slingshot ball, woodhammer)?
  3. Are the materials and exit buttons located appropriately?
  4. Does the exit button remove the window from the stage?
  5. Is there enough space between nodes (horizontally and vertically)?
  6. Is there any overlapping? (locks, lines, backgrounds)
  7. Does clicking the upgrade button with enough resources remove the lock, and lighten the image (indicating unlocked) or vice versa?
  8. Does the upgrade button animate down and up on button presses?

Example: Base upgrade tree window

image

2: Node addition and removal testing

  1. Does adding a new node space correctly in the tree?
  2. Does removing a root node resize all trees correctly?
  3. If multiple nodes are added, do they space correctly?

Example: Melee Root node removed, multiple children added to ranged tree

image

Sprint 3:

1: Setup

  1. Ensure all tests from Sprint 2 pass.

2: Node Interaction and Display

  1. Ensure lines are correctly coloured between locked/unlocked nodes.
  2. Ensure correct equipped-item numbers and border is displayed correctly.
  3. Ensure hovering mouse displays the weapon stats tooltip.

image

3: Window and Aspect Ratio

  1. Ensure aspect ratio is maintained for windowed and fullscreen modes so that it is consistent with bug fixes in sprint 2.

4: Game State and Dynamic Updates

  1. Ensure the materials dynamically update in accordance with game state resources (Nebulite).

image image

Clone this wiki locally