Stendhal Quest Testing: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
imported>MartinFuchs |
imported>Tigertoes mNo edit summary |
||
| (33 intermediate revisions by 5 users not shown) | |||
| Line 12: | Line 12: | ||
* if it's not repeatable, try to come back and ask for a quest again anyway! |
* if it's not repeatable, try to come back and ask for a quest again anyway! |
||
Some quests have already got a test written for them because chat logs have been provided. Please take a look at the report from [http://stendhalgame.org/hudson/job/stendhal_HEAD/lastStableBuild/cobertura/games_stendhal_server_maps_quests/? |
Some quests have already got a test written for them because chat logs have been provided. Please take a look at the report from [http://stendhalgame.org/hudson/job/stendhal_HEAD/lastStableBuild/cobertura/games_stendhal_server_maps_quests/? Jenkins] - quests which are all or mostly green are done, and quests which are all or mostly red need a chatlog provided. |
||
'''Tip:''' If you test on a [[Host_a_Stendhal_Server|local server]], you can use the <code>/teleportto ''npc''</code> command to travel faster. See the [[Stendhal:Administration|administration page]] for other useful commands. |
|||
== Run ChatTestCreator == |
== Run ChatTestCreator == |
||
Once you have the chatlog you can use games.stendhal.tools.test.ChatTestCreator to make a test. We assume you are using eclipse. First, copy the chat log into the project folder of your Stendhal project. For this tutorial we are using [[File:Test Gamechat.log]] - save it and rename it to gamechat.log like your own chatlogs would be, if you want to follow the tutorial exactly. |
Once you have the chatlog you can use <code>games.stendhal.tools.test.ChatTestCreator</code> to make a test. We assume you are using eclipse. First, copy the chat log into the project folder of your Stendhal project. For this tutorial we are using [[File:Test Gamechat.log]] - save it and rename it to gamechat.log like your own chatlogs would be, if you want to follow the tutorial exactly. |
||
Next make sure the character who made the chatlog is added to the list of testers. |
Next make sure the character who made the chatlog is added to the list of testers. |
||
Open src/games/stendhal/tools.test/LineAnalyser.java and add your name to <code>playerNames</code>. |
Open <code>src/games/stendhal/tools.test/LineAnalyser.java</code> and add your name to <code>playerNames</code>. |
||
Open src/games/stendhal/tools.test/ChatTestCreator.java in the editor in Eclipse then go to the green arrow button for running an application. |
Open <code>src/games/stendhal/tools.test/ChatTestCreator.java</code> in the editor in Eclipse then go to the green arrow button for running an application. |
||
Run Configurations ... |
Run Configurations ... |
||
Arguments tab |
Arguments tab |
||
| Line 37: | Line 39: | ||
and it will be plain with no coloured highlighting. |
and it will be plain with no coloured highlighting. |
||
Copy and paste all that text into a new file which you should save in <code>tests/games/stendhal/server/maps/quests/</code>. Call it the same name as the class file for your Quest, with 'Test' at the end. We are testing <code>RainbowBeans.java</code>, so we name the file, <code>RainbowBeansTest.java</code>. |
|||
== Get the test to compile== |
== Get the test to compile== |
||
| Line 98: | Line 100: | ||
===ZONE_NAME=== |
===ZONE_NAME=== |
||
You |
You can replace the default zone name "admin_test" by the zone, in which the quest actually happens. You can get this name just by looking in the display of the game client while playing the quest. Using the correct zone name is important if there is a teleport etc in the zone, which is used in the quest. |
||
Now the errors should be gone: |
Now the errors should be gone: |
||
| Line 414: | Line 416: | ||
at utilities.PlayerTestHelper.equipWithMoney(PlayerTestHelper.java:190) |
at utilities.PlayerTestHelper.equipWithMoney(PlayerTestHelper.java:190) |
||
Solution: put the stendhal project folder on your classpath for running tests |
Solution: put the stendhal project folder on your classpath for running tests - for Eclipse users see [[Stendhal on Eclipse#Running_JUnit_Tests_in_Eclipse|Running JUnit Tests in Eclipse]]. |
||