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

This details the tests run for the creation of a fish 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 514 to 594.

Testing

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

  • Checking if the fish entity has the correct name "Fish" as specified in the configuration.

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

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

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

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

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

Sound, BaseHint and NPC type Tests

  1. TestFishHasCorrectSoundPath: Ensures the sound path for the fish is correctly set to "sounds/FishBubble.wav" in the configuration.

  2. TestFishHasCorrectBaseHint: Confirms that the base hint for the fish is set correctly, matching "Welcome to Animal Kingdom!" and "I am Finny the Fish."

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

Movement Tests

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

Visual Testing

Visual Fish Inspection