Skip to content

Test Plans For Astro Animation Controller

Aniket Gupta edited this page Oct 4, 2023 · 3 revisions

Overview

This wiki page provides documentation for the test plan of the AstroAnimationController class. The AstroAnimationController is responsible for controlling the animations of an Astro NPC entity in the game. The purpose of these tests is to ensure that the animation controller behaves as expected and handles animations and updates correctly.

Introduction

The AstroAnimationController class is responsible for managing animations for the Astro NPC entity in the game. This test plan outlines the strategy for testing the key methods of this class to ensure proper animation handling and updates.

Test Setup

Before running the test cases, we will set up the necessary objects and dependencies for testing. Mock objects will be used for dependencies to isolate the class under test.

Mock Objects:

  • AssetManager (Mock): Used to simulate asset loading.
  • AnimationRenderComponent (Mock): Used to simulate rendering animations.
  • TextureAtlas (Mock): Used to simulate the texture atlas for animations.

The AstroAnimationController will be initialized with these mock objects for testing purposes.

Test Cases

Test Case 1: create Method

Objective: Verify that the create method correctly initializes the animation controller and triggers the initial animation.

Test Steps:

  1. Call the create method of the AstroAnimationController.
  2. Verify that the startAnimation method of the mock AnimationRenderComponent is called with the expected animation key ("Astro_Down").
  3. Verify that the AssetManager is called to load the Astro NPC texture atlas.
  4. Verify that the AssetManager is called to finish loading.
Screenshot 2023-10-05 at 4 18 40 AM

Test Case 2: update Method

Objective: Ensure that the update method of the AstroAnimationController correctly updates the animation state based on the animation duration and the current animation.

Test Steps:

  1. Set the animationDuration property of the controller to a specific value (e.g., 10f).
  2. Mock the getCurrentAnimation method of the AnimationRenderComponent to return a specific animation key (e.g., "Astro_Up").
  3. Call the update method of the AstroAnimationController.
  4. Verify that the AnimationRenderComponent updates the animation state accordingly based on the specified animation key and duration.
Screenshot 2023-10-05 at 4 20 10 AM

Conclusion

This test plan provides a comprehensive approach to testing the AstroAnimationController class, ensuring that it functions correctly in managing animations for the Astro NPC entity. By using mock objects and specifying expected behavior, we validate the initialization, animation triggering, and animation updates of the controller. These tests help maintain the reliability and correctness of the Astro NPC animation system in the game.

Contributors

Clone this wiki locally