ChoiceScript Wiki
Register
Advertisement

This page contains outdated information
Quicktest and Randomtest can now be launched through a browser HTML file, making the CMD prompt method needlessly complex, although the tests can still be launched this way too.

See the updated Automatically testing your game article.

There are some handy tools for automatically testing your project included in ChoiceScript: Quicktest and Randomtest. There's a fairly detailed write up on the official Choice of Games site here which I would certainly recommend you read first to give you an idea of what the tools can do.

However, the official tutorial assumes some familiarity with the cmd prompt in windows which I will attempt to explain below.

Using CMD Prompt[]

Cmdprompt

To access the cmd prompt in windows 7, the easiest way to access it is to hit the start button, and type 'cmd' into the search bar. 'cmd' should appear under programs, click on it to run it (it should appear in a little black window like above). Usually, the cmd prompt will default to the directory C:\Users\[Username] (in my case C:\Users\Kirsty).

Depending on where you have saved your project, you will have to make use of a few commands in order to locate it. If your ChoiceScript project is inside your user folder, simply use the change directory -- 'cd [foldername]' -- command to navigate to that folder. For example, in my case, my project is saved in my dropbox folder inside my user folder (named 'Kirsty'). To navigate to it from a starting prompt of 'C:\Users\Kirsty\' I would need to type the following commands (without the speech marks):

'cd dropbox' (press enter)

'cd public' (press enter)

'cd cog' (press enter)

'cd heal' (press enter)

This would take me to where the automatic tests are held (the root file of ChoiceScript). To check I was in the right place I could enter the directory command:

'dir/w' (press enter).

This would show the contents of the current directory (as shown in the above picture) where I can see the autotest.bat, quicktest.bat and the randomtest.bat.

If your ChoiceScript project is in a completely different directory to the one cmd defaults to, you can use the 'cd\' command to get to the root of your drive (and then use 'cd [directoryname]' to locate your project). If your project is on a different drive entirely, then type the drive letter followed by a colon (':') and hit enter (i.e. 'D:'). Again, use the 'cd [directoryname]' command to locate the actual directory on that drive.

Once you have located the directory containing the Autotests files, you can run autotest, quicktest or randomtest against any of your .txt scene files to check for errors.

Some useful cmd commands for using the tests include typing '|more' after your test command, before hitting enter. This pauses the screen when there are many lines resulting from the test, meaning you can identify errors easily. So for example you could type 'autotest chapter1 |more' and hit enter. Hit space to unpause the screen to see the next set of lines until all have been displayed.

Creating a CMD prompt shortcut[]

Having to do the above each time to navigate to the correct folder in cmd can be quite tiresome. However, you can create a shortcut to the correct directory to save time and keystrokes! You can do this by following this handy tutorial here

Shortcut

. To the left is an example of my own shortcut settings.

Possible Errors[]

One issue I have come across, as have others, is that the error 'java' is not recognized as an internal or external command.

There appear to be a few approaches to solving this problem, including setting the path variable in Windows to look at the correct java directory. To do this:

Select Start -> Computer -> System Properties -> Advanced system settings -> Environment Variables -> System variables -> PATH.

[ In Vista, select Start -> My Computer -> Properties -> Advanced -> Environment Variables -> System variables -> PATH. ]

[ In Windows XP, Select Start -> Control Panel -> System -> Advanced -> Environment Variables -> System variables -> PATH. ]

Prepend C:\Program Files\Java\jdk1.6.0_27\bin; to the beginning of the PATH variable (make sure this matches your own java directory).

Click OK three times.

Instructions taken from here

Other suggestions to this issue can be read here with one possible solution being that one user had issues with a 32bit version of java, but had success with a 64-bit version of java.

Related articles[]

Advertisement