Sprint 3 Test Plan - UQcsse3200/2024-studio-2 GitHub Wiki
Test Objectives:
In this sprint, we implemented new enemy interactions with the player, such as bees spawning from stationary hives and eels launching electric orbs. We also made adjustments to existing functionalities, like the monkey throwing bananas. Additionally, since the introduction of two new biomes - the air and underwater biomes, new enemy NPCs that reflected these were added. These NPCs included:
- Big saw fish
- Eel
- Octopus
- Bee
- Macaw
- Pigeon
Features Added
-
Blind Bear Enemy NPC and Player Interaction - The bear loses interest in the player when they're standing still. During this period, players have an opportunity to assess their surroundings or plan their next move since the bear is quite a fast enemy. However, the moment players begin to run or make sudden movements, the bear's interest is reignited.
-
Hive spawning Enemy Bee NPCs - Introduction of bee hives that spawn Enemy Bee NPC swarms. When players approach a hive, they trigger the spawning mechanism, leading to waves of aggressive bees that swarm out to defend their territory
-
Pigeon Stealing Items Feature - The Pigeon Stealing Items feature introduces more entertainment into gameplay and these pigeons steal items from players.
Testing Approach
The following test styles were used during the testing process for Sprint 2
- Execution
- Pass/fail (JUnit assertions)
- Visual Inspection
Test Documentation
Test cases have been added to test new classes that have been created
Enemy NPC Creation Testing
To verify the proper creation and functionality of enemy NPCs, we performed visual tests by observing their animations, movements, and behavior in the game environment. Each time an NPC was spawned, we ensured that the correct animations were triggered and running smoothly, validating that the visual representation aligned with the expected design. Additionally, we confirmed that the NPCs moved as intended, responding accurately to player actions and environmental stimuli. These visual tests were conducted in various in-game scenarios to ensure consistent performance and behavior across different conditions.
Shoot Task
These tests ensure the proper functioning of the ShootTask for firing projectiles based on the target's range and elapsed wait time. The ShootTask fires projectiles at a designated target when the entity is within range, and the appropriate amount of time has passed.
Methods
shouldShootWhenInRangeAndWaitTimeElapsed()
- This test verifies that the ShootTask fires a projectile when the target is within range and the wait time (e.g., 1 second) has elapsed. It mocks the game time and ensures that after enough time has passed, the event handler correctly triggers the "Shoot" event, simulating the firing action.
shouldShootOnlyWhenInDistance()
- This test ensures that the ShootTask only fires when the target is within a specific distance (range of 5 units). The test checks priority levels based on distance and verifies that no shooting occurs when the target is out of range.
These tests confirm that the ShootTask behaves as expected under various conditions, ensuring that projectiles are fired only when appropriate (i.e., within range and after the wait time).
Hive Task
These tests ensure the proper functioning of the HiveTask, which triggers the "float" event for the hive entity and verifies the task's priority.
Methods
-
shouldTriggerFloatEvent()
-
This test verifies that the HiveTask triggers the "float" event when the task is started. The event simulates the hive's floating movement. The game time is mocked, and an event listener is added to check if the event is correctly fired when the HiveTask is initiated.
-
shouldReturnCorrectPriority()
-
This test ensures that the HiveTask returns the correct priority level. In this case, the expected priority for the task is set to 11.
Enemy Animation in Combat Screen
The testing for this implementation focus on verifying that the CombatAnimationController
correctly switches between the combat_idle
and combat_move
animations based on events, ensuring the animations face the appropriate direction for both the player and enemy. Tests also confirm that animals, like the Chicken NPC, are properly created in the CombatAnimalFactory
, with their animations added and triggered when the entity is spawned in the combat area, ensuring smooth transitions between the idle and move states during combat Enemy Animation in Combat and visual testing.