-
Notifications
You must be signed in to change notification settings - Fork 9
Upgrade Tree Testing Plan
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
andy
coordinates, as well as the depth of a node, can be set and retrieved accurately.
- Mock necessary components and services.
- Create a sample
WeaponConfig
andWeaponType
for testing purposes.
Objective: To verify the creation of an upgrade node.
Steps:
- Use the
UpgradeNode
constructor to create a new node. - Validate that the node's
imagePath
andweaponType
matches the respective node data.
Objective: To validate the addition of a child node.
Steps:
- Create an upgrade node instance.
- Add a child node to the created node using
addChild
. - Validate that the child node has been added successfully.
Objective: To verify setting and getting the x and y coordinates of a node.
Steps:
- Create an upgrade node instance.
- Set the
x
andy
coordinates usingsetX
andsetY
. - Validate that the set coordinates match the retrieved values.
Objective: To validate setting and getting the depth of a node.
Steps:
- Create an upgrade node instance.
- Set a depth value using
setDepth
. - Validate that the set depth matches the retrieved value.
-
WeaponConfig
andWeaponType
are required to test tree nodes.
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)
- Mock necessary components and services.
- Initialize a new
UpgradeTree
instance.
Objective: To verify the ability to unlock a weapon.
Steps:
- Unlock a weapon using
unlockWeapon
. - Validate that the weapon is added to the list of unlocked weapons (including default weapons).
Objective: To verify if a weapon is unlocked or not.
Steps:
- Unlock a weapon using
unlockWeapon
. - Use
isWeaponUnlocked
to check if the weapon is unlocked. - Validate that it returns
true
.
Objective: To validate the retrieval of materials.
Steps:
- Mock the game's state observer to return a certain amount of materials.
- Use
getMaterials
to retrieve the amount. - Validate that the retrieved amount matches the mock value.
Objective: To verify the subtraction of materials.
Steps:
- Mock the game's state observer to return a certain amount of materials.
- Subtract a certain amount using
subtractMaterials
. - Validate that the correct amount has been subtracted.
- The
UpgradeTreeTest
class relies on the game's state observer to function correctly. - Mockito is required to mock game state resources.
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.
As the test class heavily depends on visuals, it is difficult to ensure from unit tests alone - therefore various visual tests were conducted.
- Are node sprites, lines, and backgrounds drawn?
- Are the default weapons unlocked (stick, slingshot ball, woodhammer)?
- Are the materials and exit buttons located appropriately?
- Does the exit button remove the window from the stage?
- Is there enough space between nodes (horizontally and vertically)?
- Is there any overlapping? (locks, lines, backgrounds)
- Does clicking the upgrade button with enough resources remove the lock, and lighten the image (indicating unlocked) or vice versa?
- Does the upgrade button animate down and up on button presses?
Example: Base upgrade tree window
- Does adding a new node space correctly in the tree?
- Does removing a root node resize all trees correctly?
- If multiple nodes are added, do they space correctly?
Example: Melee Root node removed, multiple children added to ranged tree
- Ensure all tests from Sprint 2 pass.
- Ensure lines are correctly coloured between locked/unlocked nodes.
- Ensure correct equipped-item numbers and border is displayed correctly.
- Ensure hovering mouse displays the weapon stats tooltip.
- Ensure aspect ratio is maintained for windowed and fullscreen modes so that it is consistent with bug fixes in sprint 2.
- Ensure the materials dynamically update in accordance with game state resources (Nebulite).
Escape Earth Game
Interaction Controller and Interactable Components
Game and Entity Configuration Files
Loading Game Configuration Files