Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
 
The Typist and the Engineer

Do you need to test a new piece of software or hardware? You sit there, and you type in your tests, and your check the results. It gets much more difficult when you're testing something that's multiuser and interactive; do the users interfere with each other? Does it work every time? Testing systems such as this can be time-consuming (and boring!), and it's easy to overlook errors if one set of answers is subtly different to another.

Expect (based on Tcl) allows you to automate testing such as this by using two "magic" commands - send and expect - to send a string out to the item under test, and check the response. Expect doesn't have a huge user base, but it's a lifesaver for those specialist requirements that need it.

Can you type as fast as your computer can transmit information? No - you can't - so to make testing from Expect more realistic, an option to send (-h) lets the text be send at "human" speed. You can even define the foibles of your human being if you wish, for example:

set send_human {.1 .25 2 .05 1.5}
send -h "This is a message coming out as if it was typed by a typist\n"

or

set send_human {.3 .4 0.6 .1 3}
send -h "This is a lett\b\b\b\bmessage coming out as if it was typed by an engineer\n"

In our first example, there's an average gap of 0.1 seconds between characters in words, and 0.25 between characters at the word end. The figure 2 defines the "shape", which is a measure on consistency; 2 is reasonable for a typist, a lower figure indicating a much more erratic person entering data and a higher figure giving greater consistency. The absolute minimum time between characters is 0.05 seconds, and the absolute maximum is 1.5 seconds.

Can you work out what the parameters mean for our second example, the engineer?


See also Expect - advanced training module

Please note that articles in this section of our web site were current and correct to the best of our ability when published, but by the nature of our business may go out of date quite quickly. The quoting of a price, contract term or any other information in this area of our website is NOT an offer to supply now on those terms - please check back via our main web site

Related Material

Tcl/Tk - Tcl, Tcl/Tk and Expect - General
  [4616] Still teaching Tcl in 2016? - (2016-01-06)
  [4460] Using Object Oriented Tcl and the Tk toolkit together - real life example - (2015-03-12)
  [4434] Public training courses - upcoming dates - (2015-02-21)
  [4206] Writing the perfect program in Tcl? - (2013-11-13)
  [3286] Should we cover expect and/or Tk on our public Tcl courses? - (2011-05-11)
  [3192] Tcl - Some example of HOW TO in handling data files and formats - (2011-03-04)
  [2681] Tcl - a great engineering language - (2010-03-17)
  [2504] Learning to program in ... - (2009-11-15)
  [2474] Using Tcl and Expect to automate repetitive jobs - (2009-10-24)
  [2429] Tcl scripts / processes on a web server via CGI - (2009-09-27)

Tcl/Tk - More on Expect
  [3448] Checking all the systems on a subnet, using Expect and Tk - (2011-09-18)
  [3009] Expect in Perl - a short explanation and a practical example - (2010-10-22)
  [2475] Quick easy and dangerous - automated logins via Tcl / Expect - (2009-10-24)
  [1531] Expecting a item from a list of possibles - (2008-02-04)
  [1475] Tcl/Tk - updating your display while tasks are running - (2007-12-16)
  [1411] Buffering of inputs to expect, and match order - (2007-10-27)
  [1173] Cheat Sheet / Check list for Expect maintainers - (2007-05-02)
  [435] Expect for Windows - (2005-09-04)

resource index - TclTk
Solutions centre home page

You'll find shorter technical items at The Horse's Mouth and delegate's questions answered at the Opentalk forum.

At Well House Consultants, we provide training courses on subjects such as Ruby, Lua, Perl, Python, Linux, C, C++, Tcl/Tk, Tomcat, PHP and MySQL. We're asked (and answer) many questions, and answers to those which are of general interest are published in this area of our site.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2019: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/solutions/tcl-the- ... ineer.html • PAGE BUILT: Wed Mar 28 07:47:11 2012 • BUILD SYSTEM: wizard