Turtle Testing - UQcsse3200/2024-studio-2 GitHub Wiki

This details the tests run for the creation of a turtle 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 842 to 908.

Testing

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

  • Checking if the turtle entity has the correct name "Turtle" as specified in the configuration.

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

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

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

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

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

Sound, BaseHint and NPC type Tests

  1. TestTurtleHasCorrectSoundPath: Ensures the sound path for the turtle is correctly set to "sounds/turtle-hiss.wav" in the configuration.

  2. TestTurtleHasCorrectBaseHint: Confirms that the base hint for the turtle is set correctly, matching "Welcome to Animal Kingdom!" and "I am Tilly the Turtle."

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

Movement Tests

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

Visual Testing