Skip to content

DancePartyUpgrade

willembor edited this page Oct 16, 2024 · 1 revision

Test Environment

  • Framework: JUNIT 5
  • Dependencies:
  • Mockito: For mocking dependencies
  • ParameterizedTest: For testing different inputs

Test Cases

1. testDancePartyActivates

  • Purpose: Ensure the Dance Party upgrade activates correctly, and the meter UI becomes visible.
  • Setup:
    • Set player gold to a sufficient amount (100).
    • Call activate() on the dancePartyUpgrade instance.
    • rigger the event "Dancing".
  • Expected Outcome:
    • The upgrade should activate, the layout should become visible, and the meter should display a full bar (value = 1.0).
    • The event "Dancing" should be triggered.
    • activeTimeRemaining should be set to UPGRADE_DURATION.

2. testDancePartyDeactivates

  • Purpose: Ensure the Dance Party upgrade deactivates correctly and the layout UI is hidden.
  • Setup:
    • Call activate() and then deactivate() on the dancePartyUpgrade.
    • Trigger the event "UnDancing".
  • Expected:
    • The upgrade should deactivate, and the meter and text should be removed from the stage.
    • The layout should be hidden, and the event "UnDancing" should be triggered.
    • The meter value should reset to 0.

3. testLoseGoldOnPurchase

  • Purpose: Ensure the correct amount of gold is deducted when the Dance Party upgrade is purchased.
  • Setup:
    • Set player gold to 100.
    • Call activate() on dancePartyUpgrade.
  • Expected: The player's gold should decrease by 20 upon activation.

4. testInsufficientGold

  • Purpose: Ensure the Dance Party upgrade does not activate if there is insufficient gold.
  • Setup:
    • Set player gold to an insufficient amount (e.g., 10).
    • Call activate() and verify that the event notenoughmoney is triggered.
  • Expected: The upgrade should not activate, the layout should remain hidden, and the event "notenoughmoney" should be triggered.

5. testDancePartyFor30Seconds

  • Purpose: Ensure the Dance Party upgrade lasts for 30 seconds and deactivates afterward.
  • Setup: Activate the upgrade and simulate 30 seconds by calling update() repeatedly.
  • Expected:
    • The meter value should gradually deplete as time passes.
    • After 30 seconds, the upgrade should deactivate, and the boost sound should stop playing.

6. testMeterValueAtDifferentLevelsOfDepletion

  • Purpose: Ensure that the meter value updates correctly as the upgrade time depletes.
  • Setup:
    • Use parameterized values for the total depleted time (5, 10, 15, 20, 25, 30 seconds).
    • Activate the upgrade and simulate time by calling update() based on the given value.
  • Expected: The meter value should reflect the remaining upgrade time relative to the total duration.

7. testDispose

  • Purpose: Ensure that all resources related to the Dance Party upgrade are unloaded correctly when dispose() is called.
  • Setup:
    • Call dispose() on the dancePartyUpgrade instance.
    • Verify that the resourceService.unloadAssets() method is called for the textures.
  • Expected: The textures related to the Dance Party upgrade should be unloaded from memory.

Table of Contents

Home

Team Design Document

Game Features

Inventory System
Scoring System
Food Recipes
Level System
Player Actions
Ordering System
Stations
Items
Map Design
Customers
Pause Menu
Upgrades
End of Day Display
Day Night Cycle
Moral System
Debug Terminal
Game Interactions Tutorial
Backstory Cutscenes

Game

Getting Started

Entities and Components

World Backstory

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Map Design

Test Plans

Sensor Component

Customer Sensor Component

Interaction Component

Inventory Component

Inventory Display

Station Meal Component

Station Progress Display

Keyboard Input Component

Fire Extinguisher Handler Component

Score System

HoverBox Component

MainGameActions Create Docket Triggers

End Day Display Component

Cutscene Area

Docket

Docket Line Display

Docket Meal Display

Main Game Order Button Display

Order Actions

Recipe

Ticket Details Component

BackstoryCutscene Test Plan

BackstoryCutsceneDisplay Test Plan

Test Plan for Tutorial

Keybinds

Keybinds Test Plan

Test Plan for MainGameOrderTicketDisplay

Test Plan for MainGameOrderBtnDisplay

Test Plan for Docket

Test Plan for DocketLineDisplay

Test Plan for OrderActions

Ticket Details

Test plan for RandomComboService

Test plan for LoanUpgrade

Test plan for UpgradesDisplay

Test plan for RageUpgrade

Test plan for SpeedBoostUpgrade

Test plan for DancePartyUpgrade

Test plan for ExtortionUpgrade

Troubleshooting

MacOS Setup Guide

Clone this wiki locally