-
Notifications
You must be signed in to change notification settings - Fork 2
BackstoryCutscene Test Plan
Tia Waturuocha edited this page Oct 2, 2024
·
2 revisions
- Framework: JUnit 4
-
Dependencies:
-
BackstoryCutscene
: The main class under test. -
ServiceLocator
: Manages the services used in the game. -
ResourceService
,GameTime
,EntityService
: Registered services to support cutscene functionality. -
Entity
: A game entity to whichBackstoryCutscene
is attached. -
EventHandler
: Mocked event handlers for verifying event triggers. -
Texture
: Mocked texture objects for verifying resource loading.
-
-
Purpose: Verify that
BackstoryCutscene
is properly initialised with the necessary services and entity setup. -
Setup:
- Mock
ResourceService
,GameTime
,Entity
, and other dependencies. - Register necessary services in the
ServiceLocator
. - Initialise
BackstoryCutscene
and set the mock entity.
- Mock
-
Expected Outcome:
-
BackstoryCutscene
is initialised without errors. - The mock services are correctly set up in the
ServiceLocator
. - The
Entity
is correctly attached to the cutscene.
-
- Purpose: Test that the correct textures are loaded during the cutscene's asset loading phase.
-
Setup:
- Call
backstoryCutscene.loadAssets()
.
- Call
-
Expected Outcome:
- The
ResourceService.loadTextures()
method is called with the correct texture paths. - The
ResourceService.loadAll()
method is invoked exactly once.
- The
-
Purpose: Verify that the
BackstoryCutscene
properly sets up the scenes with the correct number of scenes, background images, and text content. -
Setup:
- Call
backstoryCutscene.setupScenes()
.
- Call
-
Expected Outcome:
- The number of scenes in the
BackstoryCutscene
matches the expected number (12 scenes). - The first scene has the correct background image path and scene text.
- The background image path and text content are verified for accuracy.
- The number of scenes in the
- Purpose: Test that the cutscene creates and registers entities correctly when a scene is loaded.
-
Setup:
- Call
backstoryCutscene.setupScenes()
and load the first scene withbackstoryCutscene.loadScene(0)
.
- Call
-
Expected Outcome:
- The
EntityService.register()
method is called once to register the background entity for the scene.
- The
- Purpose: Ensure that the cutscene completes after the set duration and triggers the correct events.
-
Setup:
- Mock
GameTime
to simulate time passing (e.g., 0L and 5000L). - Call
backstoryCutscene.update()
before and after the simulated time has passed.
- Mock
-
Expected Outcome:
- Before the cutscene duration is up, no events are triggered.
- After the cutscene duration, the "cutsceneEnded" event is triggered exactly once.
-
Purpose: Verify that assets are properly unloaded when
BackstoryCutscene
is disposed of. -
Setup:
- Call
backstoryCutscene.dispose()
.
- Call
-
Expected Outcome:
- The
ResourceService.unloadAssets()
method is called with the correct texture paths, ensuring the assets are unloaded correctly.
- The
-
Purpose: Verify that the cutscene transitions correctly between scenes when
nextCutscene()
is called. -
Setup:
- Call
backstoryCutscene.nextCutscene()
after setting up the scenes.
- Call
-
Expected Outcome:
- The
currentSceneIndex
is incremented and the next scene is loaded. - When the final scene is reached, the "cutsceneEnded" event is triggered.
- The
- Purpose: Ensure that entities are properly disposed of when transitioning between scenes or ending the cutscene.
-
Setup:
- Mock the
disposeEntities()
method and trigger scene transitions.
- Mock the
-
Expected Outcome:
- Entities from the previous scene are disposed of correctly, preventing memory leaks or reuse in the next scene.
-
Purpose: Verify that
BackstoryCutscene
handles error scenarios such as missing scenes or assets. -
Setup:
- Simulate a scenario where scenes or assets are not loaded.
-
Expected Outcome:
- The cutscene should not throw exceptions when assets are missing, and appropriate warnings should be logged.
- The cutscene should gracefully handle the absence of scenes by ending the cutscene early or skipping missing scenes.
- Ensure that all major actions (loading/unloading assets, transitioning scenes, disposing entities) are logged appropriately.
- Log messages should be verified using mock loggers where applicable, ensuring that event-based logging provides sufficient information for debugging and testing purposes.
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
Entities and Components
Input Handling
Game Screens and Areas
Fire Extinguisher Handler Component
MainGameActions Create Docket Triggers
Main Game Order Button Display
BackstoryCutsceneDisplay Test Plan
Test Plan for MainGameOrderTicketDisplay
Test Plan for MainGameOrderBtnDisplay
Test Plan for DocketLineDisplay
Test plan for RandomComboService
Test plan for SpeedBoostUpgrade
Test plan for DancePartyUpgrade