-
Notifications
You must be signed in to change notification settings - Fork 2
PathFollowTask Test
Vansh Mittal edited this page Aug 29, 2024
·
1 revision
-
PathFollowTask
: The test's primary class. -
GameTime
: A service that mimics and controls the time of the game. -
AITaskComponent
,Entity
,PhysicsMovementComponent
: These components simulate in-game entities and their behaviors. -
EventListener0
: To ensure that the right events are triggered, a mocked event listener is used. -
ServiceLocator
: Registers services used in the game to isolate the class being tested. -
GameExtension
,MockitoExtension
: These are JUnit extensions that allow for game-specific configuration and Mockito functionality.
The shouldTriggerEvent()
method contains the main logic of the test. This function is in charge of confirming that the PathFollowTask initiates the "wanderStart" event:
- Target Position Setup: The target position (5, 5) is represented by a Vector2 object that is generated. The PathFollowTask is initialized using this position.
- Task and Entity Initialization: The target position is used to build a new PathFollowTask. Additionally, a container for handling AI tasks in the game called an
AITaskComponent
is made. This component now includes thePathFollowTask
. - Next, an Entity containing the
AITaskComponent
and aPhysicsMovementComponent
is created and configured. The creature can communicate with the game's physics system thanks to thePhysicsMovementComponent
. - Entity Creation: The entity is created by calling the
create()
method, which initializes all of the components that are attached to the entity. In order to correctly configure the entity's state and prepare it for testing, this is required. - Event Listener Mocking: Mockito is used to mimic an event listener by mocking an
EventListener0
. The entity's event system then registers this listener to receive notifications of thewanderStart
event. - Starting the Task: The PathFollowTask calls the
start()
function. This should cause the task to begin behaving in a way that should cause thewanderStart
event to occur based on how it is implemented. - Event Verification: To confirm that the mimicked
EventListener0
received ahandle()
call, use Mockito'sverify()
method. This attests to the fact that thewanderStart
event was set off by the task when it started.
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