Leviathan Testing Plan - UQcsse3200/2024-studio-2 GitHub Wiki

Testing Leviathan Entity

This section outlines the tests performed on the creation of the Leviathan entity. It verifies the functionality and components of the Leviathan NPC. These tests are located in BossFactoryTest.java between lines 121 to 175.

Test Breakdown

1. TestWaterBossCreation

  • Verifies that the Water Boss entity is successfully created and is not null.
  • Assertion: assertNotNull(waterBoss, "Water Boss should not be null.");

2. TestWaterBossIsEntity

  • Confirms that the Water Boss is of type Entity, ensuring it correctly inherits from the Entity class.
  • Assertion: assertEquals(waterBoss.getClass(), Entity.class);

3. TestWaterBossHasComponents

  • Verifies the presence of critical components for the Water Boss, including:
    • PhysicsComponent for handling physics-related behaviors.
    • PhysicsMovementComponent for managing movement physics.
    • ColliderComponent for detecting collisions.
    • BossAnimationController for managing boss-specific animations.
    • CombatStatsComponent to track health and other combat stats.
    • WaterAttackComponent to handle water-based attacks.
  • Assertions:
    assertNotNull(waterBoss.getComponent(PhysicsComponent.class));
    assertNotNull(waterBoss.getComponent(PhysicsMovementComponent.class));
    assertNotNull(waterBoss.getComponent(ColliderComponent.class));
    assertNotNull(waterBoss.getComponent(BossAnimationController.class));
    assertNotNull(waterBoss.getComponent(CombatStatsComponent.class));
    assertNotNull(waterBoss.getComponent(WaterAttackComponent.class));
    

4. TestWaterBossStats

  • Confirms that the Water Boss has the correct initial combat stats, particularly 200 health points.
  • Assertion: assertEquals(200, waterBoss.getComponent(CombatStatsComponent.class).getHealth(), "Water Boss should have 200 HP.");

5. TestWaterBossAnimation

  • Ensures the Water Boss has the correct animations, specifically checking for the "idle" animation.
  • Assertion: assertTrue(waterBoss.getComponent(AnimationRenderComponent.class).hasAnimation("idle"), "Water Boss should have idle animation.");

6. TestWaterBossSetPosition

  • Verifies that the Water Boss can be set to a specific position, such as (0, 0).
  • Assertion:
    Vector2 pos = new Vector2(0f, 0f);
    waterBoss.setPosition(pos);
    assertEquals(pos, waterBoss.getPosition());
    

These tests ensure that the Leviathan entity is correctly initialized with essential components, proper animations.

Visual Testing

https://youtu.be/Ny-1nAlynto?si=YHTMeVGWBflDFPY8&t=67