Skip to content

RageUpgrade

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. testRageOverlayPopsUP

  • Purpose: To ensure that the rage overlay becomes visible when rage mode is activated.

  • Setup:

    • Call activateRageMode() on the rageUpgrade instance.
    • Verify that the rageModeOn event is triggered, and the layout becomes visible.
  • Expected Outcome: The rage overlay (layout) should be visible, and isRageActive() should return true. Also the event handler should trigger event rageModeOn

2. testRageOverlayCloses

  • Purpose: To ensure that the rage overlay is hidden when rage mode is deactivated.

  • Setup:

    • Call activateRageMode() followed by deactivateRageMode() on the rageUpgrade instance.
    • Verify that the rageModeOff event is triggered and that the layout becomes hidden.
  • Expected: The rage overlay (layout) should be hidden, and isRageActive() should return false. Also the event handler should trigger rageModeOff event.

3. testRageMeterDepletesIn30Seconds

  • Purpose: Ensure that the rage meter depletes over a span of 30 seconds and rage mode deactivates.

  • Setup:

    • Call activateRageMode() and simulate 30 seconds by repeatedly calling update() while mocking gameTime.getDeltaTime() to return 1 second.
    • Verify the value of the rage meter after 30 seconds.
  • Expected: After 30 seconds, the rage meter should deplete to 0, and deactivateRageMode() should be triggered. Also the rage meter should then start filling after depleted

4. testRageMeterFillsIn90Seconds

  • Purpose: Ensure that the rage meter fills up completely over 90 seconds when rage mode is inactive.
  • Setup: Set the rage meter to 0 and simulate 90 seconds by repeatedly calling update() while mocking gameTime.getDeltaTime() to return 1 second.
  • Expected: After 90 seconds, the rage meter should fill up to 1f, and isRageFilling() should return false.

5. testRageDeactivationBeforeDepletion

  • Purpose: To ensure that deactivating rage mode before full depletion correctly transitions into the filling phase and tracks progress correctly.

  • Setup:

    • Use parameterized rage meter values (e.g., 0.25f, 0.5f, 0.75f) and deactivate rage mode.
    • Simulate time and check if the rage meter starts filling with accurate progress.
  • Expected: After deactivation, the rage meter should start filling, and the fill time remaining should be calculated correctly.

6. testCannotActivateRageModeWhileFilling

  • Purpose: To ensure that rage mode cannot be activated while the rage meter is still filling up.
  • Setup: Set the rage meter to a partially filled value (e.g., 0.5f) and attempt to activate rage mode.
  • Expected: Rage mode should not activate, and isRageActive() should return false.

7. testDispose

  • Purpose: To verify that resources used by RageUpgrade are properly unloaded during disposal.

  • Setup:

    • Call dispose() on the rageUpgrade instance.
    • Verify that the resourceService.unloadAssets() method is called for the relevant assets.
  • Expected: The resourceService should unload the assets related to the rage upgrade, and no resources should remain in memory.

8. tearDown

  • Purpose: Ensure that the service locator is cleared after each test to avoid contamination across tests.
  • Setup: Call ServiceLocator.clear() after each test to ensure no lingering services.
  • Expected: All services should be removed from ServiceLocator, ensuring a clean environment for subsequent tests.

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