I noticed people here like to test their 100000+ words games using clicking so I decided to write this short guide that will ease their pain. Of course, there’s an official way of ChoiceScript automated testing using Randomtest or Quicktest. My way is different and includes interactions with browser.
If you write something complex and unique (I am sure you do), you need to test your creation. Testing of text-based games is a trivial task for software developer. This article contains some advices for regular writers without programming experience and for users of ChoiceScript (I think it will work with Twine or Texture too).
I’ll show you how to create your automated tests for web-based interactive fiction and text adventures using special set of tools - Seleninum. I will cover the simplest way of writing tests with the help of Selenium plugin for Firefox.
You can achieve something like this (5 minutes effort):
The same effect can be achieved using standalone version of Selenium toolset, but it won’t be that easy
0.) Install Firefox.
1.) Install Selenium IDE plugin. Go to addons.mozilla.org and press the ‘Add to Firefox’ button.
2.) After the installation process, check ‘tools’ menu: Selenium IDE field will appear.
3.) Press ‘Selenium IDE’ to launch the test suite.
#Write some tests for your game
I picked a game I found on this forum: Guenevere. This game implements different mechanics I can test (processing of user input, for example).
Fill the fields ‘Command’ and ‘Target’ in the Selenium IDE window:
You need to set ‘Command’ field to ‘open’ and ‘target’ to ‘link to your game’ like on the screenshot above. Now press the green arrow button to launch your first test.
Your first test checks the ability of your game to show its start page.
Let’s add some transitions. Press the record button (red button, top right corner). Selenium will start recording your actions. Time to play!
I am pressing random buttons, but you can plan your actions and record the most important or buggy way of playing your game. Press the red button again to stop recording.
Selenium is ready to reproduce recorded actions.
I switched the execution speed to ‘slow’ and pressed the green arrow button to perform my test:
I guess you understand that now you can actually create a test that goes through the entire game. You can write as many test cases as you want. You may notice a list of strange lines of text on the right side of the Selenium plugin window:
It’s the list where you can find every command executed by Selenium. You can add your commands by ‘recording’ them or you can add them manually.
Let’s add a command that checks the presence of a particular string on the screen:
Don’t forget to save your test:
I described the simplest way to automate testing process of your choice-based interactive fiction.
If you are brave enough to try this approach, don’t forget to leave a comment here with your feedback.
You can also find the full version of this guide in [my blog] (http://darkforestgame.blogspot.ru/2016/09/automated-testing-of-choice-based-text.html).
That’s all for now.