Expect is a TCL (ToolCommandLanguage) library that's good for driving text-based user interfaces from TCL scripts. It's used to script interaction with servers, and can be used for testing, and many other things.
The Expect Home Page: http://expect.nist.gov/
And the book "ExploringExpect??" on TheTclersWiki (http://mini.net/cgi-bin/wikit/105.html).
Expect is mentioned on pages including...