oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

Network Test Automation with Mac OS X and Tcl

by Michael J. Norton

Your company has just invented the hottest new web server to hit the market. You created a killer test plan in Adobe Illustrator with breathtaking diagrams of your test network environment on Macintosh G4 running Mac OS X. Wouldn't it be great if you could run tests from your Mac too? Well ... you can!

If you haven't been introduced already, the Tool Command Language, Tcl, is a secret weapon used by large network hardware corporations to test their devices. It's an extremely flexible scripting language that has been ported to nearly every operating system in existence, and that now includes Mac OS X.

As wonderful as it is, Tcl isn't perfect all by itself. That's why I'm also going to discuss Expect, which is an extension of Tcl that allows interactive automation to your Tcl scripts. For instance, using Expect you can automate telnet sessions, database queries, and file transfers.

For some reason, Apple didn't include Expect in its operating system release. Not to worry, Expect has been ported to Mac OS X, and I'll walk you through the install of this handy extension.

Utilities that you will need

Related Reading

Learning the vi EditorLearning the vi Editor
By Linda Lamb & Arnold Robbins
Table of Contents
Sample Chapter
Full Description
Read Online -- Safari

First I'll introduce you to a few utilities that I recommend you install on your test network workstation. Nearly everything is available on the Net -- most of it from those diligent code porters involved with the open-source project.

With the current economic trends, your manager will be pleased to know that you set up an awesome workstation using mainly open-source applications. The focus here is creating an automated test environment running on Mac OS X. However, the same concepts will apply to any Unix workstation -- thanks, again, to open-source efforts.

Rootless X on Mac OS X

Figure 1. XFree86 running in rootless mode on Mac OS X desktop. (click on graphic for larger image)

To begin, I recommend that you install Rootless X.

Torrey Lyons has released a rootless version of XFree86 for Mac OS X. I provided installation instructions for X on X in a previous O'Reilly article, Installing XFree86 on Mac OS X . Torrey's rootless XFree86 is available from (X on X). XFree86 will soon become indispensable as you put together your test automation system. The fact that your Mac OS X machine is running rootless allows you to run the XFree86 desktop and the Mac OS X desktop in the same window. Prior to this, you were required to toggle between the two desktop environments. See Figure 1.

The examples listed later in this article will also run in the Mac OS X console window utility. But in my opinion, life is a lot easier using the X Windows environment with multiple terminal windows opened. This feature comes in handy when you're testing multiple network devices simultaneously, such as in a network system test environment.

Emacs on Aqua

Many editors are now available for Unix environments; the two most prevalent are vi and emacs. The Emacs-on-Aqua utility is a complementary tool to run with the rootless XFree86 environment. The Emacs utility executes in Mac OS X environment but allows you to easily edit files in the Darwin file system.


Emacs running native under Mac OS X environment

Figure 2. Emacs running native under Mac OS X environment.

Emacs contains most of the features you will require for editing programs in the Darwin environment. But Emacs can be difficult to use. The hidden keystroke commands are particularly annoying. For example, you must use control (^)x^s to save a file. The Aqua-on-Emacs port does, however, provide a nice menu bar to assist you if you're not familiar with the editing environment.

Pages: 1, 2, 3, 4

Next Pagearrow