Test Plan: BotanistAnimationController Class - UQcsse3200/2023-studio-2 GitHub Wiki
Overview
This wiki provides documentation for the BotanistAnimationControllerTest class, which is used to test the functionality of the BotanistAnimationController component in the game. This test class ensures that the animation controller correctly triggers animations based on events.
Table of Contents
Introduction
The BotanistAnimationController
is essential for handling and controlling animations for the Botanist character in the game. It ensures the Botanist's animations are displayed accurately during gameplay.
Class Overview
Methods
create()
- Description: Initializes the animation controller for the Botanist entity and triggers the initial animation based on the animation duration.
update()
- Description: Updates the animation state for the Botanist based on the animation duration and the current animation.
Test Class: BotanistAnimationControllerTest
The BotanistAnimationControllerTest
class is responsible for testing the methods of the BotanistAnimationController
class to ensure proper functionality.
Mock Objects:
AnimationRenderComponent
(Mock): Used to simulate rendering animations for testing.
The BotanistAnimationController
will be initialized with the mock object for testing purposes.
Test Setup
Before running the test cases, the necessary mock objects and dependencies are set up for testing. The BotanistAnimationController
is initialized with the mock object for testing purposes.
Test Cases
create()
Method
Test Case 1: Objective: Verify that the create
method correctly initializes the animation controller for the Botanist entity and triggers the initial animation.
Test Steps:
- Call the
create
method of theBotanistAnimationController
. - Mock the
startAnimation
method of the mockAnimationRenderComponent
to return a specific animation key (e.g., "idle"). - Verify that the
startAnimation
method of the mockAnimationRenderComponent
is called with the expected animation key ("idle").
update()
Method
Test Case 2: Objective: Ensure that the update
method of the BotanistAnimationController
correctly updates the animation state based on the animation duration and the current animation.
Test Steps:
- Set the
animationDuration
property of the controller to a specific value (e.g., 10f). - Mock the
getCurrentAnimation
method of the mockAnimationRenderComponent
to return a specific animation key (e.g., "walking"). - Call the
update
method of theBotanistAnimationController
. - Verify that the animation state is updated correctly based on the animation duration and the current animation.
Test Case 3: Additional Test Cases
Additional test cases can be added to cover specific animation scenarios and edge cases relevant to the Botanist entity. These cases may include testing various animations and transitions based on different game conditions.
Conclusion
This test plan outlines the objectives and test cases for the BotanistAnimationController
class and its associated test class, BotanistAnimationControllerTest
. By using test cases and mock objects, we ensure that the animation controller functions correctly and can be reliably tested to maintain the reliability and correctness of the Botanist's animation system in the game.