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

Testing Griffin Entity

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

Test Breakdown

1. TestAirBossCreation

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

2. TestAirBossIsEntity

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

3. TestAirBossHasComponents

  • Verifies the presence of critical components for the Air 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.
    • AirAttackComponent to handle air-based attacks.
  • Assertions:
    assertNotNull(airBoss.getComponent(PhysicsComponent.class));
    assertNotNull(airBoss.getComponent(PhysicsMovementComponent.class));
    assertNotNull(airBoss.getComponent(ColliderComponent.class));
    assertNotNull(airBoss.getComponent(BossAnimationController.class));
    assertNotNull(airBoss.getComponent(CombatStatsComponent.class));
    assertNotNull(airBoss.getComponent(AirAttackComponent.class));
    

4. TestAirBossStats

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

5. TestAirBossAnimation

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

6. TestAirBossSetPosition

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

These tests ensure that the Air Boss entity is correctly initialized with essential components, proper animations, and air-specific attack capabilities.

Visual Testing

https://youtu.be/Ny-1nAlynto?si=A2-ldcIplzNz6FhD&t=102