Cow Testing - UQcsse3200/2024-studio-2 GitHub Wiki
This details the tests run for the creation of a cow entity. It tests various features and ensures the correct creation of that NPC. These tests can be located in NPCFactoryTest.java
and can be located from lines 596 to 674.
Testing
testCowInitialisation
Checks the initialisation of the NPC by verifying its creation, name, type, and the presence of necessary components. This includes:
-
Verifying that the
cow
object is not null, ensuring it was created successfully. -
Checking if the cow entity has the correct name "Cow" as specified in the configuration.
-
Confirming that the cow object is of type
Entity
, verifying its inheritance or implementation. -
Ensuring the cow entity has a
PhysicsComponent
, which is necessary for physical interactions. -
Validating that the cow entity includes a
PhysicsMovementComponent
, which handles its movement physics. -
Verifying that the cow entity has a
ColliderComponent
for collision detection. -
Checking if the cow entity has a
ConfigComponent
to manage its configuration settings.
Sound, BaseHint and NPC type Tests
-
TestCowHasCorrectSoundPath
: Ensures the sound path for the cow is correctly set to "sounds/mooing-cow.wav" in the configuration. -
TestCowHasCorrectBaseHint
: Confirms that the base hint for the cow is set correctly, matching "Welcome to Animal Kingdom!" and "I am Charlie the Cow." -
TestCowIsFriendly
: Ensures the cow entity has aFriendlyNPCAnimationController
, indicating that it is a non-aggressive NPC.
Movement Tests
TestCowHasAnimation
: Validates that the cow entity has an idle animation named "float", ensuring visual representation.TestCowSetPosition
: Verifies that the cow entity is placed correctly at the specified position (0,0) and can be moved to that location.