Sprint 4 Test Plan - UQcsse3200/2024-studio-2 GitHub Wiki

Test Objectives:

In Sprint 4, the focus is on finalizing the game by thoroughly testing and validating all major features and functionalities, ensuring a cohesive and polished player experience. This includes comprehensive testing of enemy interactions, animations, and overall game mechanics, along with the integration of user feedback. Key areas of testing will include:

  • Verification of enemy stats and behaviors across all NPC types.
  • Thorough validation of the StealTask functionality, ensuring proper item interactions.
  • Testing the animations and interactions defined in the EnemyFactory.
  • Visual testing of key game screens, such as pre-combat cutscenes and transitions between game states.
  • Conducting user testing sessions to gather insights on gameplay experience and usability.

Features Added

  • Enemy Stats Validation - Ensure all enemy NPCs have correct stats (health, damage, speed) and that these stats behave as intended during gameplay.

  • StealTask Functionality - Verify that the StealTask correctly implements the item-stealing behavior for NPCs, ensuring that items are accurately removed from the player's inventory upon interaction.

  • Enemy Animation Testing - Validate that all enemy animations (idle, move, attack) function properly in various game contexts and transition smoothly between states.

  • EnemyFactory Interactions - Ensure that the EnemyFactory correctly creates enemy instances with appropriate attributes and behaviors, confirming that all interactions work as intended.

  • Visual Testing for Pre-Combat Cutscenes - Check that Precombat cutscenes play correctly, with proper animations, timing, and transitions, ensuring a seamless experience for players.

  • User Testing - Conduct sessions to assess player experience, usability, and overall satisfaction with game mechanics, gathering valuable feedback for potential improvements.

Testing Approach

The testing methods for this sprint will encompass a variety of approaches to ensure comprehensive coverage:

  • Execution: Running the game to manually observe and test functionalities in real-time.
  • Pass/fail (JUnit assertions): Using JUnit assertions for automated tests to validate expected behaviors of game mechanics.
  • Visual Inspection: Conducting visual checks on animations, transitions, and overall presentation to confirm that the user interface and gameplay are visually appealing and functioning correctly.

Test Documentation

Test cases will be updated and added as necessary to cover the new features and interactions introduced in this sprint, with a focus on ensuring thorough validation of gameplay elements.

Steal Task

View Steal Task Tests

These tests ensure the proper functioning of the StealTask for collecting items around the map. The StealTask remove items at a designated target when the entity is within range, and the appropriate amount of time has passed.

Methods

  • testStartStealTask() This test verifies that the StealTask initiates the stealing behavior correctly when an NPC approaches an item. It checks whether the task correctly identifies the target item and whether the NPC moves toward it to execute the steal action. Additionally, the test confirms that after the steal action is completed, the NPC resumes its previous state or behavior as intended. Assertions will be made to ensure that the item's state is updated (i.e., removed from the game or inventory) and that the NPC returns to its original position.

  • testReturnToOriginalPosition() This test ensures that the StealTask accurately returns the NPC to its original position after successfully stealing an item. It verifies that the NPC tracks its initial position before engaging in the stealing action. After the steal action is performed, the test checks if the NPC moves back to this recorded position without deviations. This test is crucial for maintaining consistent NPC behavior and ensuring that movement mechanics work as expected.

  • testStealingMultipleItems() This test assesses the capability of the StealTask to handle scenarios where multiple items are available for stealing. It verifies that the NPC can successfully steal items in succession without failure or erroneous behavior. The test checks whether the NPC correctly identifies each item, approaches, and executes the steal action, then returns to its original position after each item is taken. Assertions will also ensure that the game state reflects the removal of each stolen item from the environment or player's inventory, confirming that the task can effectively manage multiple interactions in a single session.

These tests confirm that the StealTask behaves as expected under various conditions, ensuring that pigeon steal item only when appropriate (i.e., within range and after the wait time).

BlindBearTask Tests

View BlindBearTask Tests

These tests ensure the proper functioning of the BlindBearTask, which controls the wandering behavior of the bear NPC and how it interacts with the target (often the player). The task manages the bear's movement towards the target, handles wandering within a set range, and prioritizes movement based on the proximity of the player.

