Skip to content

Test plan for Astronaut Animation controller

DRG31 edited this page Oct 5, 2023 · 2 revisions

Overview

This wiki page provides documentation for the test plan of the AstronautAnimationController class. The AstronautAnimationController is responsible for controlling the animations of an Astronaut 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 AstronautAnimationController class is responsible for managing animations for the Astronaut 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 AstronautAnimationController 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 AstronautAnimationController.
  2. Verify that the startAnimation method of the mock AnimationRenderComponent is called with the expected animation key ("row-1-column-1").

image

Test Case 2: update Method

Objective: Ensure that the update method of the AstronautAnimationController 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., "row-1-column-2").
  3. Call the update method of the AstronautAnimationController.
  4. Verify that the AnimationRenderComponent updates the animation state accordingly based on the specified animation key and duration.

image

Conclusion

This test plan provides a comprehensive approach to testing the AstronautAnimationController class, ensuring that it functions correctly in managing animations for the Astronaut 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 Astronaut NPC animation system in the game.

Contributors

Clone this wiki locally