TweetFollow Us on Twitter

Automate your testing... with Eggplant

Volume Number: 19 (2003)
Issue Number: 9
Column Tag: Software Testing

Automate your testing... with Eggplant

Exploring a new tool for performing automatic tests

by Dave Kelly

Test Automation on the Mac - A Brief Overview

Your code has bugs in it. What? So, you don't like hearing that, eh? But it's not your fault. All software has bugs. Finding all the bugs in your software is a big job so you need all the help you can get, right?

Bug finding is an art that complements code writing. Somewhere along the way someone (probably an overworked quality engineer) figured out that time and effort could be saved by using automated testing. There are several automation tools available for testing Windows software including software from Rational, Mercury Interactive, Segue Software, and others. But, until recently there was nothing that come close for Mac OS X. In Mac OS X, the tester has had to rely only on AppleScript or Perl for test automation. It doesn't take too long to realize that although they are very powerful tools, neither AppleScript nor Perl are adequate for testing some things. GUIs and functionality that can only be accessed through the software being tested to name a few. Even the new GUI Scripting (System Events) beta software (see http://www.apple.com/applescript/GUI/) does not allow the GUI of some software to be tested. We're now going to take a look at Redstone Software's Eggplant software for testing Mac OS X software.

Redstone Software, Inc. is a subsidiary of Gresham Computing plc, which is based in Southampton, UK. Gresham Computing (GHT) is traded on the London Stock Exchange. In late 2001, Gresham Computing started work on a new product internally named Operation Screaming Eggplant. Their goal was to deliver a product with high ease-of-use for the neophyte yet still offer powerful capabilities for the experienced tester. The Mac OS X platform was chosen as the base OS for this product for two major reasons. First, they wanted to establish the product before competing in the PC marketplace where competition is much more fierce. Second, they believed that Mac OS X had the right features and extensibility to support the enterprise market.

Redstone Software, Inc. was created in early 2002 and in October of 2002 became the first company to deliver a cross-platform automation tool to the Mac OS X platform. They stuck with the code name and named their product Eggplant. Their belief is that automation products of this kind are traditionally too complex and require specialized development skills that are rarely found in testers. In addition, they also believe that very few automation projects have been successful, although there are cases where automation has worked. In these cases automation is performed for tests requiring special or repetitive computations, such as acceptance tests, where test execution and results are predictable.

It might be interesting to note that Redstone Software uses eXtreme Programming (XP). This is very apparent by their willingness to listen to and support their customers. Through this intense support of their customer's needs, they released several versions of Eggplant--the most recent on being version 1.3 in May 2003. The remainder of this article will focus on Eggplant v1.3.

The Eggplant software runs on your host Macintosh. This is the computer that controls the test. The software you are testing runs on a separate computer called the "System-Under-Test" (SUT). The SUT runs Virtual Network Computer (VNC) server software. VNC is a remote display system that allows you to view the desktop of the "server" computer on another computer anywhere on the Internet. The VNC server software could be running on another Macintosh or it could be running on a Unix or Windows computer. Eggplant is able to connect to the SUT using the VNC server software.

