Test Plan For CompanionInventoryComponent - UQcsse3200/2023-studio-2 GitHub Wiki
Overview
The CompanionInventoryComponent
class is responsible for managing the inventory of a companion in the game. This test plan will cover various aspects of the component, including initialization, inventory management, attack cooldown, and equipped slots.
Test Objectives
1.Initialisation Testing:
Check getItem()
, getAmmo()
, and getMaxAmmo()
return expected values.
Set attack cooldown, validate with getAttackCooldown()
.
2.Ammo Management Testing:
Increase and decrease ammo with changeAmmo()
.
Ensure ammo remains within the valid range.
3.Attack Cooldown Testing:
Decrease cooldown with decCoolDown()
.
Ensure it does not go below zero.
4.Slot and Equipped Testing:
Set and validate equipped slot with setEquipped()
and getEquipped()
.
5.Update and Ammo Testing:
Verify update()
decreases equipped weapon's cooldown.
Ensure getEquippedType()
and getCurrentAmmo()
update correctly after calling update()
.
Test Cases
Initialisation Test Case:
Set the attack cooldown to 3 using setAttackCooldown(3)
and validate it with getAttackCooldown()
.
Ammo Management Test Case:
Attempt to set ammo to exceed the max ammo
, and ensure it remains within the valid range.
Confirm that attempting to exceed max ammo is prevented.
Attack Cooldown Test Case:
Set the attack cooldown to 3 with setAttackCooldown(3)
and verify it using getAttackCooldown()
.
Slot and Equipped Test Case:
Set the equipped slot to "melee" using setEquipped("melee")
and confirm it with getEquipped()
.
Attempt to set an invalid slot and ensure that the original equipped slot remains unchanged.
Update and Ammo Test Case:
Call update()
and verify that it decreases the equipped weapon's cooldown.
Call getEquippedType()
to check if the equipped weapon type updates correctly after calling update()
.
Call getCurrentAmmo()
to ensure it updates correctly after calling update()
.