Skip to content

Lion Testing

Jul-Wong edited this page Oct 15, 2024 · 13 revisions

This details the tests run for the creation of a lion entity. It tests various features and ensures the correct creation of that NPC. These tests can be located in NPCFactoryTest.java and can be found from lines 676 to 757.

Testing

  1. testLionInitialisation Checks the initialisation of the NPC by verifying its creation, name, type, and the presence of necessary components. This includes:
  • Verifying that the lion object is not null, ensuring it was created successfully.

  • Checking if the lion entity has the correct name "Lion" as specified in the configuration.

  • Confirming that the lion object is of type Entity, verifying its inheritance or implementation.

  • Ensuring the lion entity has a PhysicsComponent, which is necessary for physical interactions.

  • Validating that the lion entity includes a PhysicsMovementComponent, which handles its movement physics.

  • Verifying that the lion entity has a ColliderComponent for collision detection.

  • Checking if the lion entity has a ConfigComponent to manage its configuration settings.

Sound, BaseHint and NPC type Tests

  1. TestLionHasCorrectSoundPath: Ensures the sound path for the lion is correctly set to "sounds/tiger-roar.wav" in the configuration.

  2. TestLionHasCorrectBaseHint: Confirms that the base hint for the lion is set correctly, matching "Welcome to Animal Kingdom!" and "I am Lenny the Lion."

  3. TestLionIsFriendly: Ensures the lion entity has a FriendlyNPCAnimationController, indicating that it is a non-aggressive NPC.

Movement Tests

  1. TestLionHasAnimation: Validates that the lion entity has an idle animation named "float", ensuring visual representation.
  2. TestLionSetPosition: Verifies that the lion entity is placed correctly at the specified position (0,0) and can be moved to that location.

Visual Testing

Screenshot 2024-10-03 at 2 49 14 pm
Clone this wiki locally