VNC originated from AT&T Laboratories Cambridge's development of very-thin-client ATM network computers called the Videotile (see http://www.uk.research.att.com/tile.html). The VNC viewer and server are basically software-only versions of this ATM Network Computer. VNC is free and is distributed under the terms of the GNU Public License. Eggplant incorporates VNC client software to give it full access to the SUT GUI, keyboard, and mouse using any VNC server. Any VNC client "viewer" can display the desktop of any VNC server; however, to use Eggplant you'll have to use the client that is part of Eggplant itself. VNC clients are available for every major OS including: Mac OS 9, OS X, windows 95/98/ME/2000/XP, UNIX (AIX, Solaris, HPUX), and LINUX (see http://www.uk.research.att.com/vnc/). The Redstone VNC server, OSXvnc 1.2 (see http://www.redstonesoftware.com/osxvnc/) is recommended for use with Eggplant because of fixes made that improve performance and increase stability.

The setup for running Eggplant consists of just starting up the 496KB OSXvnc application and starting the server by clicking the "Start Server" button (see figure 1). The OSXvnc application will need to remain running or the connection will be broken. You'll also want to hide the OSXvnc application before running your test.


Figure 1. OSXvnc Interface

Although the real testing happens on the SUT, the host Macintosh is where the action is. When you open Eggplant the first thing you'll want to do is connect to the SUT, if anything else just so you can see how it works. After entering your license you'll see a window that prompts you to establish a connection with a VNC server. You can connect with the IP address, port and password of the SUT. It is also possible to connect using IP over Firewire or through an SSH connection.


Figure 2. Eggplant connection window

Once the connection is established, you see the Eggplant monitor and can control the SUT. The live remote screen in Figure 3 shows the desktop of the SUT.


Figure 3. Eggplant Remote Screen viewer

At this point, the VNC viewer can only control the remote SUT and capture images. That might be useful for some things but you'll need to create a script in order to begin writing a test. You start by creating a suite. When a new suite is created, Eggplant creates a directory structure to store the scripts, images, and log files pertaining to that suite. The suite window in figure 4 is used to access all of the features of the suite.


Figure 4. Eggplant suite window

Now for the heart and soul of the Eggplant... capturing an image. Once you open a new script you're ready to start capturing. Building test scripts is dependent on being able to capture images through the viewer window. Without capturing images, there isn't much that you can do.

The viewer has two modes, Capture Mode and Live Mode. Eggplant starts out in live mode where you can see and control whatever goes on with the SUT. By selecting "Enter Capture Mode", you are able to select a rectangular section of the SUT's screen through the Eggplant viewer, along with a hot spot, represented by a red crosshair (see figure 5). The hot spot represents the point that will be clicked when the script is run. The rectangular section is the area that will be captured as a snapshot. After selecting the image and setting the crosshair to the point you want to click, you can choose between standard commands that will move the mouse and click or type text on the SUT's screen. The standard commands that can be used are Click, DoubleClick, MoveTo, Drag, Add Image, Wait, WaitFor, TypeText and TypeCommand. These pretty much cover anything you will need to do to test your software.


Figure 5. icon selected and ready to capture

After selecting your image, setting the click point, and selecting a command (example "DoubleClick"), Eggplant will add the image to the suite's set of images and add the command to the script. For this example, this line would be added to the current script window:

DoubleClick "image0001"

Meanwhile, the image is added to the suite's images as in figure 6.


Figure 6. suite images

After capturing a sequence of images/commands, you can go back and establish your initial setup conditions and run the script (or select a portion of the script to run). The viewer screen is compared to the saved image for each command and if it finds a match, the command is executed. If it fails, the failure is stored in the suite's Results log. A log is stored for each time you run the script. During execution you can also log your own results from the script.

It should be apparent that the key is having the saved image match the captured image when the script runs. Eggplant does a great job of finding the correct image on the SUT's screen, but there are certain circumstances you must be aware of. For example, if the desktop background looks like a solid background, but isn't really a solid background, then the image won't be found if it is not exactly where it was when the saved image was captured. The solution then is to make sure that the captured images are over a real "solid" background. Also, it is helpful to only capture the minimum that is required to identify the image being compared. For example, it may only be necessary to capture the text of an image, or maybe just the center portion of the image. It only needs to be enough to be identified as a unique image.

Eggplant is very forgiving when matching captured images. When images are captured, Eggplant attempts to automatically detect the right setting for color matching. In most cases it defaults to "Tolerant" which means that it will allow small variations in the color to be accepted. The "Precise" setting will look for a more exact match in the colors. Then there is the special "Pulsing" setting that allows color matching even when the color is a pulsing Mac OS X Aqua button. It's a good thing they included these color matching options so images, such as pulsing buttons, could be matched.

In Search of the "right" Automatic testing tool

It will help if you know what you're looking for in an automatic testing tool. Regrettably, there isn't much available for Mac OS X to compare with when looking for automation tools. It would still be worthwhile to know what you want the test environment to provide and what you're going to have to add to it to make it work for you. The following is a short list of "stuff" to look for in test automation software and comments about how well Eggplant does in each of the areas listed.

  • Will the test tool interfere with the software under test? The VNC server on the SUT is not very intrusive so you'll hardly even know it's there. You'll have to know your system under test well enough to know if a VNC server would have a material impact on it.

    Eggplant relies on an IP connection. If your software makes changes to network settings Eggplant's connection with the SUT could be broken. This behavior needs to be taken into account when writing scripts.

  • Can the test be controlled by scripts? Eggplant has a built in test script language called SenseTalk. SenseTalk is a HyperTalk-like language. The language is quite powerful so you should be able to do many of the things you need to do.

    The script is run on the host Macintosh (not the SUT) so all of the local commands refer to the host. For example, you can read/write to a local disk file (you might do this to record some test results or get data for a test from a file), but the file must be available to the host computer. If you need access to the SUT's files, there is an approach that may be acceptable. The workaround is to turn on file sharing on the SUT and mount the SUT's disk on the host computer.

  • Can scripts be captured or do I have to modify scripts after capturing them to make them work? Since images are an integral part of the commands it is necessary to capture the images that will be compared. You cannot just start typing without also capturing an image. Some automation tools will claim that all you have to do is capture your script and then run it and you're all set. Eggplant is really very different because you are not capturing your script as much as you are capturing images that the script will use. Even with Eggplant scripts don't write themselves (it is wishful thinking when any company claims their tools will write the scripts for you). With Eggplant, the process of writing the scripts includes creating the images that will be used to compare against when the script runs. Fortunately, this process makes it very easy to get the script up and running.

    Redstone Software makes the claims "Manual test-oriented commands allow the non-programmer to quickly create scripts. Eggplant also offers the flexible and robust SenseTalk scripting language and the ability to test multiple applications and platforms", "Eggplant interactive script development simplifies test automation" and SenseTalk scripting language provides high ease of use and powerful capabilities". Unlike other automatic software test applications, they make no claims that the script can be captured and run without modification. There will be a certain amount of script writing to get your tests up and running, but as they claim, Eggplant simplifies script development.

  • Can scripts be reused? Test scripts can call other test scripts. In this sense, "libraries" of scripts can be written to be used over and over. In addition, scripts belonging to other suites can be called by specifying them in the Helper Suites list.

  • Can scripts be scheduled to run at a certain time? The scheduler can setup a selected batch of scripts so that they will run on specific SUTs, but you are not able to set up a specific time for a script to run. You could set up a script that checked the time before it did anything though. Redstone recommends use of the cron function to schedule tests. The batch of scripts can also be "scheduled" to repeat however many times you specify.

  • Can scripts be easily printed/documented? Yes, scripts can be printed. However, images cannot be printed from the Eggplant application. The images are stored with the suite as .tiff files, and those can easily be printed if necessary. Additionally, scripts can contain comments to further document what is being done.

  • Is there a test infrastructure in place? Not completely. The test suite environment of Eggplant includes a script editor, image list (showing images included in the suite), results list, script scheduler, and Helper Suites list. Eggplant could be improved to include a better debugging environment, the ability to link test requirements to tests being run, and an expanded capability to keep track of test results.

  • Is there a mechanism in place to keep track of test status? The Results tab is actually a very nice system for keeping track of test status. Building a test logging mechanism can be a very time consuming task. Fortunately, with Eggplant you don't need to build anything, and the logging is built right into the script language. Unfortunately, there isn't a way to print the results from within the Eggplant application. But, fortunately, the file is stored as a plain text log file that can be easily printed.

  • Is there an extra cost per user? Can multiple tests be run concurrently? If you want to run multiple test streams against different SUTs at the same time, then that requires multiple licenses. The current pricing scheme for multiple licenses on a single host is as follows. The base license allows execution of one Eggplant test stream for $3400. A second test stream costs $1,700 and the third test stream adds $850. For $5,950, one system can execute three different Eggplant test streams.

    Four or more concurrent stream licenses are $425 each. A lower end Mac can easily handle three streams; higher end Macs can of course run more. What many users do is to use one Mac as an Eggplant execution system and have licenses on other machines for script development.

    The Eggplant pricing is based on the number of test streams being run with no additional charge for the number, location, or type of systems-under-test.

  • Is there any debugging capability built-in? Although there is no ability to add breakpoints, any portion of a script can be run at any time by selecting it and clicking on "Run Selection" in the script editor window.

Summary

Eggplant is a fine application. The really cool thing about it is that it can run tests on multiple platforms (all you need is the VNC server for the SUT you're testing on). Please don't think that Eggplant is for software testing only. Developers can automate the build process. System Administrators using Eggplant can automate server maintenance. Any repetitive task is a candidate for automation. This is the first really usable automatic software tool that has been available for Mac OS X. It is very depressing to hear other companies tell you "Sorry, we don't support the Mac". Well, this changes everything because now there's a tool that works with Mac OS X.

Bibliography and References

Kelly, Dave. "Software Automation and the Product Life Cycle". MacTech Magazine (formerly MacTutor) 13:10.

Cem Kaner, Jack Falk, Hung Quoc Nguyen. "Testing Computer Software". 2nd edn. New York 1999.


Dave Kelly is currently a Software Quality Engineer at EarthLink and has many years of software testing experience at EarthLink, Hewlett Packard, Symantec and Xerox. He has worked and played with the Macintosh since 1984 and was one of the founding editorial board members of MacTutor Magazine (now MacTech Magazine). You can reach him at dkelly@earthlink.net.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Embark into the frozen tundra of certain...
Chucklefish, developers of hit action-adventure sandbox game Starbound and owner of one of the cutest logos in gaming, has released their roguelike deck-builder Wildfrost. Created alongside developers Gaziter and Deadpan Games, Wildfrost will... | Read more »
MoreFun Studios has announced Season 4,...
Tension has escalated in the ever-volatile world of Arena Breakout, as your old pal Randall Fisher and bosses Fred and Perrero continue to lob insults and explosives at each other, bringing us to a new phase of warfare. Season 4, Into The Fog of... | Read more »
Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links below... | Read more »
Marvel Future Fight celebrates nine year...
Announced alongside an advertising image I can only assume was aimed squarely at myself with the prominent Deadpool and Odin featured on it, Netmarble has revealed their celebrations for the 9th anniversary of Marvel Future Fight. The Countdown... | Read more »
HoYoFair 2024 prepares to showcase over...
To say Genshin Impact took the world by storm when it was released would be an understatement. However, I think the most surprising part of the launch was just how much further it went than gaming. There have been concerts, art shows, massive... | Read more »

Price Scanner via MacPrices.net

You can save $300-$480 on a 14-inch M3 Pro/Ma...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
24-inch M1 iMacs available at Apple starting...
Apple has clearance M1 iMacs available in their Certified Refurbished store starting at $1049 and ranging up to $300 off original MSRP. Each iMac is in like-new condition and comes with Apple’s... Read more
Walmart continues to offer $699 13-inch M1 Ma...
Walmart continues to offer new Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBook for sale by... Read more
B&H has 13-inch M2 MacBook Airs with 16GB...
B&H Photo has 13″ MacBook Airs with M2 CPUs, 16GB of memory, and 256GB of storage in stock and on sale for $1099, $100 off Apple’s MSRP for this configuration. Free 1-2 day delivery is available... Read more
14-inch M3 MacBook Pro with 16GB of RAM avail...
Apple has the 14″ M3 MacBook Pro with 16GB of RAM and 1TB of storage, Certified Refurbished, available for $300 off MSRP. Each MacBook Pro features a new outer case, shipping is free, and an Apple 1-... Read more
Apple M2 Mac minis on sale for up to $150 off...
Amazon has Apple’s M2-powered Mac minis in stock and on sale for $100-$150 off MSRP, each including free delivery: – Mac mini M2/256GB SSD: $499, save $100 – Mac mini M2/512GB SSD: $699, save $100 –... Read more
Amazon is offering a $200 discount on 14-inch...
Amazon has 14-inch M3 MacBook Pros in stock and on sale for $200 off MSRP. Shipping is free. Note that Amazon’s stock tends to come and go: – 14″ M3 MacBook Pro (8GB RAM/512GB SSD): $1399.99, $200... Read more
Sunday Sale: 13-inch M3 MacBook Air for $999,...
Several Apple retailers have the new 13″ MacBook Air with an M3 CPU in stock and on sale today for only $999 in Midnight. These are the lowest prices currently available for new 13″ M3 MacBook Airs... Read more
Multiple Apple retailers are offering 13-inch...
Several Apple retailers have 13″ MacBook Airs with M2 CPUs in stock and on sale this weekend starting at only $849 in Space Gray, Silver, Starlight, and Midnight colors. These are the lowest prices... Read more
Roundup of Verizon’s April Apple iPhone Promo...
Verizon is offering a number of iPhone deals for the month of April. Switch, and open a new of service, and you can qualify for a free iPhone 15 or heavy monthly discounts on other models: – 128GB... Read more

Jobs Board

Relationship Banker - *Apple* Valley Financ...
Relationship Banker - Apple Valley Financial Center APPLE VALLEY, Minnesota **Job Description:** At Bank of America, we are guided by a common purpose to help Read more
IN6728 Optometrist- *Apple* Valley, CA- Tar...
Date: Apr 9, 2024 Brand: Target Optical Location: Apple Valley, CA, US, 92308 **Requisition ID:** 824398 At Target Optical, we help people see and look great - and Read more
Medical Assistant - Orthopedics *Apple* Hil...
Medical Assistant - Orthopedics Apple Hill York Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Now Read more
*Apple* Systems Administrator - JAMF - Activ...
…**Public Trust/Other Required:** None **Job Family:** Systems Administration **Skills:** Apple Platforms,Computer Servers,Jamf Pro **Experience:** 3 + years of Read more
Liquor Stock Clerk - S. *Apple* St. - Idaho...
Liquor Stock Clerk - S. Apple St. Boise Posting Begin Date: 2023/10/10 Posting End Date: 2024/10/14 Category: Retail Sub Category: Customer Service Work Type: Part Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.