Junit test for NPC - UQdeco2800/2022-studio-2 GitHub Wiki

Back to Dialogue & NPCs page

Overview

To test whether the npc we created met our requirements, we created a series of tests for it to help us confirm its accuracy. All the test classes are written in the EntityTest.java file.

Test plan

1.Test whether each NPC is present on the map.
2.Test that all NPCs are located within the specified range.

Test code

image
Start testing with the existing Junit5 test format

image
Determine if Guard exists by determining where it is on the map.

For the remaining MaleCitizen, Child, PlumberFriend, HumanGuard and OneLegGirl I used the same method to test if it was present on the map. image image image

Test if the npc's position is between 0 and 20 by iterating over the location on the map, using the from, to method. image

Back to Dialogue & NPCs page

Author

  • Bokai Zhang
  • GitHub: hideonbush-crl
  • Discord: Bkai Z#6469
  • File change: EntityTest.java
⚠️ **GitHub.com Fallback** ⚠️