Methods

  • shouldMoveTowardsTarget() This test verifies that the bear NPC moves towards the target when the BlindBearTask is active. The test mocks the PlayerActions component to simulate player movement and checks whether the bear reduces its distance from the target over a few cycles. This ensures that the bear's movement logic is functioning correctly and that it effectively closes the gap when the player is within range.

  • priorityTest() This test ensures that the bear NPC correctly adjusts its task priority based on the target's distance and visibility. The test verifies that the bear only prioritizes chasing the target when within the specified view distance and if the target is visible. When the target is out of range or not moving, the task should return a negative priority, ensuring that the bear does not chase the target unnecessarily. The test covers various scenarios where the target's position changes, and the bear adjusts its behavior accordingly.

These tests confirm that the BlindBearTask behaves as expected under different conditions, ensuring that the bear NPC moves towards the target only when appropriate and respects the prioritization logic for chasing or wandering.

Pull Task

View Pull Task Tests

The Pull Task Tests validate the functionality of the PullTask, which is responsible for drawing player characters closer to specific enemy NPCs, such as the Frog Enemy NPCs. These tests are crucial to ensure that the mechanics work as intended and contribute to engaging gameplay interactions.

Methods

  • testStartPullTask() This test verifies that the PullTask is initiated correctly and activates the spawning mechanism for the Frog Enemy NPC. It ensures that the task transitions seamlessly from its initial state to an active state when the specified conditions are met. Additionally, this test confirms that the Frog NPC is instantiated properly within the game world upon starting the PullTask. It also checks that all relevant events, such as animations and sound effects associated with the initiation of the PullTask, are triggered correctly, providing a cohesive and immersive experience for the player.

  • testPullToPlayerWithinRange() This test checks the behavior of the PullTask when the enemy NPC is within the designated pull range of the player. It ensures that, while the PullTask is active, the player is successfully pulled toward the Frog NPC if they fall within the specified range. This test verifies that the correct calculations for distance are performed accurately to determine the player's proximity to the enemy. Additionally, it ensures that the appropriate animations and effects are triggered to signify the pulling action, thereby enhancing the visual feedback for the player and providing a more engaging gameplay experience.

Projectile Movement Task

View Projectile Movement Task Tests

These tests ensure the proper functionality of the ProjectileMovementTask, which manages the movement of projectiles within the game. The ProjectileMovementTask facilitates the targeting and movement of projectiles towards specified entities.

Methods

  • testTriggerEvent() This test verifies that the various movement events related to projectile direction are triggered correctly. It ensures that when specific directional events (up, right, down, left, and their combinations) are invoked, the projectile responds as intended. The test checks if all relevant callbacks for the movement events are executed successfully, validating that the projectile can change its direction appropriately based on player input or game conditions.

  • testReturnCorrectPriority() This test checks that the ProjectileMovementTask returns the correct priority level. It verifies that the task prioritization is set correctly based on the input parameters. The test involves mocking a target entity and asserting that the priority value matches the expected value, confirming that the task's importance within the AI task queue is accurately reflected.

These tests confirm that the ProjectileMovementTask behaves as expected, ensuring that projectiles can effectively target and move towards entities in the game while maintaining the proper event handling and prioritization.

Entity Configuration

View Entity Configuration Tests

These tests ensure the proper functionality of the BaseEntityConfig and BaseEnemyEntityConfig classes, which define the configuration for entities and enemy entities within the game. The tests validate various properties such as sprite paths, health, hunger, attack, defense, speed, and experience.

