-
Notifications
You must be signed in to change notification settings - Fork 9
FollowComponent Test Plan
The CompanionFollowComponent
plays a crucial role in managing the behaviour of companion entity in the game. These companions are designed to follow and interact with the player character, contributing to the immersive gameplay experience. Creating a testing plan for the FollowComponent class involves identifying the key functionalities and behaviours that need to be tested to ensure the component works as expected.
Entity
(Mock): Simulates an entity for testing interactions.
PlayerCharacter
(Mock): Represents the player character for interaction testing.
CompanionFollowComponent
(Actual): The component under test.
The CompanionFollowComponent
will be initialised with mock objects for testing purposes.
Mock the position of the player character to be at coordinates (0, 0).
when(playerCharacter.getPosition()).thenReturn(new Vector2(0, 0));
Assert that the companion entity's position has changed towards the player character.
verify(entity).setPosition(any(Vector2.class));
Assert that the companion entity's position has changed away from the player character.
verify(entity).setPosition(any(Vector2.class));
Mock the player character's actions to simulate player interaction.
when(playerCharacter.isInteracting()).thenReturn(true);
This test plan covers essential scenarios for testing the CompanionFollowComponent
. By simulating player and companion interactions, we verify that companions correctly follow or repel from the player character. These tests ensure that the component behaves as expected, contributing to a dynamic and engaging gameplay.
Escape Earth Game
Interaction Controller and Interactable Components
Game and Entity Configuration Files
Loading Game Configuration Files