Stendhal Quest Testing: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
imported>Kymara advanced testing |
imported>Kymara how to use more than one npc and a new section on spltting up tests |
||
| Line 305: | Line 305: | ||
==Tests with more than one NPC== |
==Tests with more than one NPC== |
||
In some quests you have to speak to more than one NPC. |
|||
''TODO'' |
|||
In that case you need to tell the quest that the NPC (the engine) changed. Remember you need to set them up with a |
|||
new TODO_NPC().configureZone(zone, null); |
|||
line for each NPC. |
|||
The easiest way to make this work is like this: |
|||
<source lang = "java"> |
|||
// says Bye to first NPC |
|||
en.step(player, "bye Carmen"); |
|||
assertEquals("Bye - nice to meet you!", getReply(npc)); |
|||
// add these two lines to change to the next NPC |
|||
npc = SingletonRepository.getNPCList().get("Nishiya"); |
|||
en = npc.getEngine(); |
|||
en.step(player, "hi Nishiya"); |
|||
assertEquals("Hello", getReply(npc)); |
|||
</source> |
|||
Now the variables ''en'' and ''npc'' are associated with the new NPC. |
|||
==Advanced testing: more than dialog== |
==Advanced testing: more than dialog== |
||
| Line 340: | Line 362: | ||
</source> |
</source> |
||
and you can do other checks on the value of the quest slot, throughout. |
and you can do other checks on the value of the quest slot, throughout. |
||
==Advanced Testing: breaking up into several small tests== |
|||
Splitting up the test means making several mini tests inside the file. So far we just have one huge block: |
|||
<source lang = "java"> |
|||
@Test |
|||
public void testQuest() { |
|||
</source> |
|||
If your quest has several stages it could be a good idea to split the test for readability. Or, when it has several NPCs, we often start a new mini test inside the file for each NPC. |
|||
{{TODO|use e.g. Take Gold For Grafindle as an example}} |
|||
== Trouble shooting == |
== Trouble shooting == |
||
===ChatTestCreator=== |
===ChatTestCreator=== |
||