Skip to content

Sprint 2 Test Plan

mhUnt3rS edited this page Sep 12, 2024 · 23 revisions

Test Objectives:

In this sprint, we added a bear enemy to the game which will be the strongest enemy of the forest biome which has the combat stats, including health, attack, defense, and speed. Moreover, monkey Throwing banana is to enhance the behavior of Monkey enemy NPCs by implementing a new feature where they can throw bananas and spawn banana items within the game. This will add a unique attack mechanic and a new item for players to interact with (dodge).

Features Added

  • New Enemy Bear: combat stats for bear are health, attack, defense, and speed.

  • Monkey Throwing banana functionality and animations: Adding Projectile entities for banana throwing

  • Banana Spawn: Every monkeys spawn banana items once in the game. These bananas will later make minor damage.

  • Animation and UI Enhancements: Smooth animations for the enemy image and text labels.

Testing Approach

The following test styles were used during the testing process for Sprint 2

  • Execution
  • Pass/fail (JUnit assertions)
  • Visual Inspection

Test Areas:

Test cases have been added to test new classes that have been created

Test Documentation

Projectile Factory Tests

Tests the creation of projectiles, which is currently only the banana, to ensure they are instantiated correctly with the necessary components.

Methods

View Projectile Factory Tests

  • TestBananaCreation(): Tests the creation of a banana projectile.
  • TestBananaIsEntity(): Verifies that the created banana is an instance of the Entity class.
  • TestBananaHasComponents(): Ensures that the banana has all required components, such as PhysicsComponent, PhysicsMovementComponent, BananaAnimationController, ProjectileAttackComponent, HitboxComponent, and ColliderComponent.

Projectile Attack Component Tests

Tests the ProjectileAttackComponent to verify that it correctly handles collision-based attack logic.

Methods

View Projectile Attack Component Tests

  • shouldNotAttackOtherLayer(): Verifies that the projectile does not deal damage to a target entity if it is on a different physics layer.

Shoot Task Tests

Tests the ShootTask to verify its behaviour for firing projectiles when within range and the correct wait time has elapsed.

Methods

View Shoot Task tests

  • shouldShootWhenInRangeAndWaitTimeElapsed(): Verifies that the ShootTask fires a projectile (triggers the "FireBanana" event) when the target is within range and the wait time has passed.
  • shouldShootOnlyWhenInDistance(): Ensures that the ShootTask only fires when the target is within a specified distance range and does not shoot when the target is too far away.

Enemy Combat Cut Scene Test

Visual testing to verify that the cut-scene for enemies before combat is triggering correctly, displaying and formatting correctly as well. The videos recording the functionalities as a test can be found below:

Added Tests for Bear

Tests that the bear has correct stats and components. Added to the existing EnemyFactoryTest.java file.

Methods

View Bear Tests in Enemy Factory Tests

  • TestBearCreation(): Verifies that the Bear entity exists after calling for its creation.
  • TestBearIsEntity(): Verifies that the Bear is of an entity class.
  • TestBearHasComponents(): Ensures that the bear has all the necessary components: PhysicsComponent, PhysicsMovementComponent, BearAnimationController, CombatStatsComponent, HitboxComponent, ColliderComponent.
  • TestBearStats(): Ensures that the bear has the correct stats. Health should be between 13 an 17 inclusive.
  • TestBearAnimation(): Ensure that the bear has correct animations. Should have a float animation and a chase animation.
  • TestBearSetPosition(): Verifies that the bear has the correct position on the map.
Clone this wiki locally