There are some handy tools for automatically testing your project included in ChoiceScript: Quicktest and Randomtest. Both of these tools are useful for catching game-breaking errors and inaccessible areas of your game, but they do not check spelling or grammar and are no substitute for a pair of human eyes in that regard.
How do the tests work?
As described in the official Choice of Games documentation, these tools work slightly differently to help you debug your game. Quicktest will catch bugs Randomtest might not and vice-versa.
Randomtest automatically plays the game thousands of times, choosing options at random. By default, Randomtest runs your game 10,000 times, although this number can be adjusted before starting the test (see below).
Unlike what the name suggests, though, Randomtest isn't truly random in that it's output will be exactly the same if you run it twice in a row. This is to make it easier to confirm that you've fixed the bug you encountered. If Randomtest runs into a bug and you fix it, the next time you run Randomtest and it doesn't show the error, you can be sure you've fixed the problem.
Quicktest tries to test every #option in every *choice and both sides of every *if all at once, by creating multiple copies of itself every time it encounters a divergence in the story. In order to do this quickly, it skips lines it has already tested.
Running the tests
Both tests can be run directly in your browser. They can be found in the root of your ChoiceScript directory. Double-click
randomtest.html to launch them in your browser. Quicktest starts immediately and executes the test, while Randomtest prevents some options the you can tweak before starting.
If Quicktest and Randomtest encounter no bugs, they will display "QUICKTEST/RANDOMTEST PASSED", otherwise, they will throw and error message.
One thing to keep an eye out for, is Quicktest, which can pass with "SOME LINES UNTESTED". This means that your game contains dead code, code which is inaccessible to the player. For example:
*set leadership %+ 20 *goto big_speech *set strength %-15
Of course, although the debugging tests are useful, they will not do other things, like pick up spelling errors and typos. Sometimes there is just no substitute for a good old-fashioned play through to spot errors and pick up any issues. For testing which is a little more robust, you might want to consider using a built-in scripting technique as discussed in another Wiki article here under the heading of Local Alpha Testing System.
Note: Both tests used to be launched through the CMD prompt. This overly complex method is no longer needed.