HATE: The Use of Tcl
HATE is written entirely in Tcl, John Ousterhout's Tool Command Language. This means that a little familiarity with Tcl is needed in order to devise test scripts or to interface Tcl to your own programs; this is not difficult to acquire. Tcl is easy to read, most of its commands being English-like. There are several reasons for the choice of Tcl.
- Tcl is a "scripting" language analogous to, say, the Unix shells:
in particular, it allows external programs to be executed by a Tcl
"script" (program) and provides facilities such as regular expressions
that make it simple to extract information from the output of external
- Tcl is available for a wide range of platforms, including all
flavours of Unix, Microsoft Windows (NT, 95, 3.1), and the Macintosh.
Carefully-written Tcl scripts can be used unchanged on all these
platforms. The Tcl interpreter is small, robust, and well-written.
- With the expect extensions, Tcl scripts are able to
control programs intended for interactive use, including those that
perform cursor addressing. For detailed information on
expect, look at Don Libes' book Exploring Expect: A
Tcl-based Toolkit for Automating Interactive Programs (O'Reilly
and Associates, 1994).
- There is a toolkit, known as Tk, that may be used from
Tcl scripts for implementing graphical user interfaces (GUIs) -- and
such GUIs are portable between platforms. On Unix, Tk GUIs have a
Motif appearance; on other systems, they match those of the native
windowing system. This makes it possible to integrate HATE-based
testing into GUIs written in Tcl, typically by means of a pull-down
- The standard of documentation on both Tcl and Tk is very good:
excellent references are John Ousterhout's Tcl and the Tk
Toolkit (Addison-Wesley, 1994) and Brent Welch's Practical
Programming in Tcl (Prentice-Hall, 1995). Note that Ousterhout's
book describes a slightly older version of Tcl/Tk, one that does not
have an image-display capability; Welch's book covers a more
up-to-date version. Extensive manual pages are available, in both
Unix man and HTML formats; you are welcome to peruse the HTML manual
pages stored at Essex.
- Tcl, Tk, and a wide range of extensions are available free of charge via the Internet, and Ousterhout has guaranteed that Tcl and Tk will remain freely available. There are also no restrictions on the incorporation of Tcl and Tk into commercial products.
A number of people have asked why HATE is not written in Java. The simple answer is that Java is not as well-suited to writing this type of program as is Tcl, and that people who are not familiar with Tcl can learn enough to be able to construct test scripts in a couple of hours. Java also lacks built-in facilities for things like regular expressions, which are useful in writing interface scripts to pre-existing programs. (Don't assume from this that I have something against Java: I haven't, and use it much of the time for low-level programming. It's just that it's not appropriate for this type of job.)