Skip to content

Config Factories Testing Plan

Henry Batt edited this page Sep 14, 2023 · 3 revisions

Introduction

The factories play a vital role due to being responsible for the generation of new entities that make up the core gameplay. As such it is essential that they are tested thoroughly to ensure that they always behave as expected to entity spawning does not break.
Due to the implementation of configuration files to load in entity state data, the tests must be extended to ensure that the correct information is loaded in from the configuration files.

Test Plan for EnemyFactory:

Objective

The objective is to ensure that when specifically requested config files are utilised to create enemies they are correctly generated with their corresponding health and base attack damage as expected.

Methodology:

setUp (BeforeEach):

  • All the required services for the enemy factory are registered with the ServiceLocator.
    • EntityService
    • PhysicsService
    • RenderService

Test Case 1: createEnemyMeleePTEConfigTest

Objective: To ensure that when a Melee enemy type with PlayerTargeting behaviour enemy is created it has the correct health and base attack.

Steps:

  • Get the configuration file for a Melee PTE enemy.
  • Create an enemy using this configuration file.
  • Validate that the health of the created entity is correct
  • Validate that the base attack of the created entity is correct.

Test Case 2: createEnemyMeleeDTEConfigTest

Objective: To ensure that when a Melee enemy type with DestructibleTargeting behaviour enemy is created it has the correct health and base attack.

Steps:

  • Get the configuration file for a Melee DTE enemy.
  • Create an enemy using this configuration file.
  • Validate that the health of the created entity is correct
  • Validate that the base attack of the created entity is correct.

Test Case 3: createEnemyRangedPTEConfigTest

Objective: To ensure that when a Ranged enemy type with PlayerTargeting behaviour enemy is created it has the correct health and base attack.

Steps:

  • Get the configuration file for a Ranged PTE enemy.
  • Create an enemy using this configuration file.
  • Validate that the health of the created entity is correct
  • Validate that the base attack of the created entity is correct.

Test Case 4: createEnemyRangedDTEConfigTest

Objective: To ensure that when a Ranged enemy type with DestructibleTargeting behaviour enemy is created it has the correct health and base attack.

Steps:

  • Get the configuration file for a Ranged DTE enemy.
  • Create an enemy using this configuration file.
  • Validate that the health of the created entity is correct
  • Validate that the base attack of the created entity is correct.

Test Case 5: createBossEnemyMeleePTEConfigTest

Objective: To ensure that when a BossMelee enemy type with PlayerTargeting behaviour enemy is created it has the correct health and base attack.

Steps:

  • Get the configuration file for a BossMelee PTE enemy.
  • Create an enemy using this configuration file.
  • Validate that the health of the created entity is correct
  • Validate that the base attack of the created entity is correct.

Test Case 6: createBossEnemyMRangedPTEConfigTest

Objective: To ensure that when a BossRanged enemy type with PlayerTargeting behaviour enemy is created it has the correct health and base attack.

Steps:

  • Get the configuration file for a BossRanged PTE enemy.
  • Create an enemy using this configuration file.
  • Validate that the health of the created entity is correct
  • Validate that the base attack of the created entity is correct.

Test Plan for ObstacleFactory:

Objective:

The objective is to ensure that obstacles that can be created from a configuration file get generated correctly with the appropriate health and base attack as outlined in the config file.

Methodology:

setUp (BeforeEach):

  • All the required services for the obstacle factory are registered with the ServiceLocator.
    • EntityService
    • PhysicsService
    • InputService
    • ResourceService
    • RenderService
  • All the textures for the obstacles are loaded into the ResourceService.

Test Case 1: createLevelOneTurretConfigTest

Objective: To ensure that when a LevelOne Turret is created through the obstacle factory using a configuration file it has to appropriate health and base attack expected.

Steps:

  • The configuration file for a level one turret is generated.
  • A custom turret is created using the configuration file and the ObstacleFactory.
  • Validate that the created PlaceableEntity has the expected health.
  • Validate that the created PlaceableEntity has the expected base attack.

Test Case 2: createLevelTwoTurretConfigTest

Objective: To ensure that when a LevelTwo Turret is created through the obstacle factory using a configuration file it has to appropriate health and base attack expected.

Steps:

  • The configuration file for a level two turret is generated.
  • A custom turret is created using the ObstacleFactory and configuration file.
  • Validate that the created PlaceableEntity has the expected health.
  • Validate that the created PlaceableEntity has the expected base attack.

Test Plan for PowerupFactory:

Objective:

The objective is to ensure that when a configuration file is used to create a powerup through the powerup factory it is correctly generated and has the correct type.

Methodology:

setUp (BeforeEach):

  • All the required services for the powerup factory are registered with the ServiceLocator.
    • EntityService
    • PhysicsService
    • ResourceService
  • All the textures for the powerups are loaded into the ResourceService.

Test Case 1: createHealthPowerupConfigTest

Objective: To ensure that when the powerup factory is used to make a health powerup using a configuration file the appropriate powerup is created with the correct type.

Steps:

  • The configuration file for a health powerup is generated
  • The configuration file is used to generate the powerup in the PowerupFactory.
  • Validate that the powerup was successfully created (Not Null).
  • Validate that the powerup has the correct type.

Test Case 2: createSpeedPowerupConfigTest

Objective: To ensure that when the powerup factory is used to make a speed powerup using a configuration file the appropriate powerup is created with the correct type.

Steps:

  • The configuration file for a speed powerup is generated
  • The configuration file is used to generate the powerup in the PowerupFactory.
  • Validate that the powerup was successfully created (Not Null).
  • Validate that the powerup has the correct type.

Test Plan for ProjectileFactory:

Objective:

To ensure that when a projectile entity is created by the ProjectileFactory using a configuration file it is correctly generated with appropriate attack and components.

Methodology:

setUp (BeforeEach):

  • All the required services for the projectile factory are registered with the ServiceLocator.
    • EntityService
    • PhysicsService
    • RenderService

Test Case 1: createEnemyBulletConfigTest

**Objective: ** The objective is to ensure that when a bullet is created using a configuration file it is correctly generated.

Steps:

  • An enemy is created to be where the bullet is shot from.
  • The configuration file for a bullet is generated.
  • The config file is used to create an enemy bullet from the enemy to a target position.
  • Validate that the created bullet has the correct attack damage amount.
  • Validate that the bullet has an AITaskComponent.

Dependencies:

  • The EnemyFactory must be able to create an enemy entity for the bullet to be shot from.
Clone this wiki locally