Skip to content

Testing Plan for WeaponAnimationController component

Thang edited this page Oct 1, 2024 · 1 revision

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:

  • WeaponAnimationController class for managing weapon animations.
  • Entity class representing the player entity.
  • WeaponFactory for creating weapon objects (mocked).
  • NameComponent to assign names to entities (e.g., "Ranged").

Setup:

  • The beforeEach() method registers necessary services such as RenderService, EntityService, PhysicsService, and ResourceService.
  • Mocks are created for WeaponFactory and Entity (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 WeaponAnimationController instance 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:

  1. Create a new WeaponAnimationController.
  2. Add the WeaponAnimationController to the player entity.
  3. Add a NameComponent to the player entity with the name "Ranged".
  4. Connect the player to the WeaponAnimationController.
  5. Disconnect the player from the WeaponAnimationController.

Expected Outcome:

  • After connecting, the connected property of the WeaponAnimationController should be true.
  • After disconnecting, the connected property of the WeaponAnimationController should be false.

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.

Table of Contents

Home

Design

Design Document

Design Choices

Game Wiki

Gameplay

Controls

Game Features

Utilities
Animals
Menus/screens
Character
Map
Weapon
Projectile
Items
Music/sound

User Guide

Starting the game

Game Engine

Getting Started

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Enhancement of Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally