Testing Plan for WeaponAnimationController component - UQcsse3200/2024-studio-1 GitHub Wiki
Test Plan for WeaponAnimationControllerTest Class
Objective
The purpose of this test plan is to validate the functionality of the WeaponAnimationController class, which manages the animation logic for weapon entities and their connection to players. The tests aim to ensure the correct creation of the animation controller, and the connection and disconnection behavior of the controller when attached to a player.
Test Environment
Framework: JUnit 5 with Mockito for mocking dependencies
Objects Used:
WeaponAnimationControllerclass for managing weapon animations.Entityclass representing the player entity.WeaponFactoryfor creating weapon objects (mocked).NameComponentto assign names to entities (e.g., "Ranged").
Setup:
- The
beforeEach()method registers necessary services such asRenderService,EntityService,PhysicsService, andResourceService. - Mocks are created for
WeaponFactoryandEntity(player entity). - Projectiles' texture atlases are loaded to simulate game assets.
Test Cases
Test Case 1: Create WeaponAnimationController
Objective: Validate the successful creation of the WeaponAnimationController.
Setup: Instantiate a new WeaponAnimationController.
Expected Outcome:
- The
WeaponAnimationControllerinstance is successfully created and is not null.
Test Case 2: Connect and Disconnect Player
Objective: Ensure the WeaponAnimationController correctly connects and disconnects a player entity.
Setup:
- Create a new
WeaponAnimationController. - Add the
WeaponAnimationControllerto the player entity. - Add a
NameComponentto the player entity with the name "Ranged". - Connect the player to the
WeaponAnimationController. - Disconnect the player from the
WeaponAnimationController.
Expected Outcome:
- After connecting, the
connectedproperty of theWeaponAnimationControllershould betrue. - After disconnecting, the
connectedproperty of theWeaponAnimationControllershould befalse.
Conclusion
This test plan ensures that the WeaponAnimationController class behaves as expected when creating the controller, connecting a player entity, and disconnecting the player, with proper state management for the connection status.