Skip to content

Junit test for NPC Sprint4

Bokai Zhang edited this page Oct 17, 2022 · 2 revisions

Back to Dialogue & NPCs page

Overview

Each file written by the NPC group is tested and satisfies the format of the test and is calculated as successfully as possible into the coverage.

Test file names & path:

Path:
image image image image image image

Test plan

The tests for sprint3 focus on these 7 sections and this time I will test the code for the other functional sections we have implemented.
1.Test that the text in the dialog box loads.
2.Test whether the text of each NPC can be corresponded to.
3.Test that the text in the dialog box is loaded correctly according to the change in value.
4.Test whether items can be added to the inventory.
5.Test to see if the correct NPC has added items to the inventory.
6.Iterate for the old NPC location test. Test if the NPC is at the new location.Whether the new NPC location is in the map.
7.Test that the dialog box buttons are in the correct position.

Sprint4 Test plan:
1.Test that each NPC has been created on the map as the correct entity type.
2.Test the proper operation of the Atlas file that manages each NPC animation to ensure that the animation effect is created.
3.Test the proper operation of the Atlas file that manages each dialog animation to ensure that the dialog and its animation effects are created.

Test code

NPC Factory Test
image
Initialise all required serviceLocators and set values for them.
image
image
Create a corresponding entity for each NPC and test whether they belong to the corresponding entity type at the time of creation.
image
Test that the animated Atlas files for all NPCs are working correctly.

Dialogue Factory Test
image
Initialise all required serviceLocators and set values for them.
image image
Test that the animated Atlas file for the dialogue icons loads properly.

NPCAnimationController Test
image image
Test run Atlas files to configure the environment for testing NPC animations.
image
Test the animation of each NPC.

DialogueAnimationController Test
image
Configuring the environment for animated testing of dialogue icons.
image Test the animation of Dialogue.

GameArea Test
image
I tried to iterate for the previous test file of whether NPCs and dialogs were present on the map, in order to be able to comply with sonar's test rules. However, after trying to initialize all the required variables, he still reports that the value of the variable is null, and I'm not sure if this is a viable solution.

npc Test
image
Here I made the same attempt, but with a different test approach, in order to iterate on the previous test. But it still failed.

No test file

Display files: The functionality of these display files has been fully tested in the last sprint, even if they were not counted in the coverage.

Coverage

image
image
image
imageTests written but no coverage



Back to Dialogue & NPCs page

Author

  • Bokai Zhang
  • GitHub: hideonbush-crl
  • Discord: Bkai Z(bokai)#6469
Clone this wiki locally