| |||||||||||
Tcl/Tk Automation Posted by TkAutomate (TkAutomate), 18 October 2002 I have Tcl/Tk applications written for Windows NT that I need to be able to automate. Continuous manual testing for each release is not feasible. I currently use SilkTest for Win32 testing which works really well. However, trying to use SilkTest to record windows in Tk causes them to show up as a CustomWin with multiple TkChild tags that are the same. In other words, SilkTest can't tell the difference between the different widgets and can't be used for automated testing of the Tcl/Tk applications. I'm trying to find another program that will allow us to automate the Tcl/Tk applications. I've read that Tcl was designed to be able to embed into other applications. Would the TclHttpd Web Server be able to help me with this? Has anyone else ran across the same problems and found a solution? Any information would be greatly appreciated. thanks Posted by admin (Graham Ellis), 18 October 2002 Hi, welcome ... have you come across Expect??Expect adds three major commands to Tcl (and Expectk adds 3 major commands to Tcl/Tk): spawn to start another process send to send information to that process expect to wait unil results that match a pattern are received back In a nutshell, you can make a note of how you do something manually from a command line prompt, then write a sequence of commands like I say xxxxxx I hear back yyyyy I say zzzzzzz I hear back aaaaaa I say ddddddd I get back nothing, and time out Being program based, you can vary what's in your outgoing sequences, and you can mak decisions in your program based on what's in the incoming sequences. One of the really exciting things about Expect is that you can start off (spawn) multiple subporcesses at the same time, and then wait for input from any of them - I think this is relevant to you - and you can tell which of the processes it was that has sent you a reply. In my daily work, I'm forever plugging together and unplugging networks of computers. Rather than go all around the network testing out each machine in turn, or manually running a series of pings from one system, I have a script called "tkpingle" that runs all the pings in parallel - thus it's very fast even if a number of my machines aren't on the network and time out. Is there a parallel here to whet you're looking for?? See http://www.wellho.net/cgi-bin/net/sample.pl?which=tkpingle for a listing of this program that I describe. See http://expect.nist.gov/ for details of Expect, download links etc. See http://www.wellho.net/book/1-56592-090-2.html for details of the book on Expect by Don Libes, author of the extension. I suspect that TclHttpd would be something of a "red herring" in that it's a wev server side application and you really want to run client side Tk. A Tcletmay may help you in this, but .... ummm ... doesn sound like the best way to me from what little I know of your application. Yes, you can also embed Tcl in your own C program - best reference book if you're considering this is still John Ousterhout's original text http://www.wellho.net/book/0-201-63337-X.html. Please let me know if you would like me to post a sample 20 line program that embeds Tcl. This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |