Player Weapons Testing Plan - UQcsse3200/2023-studio-2 GitHub Wiki

Test Plan for AttackFactory

Objective:

Validate Correct behavior of player weapons

Methodology:

Setup (BeforeEach):

  • Mock necessary components and services.
  • Along with commonly used function calls within these.

**Test Case 1-4, 8: **

Objective: Test Correct Controller used for weapon types

Steps:

  1. Obtain the required config for corresponding weapon
  2. Create an attack from the weapon config
  3. Check the attack entity has the correct weapon controller

**Test Case 5: **

Objective: Test Combat components

Steps:

  1. Obtain the required config for corresponding weapon
  2. Create an attack from the weapon config
  3. Check the attack has a: physics component, hitbox component, touch attack component and a combat stats component.

**Test Case 6: **

Objective: Test Audio visual components

Steps:

  1. Obtain the required config for corresponding weapon
  2. Create an attack from the weapon config
  3. Check the attack has a: Animation render component and a sound component.

**Test Case 7: **

Objective: Ensure combat stats is using the specified damage

Steps:

  1. Obtain the required config for corresponding weapon
  2. Create an attack from the weapon config
  3. Check the the combat stats component has damage equal to that specified in the config file

**Test Case 9, 10: **

Objective: Ensure the spawn delay is correctly specified

Steps:

  1. Obtain the required config for corresponding weapon
  2. Create an attack from the weapon config with attack number 1
  3. check the spawn delay is equal to the spawn delay specified in the controller

**Test Case 11: **

Objective: Test multiple projectiles are generated

Steps:

  1. Create an attack array using createAttacks function
  2. Check the number of attacks generated in the attack array is equal to the number of projectiles specified in the corresponding config

**Test Case 12: **

Objective: Ammo requirement

Steps:

  1. Mock an inventory component to have 0 current ammo
  2. check create attacks returns a null array with no attacks.

Test Plan for Weapon Controllers

Methodology:

As the weapon animations and movement is a visual each weapon was tested manually This was done to test:

  • Animation and sprite directionality for each weapon
  • Movement of the animation makes sense in the context of the weapon

A video of this manual testing can be seen here.