Skip to content

Currency System's Test Plan

Thanh Nhat Quang Mai edited this page Sep 18, 2025 · 9 revisions

In order to ensure the currency system and the game run safely, we will validate the following:

Unit testing

Testing Metrics

Component Code Coverage (Sonarcloud)
CurrencyComponent 100%
CurrencyFactoryComponent 87.5%
CurrencyManagerComponent 100%
CollectibleComponent 90.6%
GameStateService 100%

CurrencyComponentTest

  • Verify that the getters getType and getValue for currency value and type return the correct results.

CurrencyManagerComponentTest

  • Ensure currency types and their quantities are tracked and updated correctly.
  • Ensure methods addCurrencyAmount and subtractCurrencyAmount increment and decrement correctly.
  • Verify that method addCurrencyEntity adds currency entities to currencyList correctly and does not add the same entity twice.
  • Ensure method getCurrencyList returns correct list.
  • Ensure method collectCurrency successfully increments counter and triggers to update UI.
  • Ensure method canAffordAndSpendCurrency correctly deducts currencies by the given cost map and returns true if the player can afford, otherwise does not deduct anything and returns false.
  • Ensure method dropCurrency updates the player’s balance and triggers UI changes when enemies drop currencies.
  • Ensure method refundCurrency refunds the correct portion of the original cost based on the refund rate.

CollectibleComponentTest

  • Verify that currencies can only be collected when the user clicks within the defined radius, and not otherwise.
  • Tested via unit tests and visual validation during gameplay.

CurrencyFactoryTest

  • Ensure methods createCurrency works with expected values and positions.

GameStateSystemTest

  • Verify that the getStars, setStars, and updateStars methods all work as intended.

Behavioral testing

Counter updates

  • Ensure the currency counter increments correctly as currencies are collected.
  • Tested via visual validation during gameplay.

UI updates

  • Confirm that the UI reflects the updated counter in real time as currencies are collected.
    • Includes in-game currencies on the main game screen, as well as the meta currency (stars) on the main menu screen.
  • Tested via visual validation during gameplay.

Testing Videos

Currency counter increments when collecting metal scraps working as expected.

2025-09-02 15-56-56

Deduct currency when building towers

2025-09-17 21-11-57(1)

Stars counter working and reset when we press new game

2025-09-17 21-21-21

Clone this wiki locally