-
Notifications
You must be signed in to change notification settings - Fork 1
Test Plan for Scoring System
manya-k edited this page Sep 23, 2024
·
2 revisions
The purpose of this test plans to valid the functionality of scoring system, which adds a certain number of coins based on NPC's Strength
- FrameWork: JUnit5
-
Objects Used:
Entity
class representing the player,InventoryComponent
andCoinsComponent
representing the player's inventory and player's score. Moreover,Event Handler
to represent the events of players.
The setUp()
method initializes key components before each test case, ensuring a consistent and clean test environment.
-
Player Entity (
player
): A newEntity
instance is created, representing the player. -
InventoryComponent (
inventoryComponent
): Manages the player's inventory, crucial for testing item and weapon saving. -
CombatStatsComponent (
statsComponent
): Stores the player's coins gained from defeating the animals.
- Objective: Verify that a new game starts with zero coins.
-
Setup:
- Initialize
CoinsComponent
.
- Initialize
-
Execution: Call
getCoins()
to check the initial coin count. - Expected Outcome: The initial coin count should be 0.
- Objective: Verify that spending coins reduces the amount of coins the player owns.
-
Setup:
- Set the player's coins to 10 using
setCoins(10)
.
- Set the player's coins to 10 using
-
Execution:
- Call
spend(4)
to reduce the coins by 4. - Call
getCoins()
to get the current coin count.
- Call
- Expected Outcome: Coin count should be 6 after spending 4 coins.
- Objective: Verify that spending all the money reduces the coin count to 0.
-
Setup:
- Set the player's coins to a large amount, such as 1,000,000,000, using
setCoins(1000000000)
.
- Set the player's coins to a large amount, such as 1,000,000,000, using
-
Execution:
- Call
spend(1000000000)
to spend all the coins. - Call
getCoins()
to get the current coin count.
- Call
- Expected Outcome: Coin count should be 0 after spending all coins.
-
Objective: Verify that calling
addCoins()
adds coins to the player's coin count. -
Setup:
- Initialize
CoinsComponent
without adding any coins.
- Initialize
-
Execution:
- Call
addCoins(5)
to add 5 coins. - Call
getCoins()
to get the current coin count.
- Call
- Expected Outcome: Coin count should be 5 after adding 5 coins.
- Objective: Verify that negative coins cannot be added to the player's coin count.
-
Setup:
- Initialize
CoinsComponent
without adding any coins.
- Initialize
-
Execution:
- Call
addCoins(-2)
to attempt adding negative coins. - Call
getCoins()
to get the current coin count.
- Call
- Expected Outcome: Coin count should be 0 since negative amounts cannot be added.
-
Objective: Verify that calling
setCoins()
changes the stored amount of coins. -
Setup:
- Initialize
CoinsComponent
without adding any coins.
- Initialize
-
Execution:
- Call
setCoins(10)
to set the coin count to 10. - Call
getCoins()
to get the current coin count.
- Call
- Expected Outcome: Coin count should be 10 after setting it to 10.
- Objective: Verify that coins cannot be set to a negative number.
-
Setup:
- Initialize
CoinsComponent
without adding any coins.
- Initialize
-
Execution:
- Call
setCoins(-5)
to attempt setting a negative coin count. - Call
getCoins()
to get the current coin count.
- Call
- Expected Outcome: Coin count should be 0 as negative values are not allowed.
- Objective: Verify that setting the amount to zero reduces the amount of coins to zero.
-
Setup:
- Initialize
CoinsComponent
and set some coins (if necessary).
- Initialize
-
Execution:
- Call
setCoins(0)
to set the coin count to 0. - Call
getCoins()
to get the current coin count.
- Call
- Expected Outcome: Coin count should be 0 after setting it to 0.
-
Objective: Verify that
hasCoins()
correctly checks if the player has the specified amount of coins. -
Setup:
- Set the player's coins to 10 using
setCoins(10)
.
- Set the player's coins to 10 using
-
Execution:
- Call
hasCoins(5)
to check if the player has at least 5 coins. - Call
hasCoins(20)
to check if the player has at least 20 coins.
- Call
-
Expected Outcome:
-
hasCoins(5)
should returntrue
as the player has 10 coins. -
hasCoins(20)
should returnfalse
as the player has only 10 coins.
-
- Objective: Verify that the player is not able to spend more money than they have.
-
Setup:
- Set the player's coins to 5 using
setCoins(5)
.
- Set the player's coins to 5 using
-
Execution:
- Call
spend(10)
to attempt spending more than available. - Call
getCoins()
to get the current coin count.
- Call
- Expected Outcome: Coin count should remain 5 as the player cannot spend more than they have.
- Task: Start a new game and check the initial coin count displayed on the screen.
- Expected Outcome: The initial coin count should be displayed as 0.
- Task: Pick up different coin items (3, 6, 9, 10 coins) scattered in the game world.
- Expected Outcome: The coin count should increase accordingly as each coin item is picked up.
- Task: Try to spend coins by purchasing an in-game item.
- Expected Outcome: The coin count should decrease based on the item's cost.
- Task: Try to purchase an item costing more than the current coin count.
- Expected Outcome: The purchase should be blocked, and a message indicating insufficient funds should be displayed.
- Task: Continuously add and spend coins in different amounts and verify that the coin count displayed is always accurate.
- Expected Outcome: The coin count should always reflect the accurate amount of coins owned by the player.
Design Choices
Utilities
Animals
Menus/screens
Character
- Character Animations
- Character's Inventory On Display
- Character's Inventory System
- Character's HealthBar
- Character's Interaction with Items
- Character achievements
- Saving Character
- Player-(and-other-NPC)-invincibility-frames
- Player Factory
- Scoring System
- Test Plan for Inventory System
- Test Plan for Player's Interaction with Items
- Test Plan for Player's Inventory Display
- Test Plan for Saving Character State
- Test Plan for Scoring System
Map
Weapon
- Weapon Overview
- Weapon Types
- Weapon Structure
- Weapon Stats Display
- Testing Plan for Weapon Factory
- Testing Plan for Firing Controller Component
- Testing Plan for Position Tracker Component
- Testing Plan for Weapon Animation Controller component
- Testing Plan for Concrete Melee Weapon class
- Testing Plan for Concrete Ranged Weapon class