Methods

  • testGetSpritePath() This test verifies that the getSpritePath method of BaseEntityConfig correctly returns the expected sprite path. It ensures that the entity's graphical representation is accurately specified in the configuration.

  • testFriendly() This test checks the behavior of the isFriendly and setFriendly methods in the BaseEntityConfig. It confirms that the entity's friendly status can be set and retrieved correctly, ensuring the proper classification of entities as friendly or not.

  • testGetAnimationSpeed() This test assesses the getAnimationSpeed method, verifying that it returns the correct animation speed for the entity. It ensures that animations are played at the specified speed during gameplay.

  • testGetSoundPath() This test evaluates the getSoundPath method to ensure that it returns the correct array of sound paths. It verifies that the associated sound effects are correctly defined in the entity configuration.

  • testHealth() This test checks the health-related methods of BaseEnemyEntityConfig. It verifies that the default health is set correctly and that the health can be updated and retrieved accurately after modification.

  • testHunger() This test verifies the hunger-related methods, ensuring that the default hunger value is correct and that changes to the hunger value can be set and retrieved accurately.

  • testAttack() This test assesses the setBaseAttack method, verifying that the base attack value can be updated correctly. It ensures that the enemy entity's attacking capability is represented accurately in the configuration.

  • testDefence() This test evaluates the defense-related methods of BaseEnemyEntityConfig. It checks that the default defense value is correct and that it can be modified and retrieved accurately.

  • testSpeed() This test checks the speed-related methods, verifying that the default speed value is set correctly and that modifications to the speed can be accurately retrieved.

  • testExperience() This test assesses the experience-related methods, ensuring that the default experience value is accurate and that it can be updated and retrieved correctly.

These tests confirm that the entity configuration classes function as intended, providing the necessary attributes for entities and enemy entities in the game.

Entity

View Entity Tests

These tests ensure the proper functionality of the Entity class, validating its behavior regarding component management, disposal, and equality comparisons. The tests confirm that entities behave correctly during their lifecycle and that the equality checks function as expected.

Methods

  • shouldNotDisposeAnimationComponent()

  • This test verifies that the AnimationRenderComponent is not disposed of when the specialDispose method is called on the entity. It ensures that only specific components (in this case, TestComponent1) are disposed of while the animation component remains intact. The test also checks that the entity is unregistered from the EntityService, confirming that the entity’s lifecycle is managed correctly without affecting its animation rendering capabilities.

  • shouldNotEqualDifferentClass()

  • This test assesses the equality comparison of the Entity class with instances of different classes. It ensures that an Entity object is not considered equal to an instance of another class (in this case, TestComponent1). This test helps cover all branches of the equals method, contributing to code quality metrics by ensuring proper functionality in equality checks.

These tests confirm that the Entity class operates as intended, effectively managing its components and adhering to correct object-oriented principles regarding equality.

Enemy Factory

View Enemy Factory Tests

These tests ensure that the enemies created by the EnemyFactory have the correct animations and animation controllers associated with their behaviors. Each test verifies that the corresponding animation controller is present and that the expected animations are available for each enemy type.

Methods

  • TestEelAnimation() This test verifies that the Eel has the correct animation setup. It checks for the presence of the EelAnimationController and confirms that the AnimationRenderComponent contains the expected animations, including "swim_down," "swim_down_right," "swim_right," "swim_up_right," and "swim_up."

  • TestJoeyAnimation() This test ensures that the Joey has the appropriate animations. It checks that the JoeyAnimationController is present and verifies that the AnimationRenderComponent includes the "chase," "wander," and "spawn" animations.

  • TestBeeAnimation() This test confirms that the Bee entity has the correct animations. It checks for the presence of the BeeAnimationController and verifies that the AnimationRenderComponent contains the "chase," "float," and "alert" animations.

  • TestOctopusAnimation() This test ensures that the Octopus has the correct animations. It verifies the presence of the OctopusAnimationController and checks that the AnimationRenderComponent includes the "chase" and "float" animations.

  • TestMacawAnimation() This test checks that the Macaw has the correct animations. It verifies the presence of the MacawAnimationController and checks for the "chase," "walk," and "spawn" animations within the AnimationRenderComponent.

  • TestBigSawFishAnimation() This test confirms that the BigSawFish has the correct animations. It ensures that the BigSawFishAnimationController is present and verifies that the AnimationRenderComponent contains the "chase," "float," and "spawn" animations.

Precombat Cutscene

The Precombat Cutscene Visual Test ensures that the precombat cutscene runs smoothly, displaying all intended animations, transitions, and visual effects. This test verifies that the cutscene triggers correctly when the player enters a combat area, with animations for both enemy NPCs and the player character playing fluidly. Key elements include checking the timing and synchronization of animations with audio cues, assessing camera angles, and ensuring that visual effects enhance immersion. Finally, the test confirms that the cutscene transitions back into gameplay without glitches, positioning the player character correctly for the ensuing combat. This validation is crucial for maintaining the game's overall quality and narrative flow.