Skip to content

TNTDamageComponent Test Plan

Mohamad Dabboussi edited this page Sep 10, 2023 · 1 revision

Test Plan for TNTDamageComponent

Introduction

Splash damage and knock-back effects are important elements in creating a dynamic and interactive gaming experience. To ensure the correct and consistent behavior of such mechanics, the TNTDamageComponent is rigorously tested according to the following test plan.

Objective

The objective is to validate the correct application of splash damage and knock-back effects by TNTDamageComponent, ensuring:

  1. Target entities within range receive the expected amount of damage.
  2. Target entities outside the range are not affected.
  3. Entities with different target layers are not affected even if they are within the splash range.

Methodology

Setup (BeforeEach)

  1. Initialize necessary services and resources for testing using ServiceLocator.
  2. Register EntityService and PhysicsService with ServiceLocator.
  3. Load textures for the TNT Tower using a new ResourceService instance.

Test Cases

Test Case 1: TestTNTDamageOnTargetsThatAreInRange

Objective: To verify the correct application of damage to targets that are within the splash radius.

Steps:

  1. Position the Attacker and a Target within the same lane and inside the splash radius.
  2. Trigger the "TNTDamageStart" event for the Attacker entity.
  3. Verify that the target's health is reduced by the expected amount.

Test Case 2: TestTNTDamageOnTargetsThatAreNotInRange

Objective: To verify that targets outside the splash radius are not affected.

Steps:

  1. Position the Attacker and two Targets in such a way that one is outside the splash radius and the other is outside the lane but inside the radius.
  2. Trigger the "TNTDamageStart" event for the Attacker entity.
  3. Verify that neither target's health is affected.

Test Case 3: TestTNTDamageOnEntitiesThatAreNotTargets

Objective: To verify that entities with different target layers are not affected.

Steps:

  1. Position the Attacker and a non-target entity (Entity_3) within the splash radius but assign them different target layers.
  2. Trigger the "TNTDamageStart" event for the Attacker entity.
  3. Verify that the non-target entity's health is not affected.

Assumptions

  • The ServiceLocator class functions as expected and has been previously tested.
  • The CombatStatsComponent, PhysicsComponent, and HitboxComponent classes have methods and behavior that are correctly implemented.
  • External extensions such as MockitoExtension and GameExtension function as expected.
Clone this wiki locally