Inform 7 Home Page / Documentation
§2.8. The TEST command
The only way to thoroughly test a work of IF is to run a complete solution through it, and carefully check the resulting transcript of dialogue. The Skein and Transcript tools of the Inform application are provided for exactly this purpose.
All the same, most works of interactive fiction contain occasional vignettes, either in terms of short scenes of narrative, or in the behaviour of particular things or rooms, which we would like to test without the fuss of using the full story-level Skein tool. The examples in the documentation are like this: in almost every example, typing TEST ME puts the story through its paces.
Solutions or sequences for testing ("scripts") can be defined with sentences like so:
Test balloon with "get balloon / blow balloon / drop balloon".
This has no effect on the design itself, but ensures that when the story is played, typing "test balloon" will run through the given three commands in sequence, as if we had typed "get balloon" and then "blow balloon" and then "drop balloon".
The name for the test (balloon in this example) has to be a single word. Typing just "test" at the story prompt gives a list of all the test scripts known to the story. Test scripts can make use of each other, for instance:
Test all with "test balloon / test door".
One convenient way to keep track of the solution for a work being written is to include a test script at the end of each section, and to place a master test script (like "test all") at the top of the source. But different designers will prefer different approaches, and this testing system is no more than an optional convenience.
Many tests will only be sensible in given places, which may be hard to reach from the initial position; or with the aid of given things, which may be difficult to obtain. We are therefore allowed to add stipulations to test scripts:
Test balloon with "get balloon / blow balloon / drop balloon" holding the balloon.
The "... holding the balloon" means that the balloon will be transferred to the player's ownership immediately before the test script is run, unless it is already held. Similarly:
Test jam with "get jam / taste jam / eat jam" in the Kitchen.
Or we might want to say both:
Test jam with "get jam / taste jam / eat jam" in the Kitchen holding the jam.
(Single quotation marks in test scripts are interpreted the same way in test scripts as they are in other text: that is, they are sometimes read as double-quotes unless they appear to be present as apostrophes. The notation ['] forces a single quotation mark if necessary. Similarly, [/] forces a literal forward slash, and prevents the / from being read as dividing up two commands.)
Sometimes when testing it's convenient to get hold of something not easily available at the moment. The testing command "PURLOIN" does this:
The jewelled Turkish clockwork hat is in the sealed glass box.
> PURLOIN HAT
This can also make test scripts shorter, but of course it's important to make sure that people without PURLOIN powers can still play through.