Getting Started

Jun 30, 2005 - In this manual you will learn how to install Eggplant on your ... Macintosh computer running Mac OS X and tests against other machines ... clicking, dragging, and typing. ... If you downloaded Eggplant and don't have a full trial CD, you can view ... but any machine that can run Jaguar (10.2) can run Eggplant.
2MB taille 53 téléchargements 537 vues
Eggplant: Getting Started

TM

Version 2.21

Redstone Software, Inc. Phone: (720) 890-0211, (800) 891-3486 Email comments, questions, and suggestions to: [email protected] Web Site: http://www.redstonesoftware.com Last update: 30 June 2005 © Copyright 2002–2005 Redstone Software, Inc. – All Rights Reserved Eggplant is a trademark of Redstone Software, Inc. SenseTalk is a trademark of Thoughtful Software.

Eggplant: Getting Started

Contact Information

2

Welcome to Eggplant, the only testing tool named for a vegetable!

Eggplant’s unique approach to test automation is surprisingly easy once you understand it, but because it may seem a bit odd at first, we strongly encourage you to start your journey with Eggplant on the right foot by following each of the steps below. Eggplant runs on your Macintosh. The software you are testing runs on a separate computer, called a “System-Under-Test” (SUT). Eggplant interacts with the SUT via a network, using the remote screen capabilities of a Virtual Network Computer (VNC) server running on the SUT. In this manual you will learn how to install Eggplant on your Macintosh, install a VNC server on your SUT and connect the two together. You’ll also be introduced to Eggplant scripting and write a sample script. Follow these simple steps and you’ll be ready to begin writing your own test scripts in less than an hour. Step 1.

Read the brief introduction on the next two pages describing How Eggplant Works. (2 minutes)

Step 3.

Install Eggplant on your Mac OS X system. (2 minutes)

Step 2. Step 4. Step 5. Step 6. Step 7.

Watch the Eggplant demonstration movie—this will give you a feel for Eggplant. (11 minutes) Setup VNC on a system-under-test (SUT). (10 minutes) Connect Eggplant to the SUT. (5 minutes) A Quick Tour of Eggplant. (5 minutes)

Work through the First Script tutorial. (25 minutes or less – honest!)

Eggplant: Getting Started

Getting Started

3

Eggplant performs testing and automation of networked computers. The Eggplant application runs on a Macintosh computer running Mac OS X and tests against other machines running any other operating system via an application called VNC (for Virtual Network Computer). Through VNC Eggplant can “see” the interface of the networked machine, referred to as the system-under-test or SUT.

������

���������������

�����������������

To create test scripts, you connect to a SUT and capture images of its user interface while telling Eggplant what actions to perform. By clicking on a simple toolbar in Eggplant, you can script user actions such as clicking, dragging, and typing. As you direct Eggplant to interact with the SUT, it performs the indicated actions, and at the same time, it saves the images that you select and generates a script of the actions performed. When you run the script that you have generated, Eggplant matches the images that you captured with the display of the SUT’s screen to determine where it should click, double click, drag, type, and so forth. Through this mechanism Eggplant can perform any action that a user can perform, and it does so without any special knowledge of the inner workings of the application or operating system, just like a user.

Eggplant: Getting Started

Step 1. How Eggplant Works

4

When an image referenced in the script does not appear on the screen, the test stops and is recorded as a failure.Eggplant generates log files with the result of each script run, whether or not it succeeds. When a script fails, Eggplant captures a complete screenshot and puts it in the results so that you can see the state of the SUT at the time the script failed. Eggplant is simple to use, but it is also a powerful, full-featured testing tool. Its ability to automate virtually any other system gives you the flexibility to perform tests on a variety of platforms and systems from a single machine.

Eggplant: Getting Started

Once you become familiar with how Eggplant works, you can also edit your scripts directly, using Eggplant’s powerful SenseTalk scripting language to add logic, file system interactions, log messages, and other advanced functions.

5

Well, not just any movie. It’s the getting-to-know-Eggplant ten-minutes-is-all-it-takes introduction movie. So, get some popcorn, make sure your trial CD is in the drive and view the Eggplant Demo movie. If you downloaded Eggplant and don’t have a full trial CD, you can view the movie from our web site: http://www.redstonesoftware.com/EggplantDemo

Eggplant: Getting Started

Step 2. Watch a Movie

6

System Requirements Eggplant runs on Mac OS X version 10.2 or higher. We recommend a G4 with at least 256 MB of memory, but any machine that can run Jaguar (10.2) can run Eggplant.

Installing Eggplant To install Eggplant, simply drag the Eggplant icon from the Eggplant CD (or disk image) into the Applications folder on your Macintosh. You will always have access to the Eggplant documentation through the Eggplant Help menu. If you would like to read the Eggplant documentation when Eggplant is not open, copy the Documentation folder to your hard drive. For convenient access to Eggplant it is a good idea to put a shortcut icon on the dock. To do so, drag the Eggplant icon from the Applications folder onto your dock

Starting Eggplant To start Eggplant, double click the Eggplant icon inside your Applications folder. Or, if you’ve dragged the Eggplant icon into your dock you can simply click it there. If you have never run Eggplant before it will automatically open the Connection Panel, described below. If Eggplant has previously been run on your machine, it will open any scripts or suites that were open when it was last quit.

Licensing To run Eggplant you will need to enter a license key to activate it. When Eggplant first launches it will give you the opportunity to enter a new license key. Click the “New License” button, enter your Key and User Name in the fields and press “Set”. If you don’t have a license key and would like to obtain a trial license please contact Redstone Software. Before you run Eggplant be sure to read the license agreement. By running Eggplant you are agreeing to the terms of the license agreement.

Eggplant: Getting Started

Step 3. Install Eggplant

7

Every system that Eggplant will test must have a VNC (Virtual Network Computer) server installed and running. Your Eggplant installation CD includes the latest VNC server for Mac OS X. In addition, you can find the latest recommended VNC servers for other platforms at: http://www.redstonesoftware.com/support.html#VNC We recommend the following servers be configured as described in the following sections. Operating System

VNC Server

Mac OS 9

OS9vnc

Mac OS X

OSXvnc

Windows

RealVNC 4

IBM AIX

TridiaVNC

Linux (RedHat) Sun Solaris HP/UX

Other UNIX Systems

RealVNC 4 RealVNC 4

AT&T VNC 3.3 TightVNC

Note: Be sure to visit the Redstone website listed above for the latest recommendations and download links, as well as information on any known platform-specific issues. Once you have the appropriate VNC server installed on your SUT machine, configure it as shown on the following pages for proper operation with Eggplant.

Eggplant: Getting Started

Step 4. Install VNC

8

OSXvnc

http://www.redstonesoftware.com/osxvnc/osxvnc.html Starting with version 1.4, OSXvnc includes support for Apple’s Rendezvous networking technology. On Mac OS X 10.2.x and higher, Rendezvous allows the OSXvnc server to “announce” its availability on your local network. This technology has also been built into Eggplant, allowing it to discover the Mac OS X systems on your network that are running OSXvnc. This makes getting connected easier than ever. Configuration

The recommended configuration for OSXvnc is shown in the images below.

Eggplant: Getting Started

For Mac OS X, including testing in the Classic environment, we recommend the OSXvnc server. Eggplant ships with the current release of OSXvnc, the VNC server for Mac OS X from Redstone Software, Inc. Additional information on OSXvnc is available at:

9

Once you have the server configured, we recommend that you also use the System Preferences to create a test-user account that is configured to automatically start the OSXvnc application as a Startup Item: 1. Open the System Preferences panel and click the Accounts preferences icon. 2. If you don’t already have a test-user account, create one by clicking the plus sign (+) below the account list field and filling in the user information. 3. Click the “Startup Items” tab. 4. Click the plus sign (+) below the startup-items list and locate and select the OSXvnc application.

Eggplant: Getting Started

Note: If you are running Apple Remote Desktop 2 (ARD2), it includes its own VNC server that runs on port 5900 and cannot be configured to run on another port. You can disable ARD2 on the SUT or you can run OSXvnc on port 5901 or higher. You can change the port number either by typing a new value in the “Port:” field, or just select a different value from the “Display Number:” popup and the port number will be changed automatically.

10

OS9vnc For Mac OS 9 and earlier systems only, Redstone Software offers the OS9vnc server with options set as shown below Note: When using OS9vnc you should also use the OS9vncPatches extensions. The OS9vnc server and OS9vncPatches system extensions can be downloaded using the links at http://www.redstonesoftware.com/support.html#VNC .

Note: OS9vnc requires the log to be left open while vnc is running, closing it will shutdown the program. If you don’t wish to see the log you may hide the entire application once the OS9vnc server has launched.

Eggplant: Getting Started

Configuration

11

RealVNC 4 You can run the RealVNC 4 server on Windows either as an application (App Mode) or have it launch as a system service. We recommend having it start up as a system service. We also recommend using the settings for RealVNC 4 as shown in the panels below. The settings for the Desktop are optional.

Eggplant: Getting Started

Configuration

12

RealVNC 3/TightVNC/TridiaVNC/AT&T VNC You can run these VNC servers on Windows either as an application (App Mode) or have it launch as a system service. We recommend having it start up as a system service. Once you have launched VNC, you should set the following configuration by clicking on the VNC icon in the system tray and choosing Properties.

Eggplant: Getting Started

Configuration

13

Setting up the Eggplant TCP/IP connection In order to develop and run Eggplant test scripts, you will need to connect the Eggplant system to the systemunder-test (SUT) via a TCP/IP connection. You can setup the network connection in a variety of ways; you can use any physical network interfaces which support IP such as Ethernet, Airport, or even IP-over-Firewire. For information on setting up IP-over-Firewire please contact Redstone Software. Once you have a network interface you can connect either through your existing Local Area Network (LAN) if you already have one, or if you want improved performance or isolation you can create a direct network connection between your Eggplant machine and your SUT. The next section explains how to initiate a connection to your SUT from within Eggplant. Following that are instructions for setting up a direct network connection—if that should be needed or desired—and for troubleshooting connection issues. Note: Typical VNC Response on a LAN is within 1 or 2 seconds, if you are experiencing slower response times there is probably a networking configuration problem and we highly suggest you try using the direct connect method described below.

Eggplant: Getting Started

Step 5. Connect to the SUT

14

Establish an Eggplant Connection to Your SUT In Eggplant select the “Open Connection” command in the Connection menu to open the Establish Connection panel.

Connecting via Rendezvous If your SUT is a Mac OS X computer running OSXvnc 1.4 with Rendezvous enabled (the default configuration), click the arrow to open the “Remote Host…” pulldown; you should see the display name of the SUT listed in blue. If you click the name to select it from the list, the “Remote Host…” and “Port” fields will be filled in automatically. Enter the password if you set one when you configured OSXvnc and click the “Connect” button.

Eggplant: Getting Started

Make sure the VNC server is running on your SUT.

15

Connecting to Non-Rendezvous Servers

The Port field defaults to the commonly used value of 5900. If your VNC server uses a different port number, enter it into the Port field; the Port number in the Establish Connection panel must be the same as that used by your VNC server. The OSXvnc server lists the port number directly. For all other VNC servers, you must add 5900 to the “Display Number” of the VNC server to obtain the correct port number. If you entered a password in the VNC server on the SUT, be sure to enter the exact same password in the Password field. If your VNC server is not using a password, you can leave the Password field blank. Note: Unless you know for sure that you need to connect using SSH, just leave the “Use Secure Connection (SSH)” checkbox unchecked. This is an advanced option and is only available if SSH has been configured on the SUT or another network machine. For more information see the Eggplant Reference manual. Click the Connect button. Eggplant will open the Remote Screen. The Remote Screen shows the SUT display in a window on your Mac screen. You can resize it to make room for other Eggplant windows; Eggplant will still be able to see and test the entire SUT screen even if you make the Remote Screen window smaller or hide it altogether.

Eggplant: Getting Started

Enter the SUT’s IP address or Host Name into the “Remote Host or IP” field/dropdown menu. If you’ve connected to a particular SUT before simply select its IP address from the dropdown menu and Eggplant will fill in all of the fields for you, as needed.

16

Setting Up a Direct Connection

Next, open System Preferences from the Apple menu of your Mac OS X machine and select Network. Choose the Location pull-down and select New Location. Name your new location “DirectConnect” and choose the Show pull-down and select Built-in Ethernet. Then change the Configure pull-down to Manually. Enter an IP address such as 10.0.0.1 for the Eggplant machine and 10.0.0.2 for the SUT, set the Subnet Mask to 255.255.255.0 and you don’t need any entries in the Router or DNS Servers boxes, all as shown below.

Eggplant: Getting Started

In a direct connection you will have only the Eggplant machine and the SUT on a small network connected directly together. To do this, you can use a cable connection or a wireless connection. To use a cable, connect an Ethernet cable to the built-in Ethernet ports of both the Eggplant system and the SUT.

17

When connecting to the SUT in this way you will want to use only the IP address of the SUT (10.0.0.2) from within Eggplant.

Eggplant: Getting Started

If the SUT is a Windows system, you follow the same procedure except you will open the Network Control Panel, then the Local Area Connection Properties, then select TCP/IP and choose Properties. Finally, select the “Use the following IP address:” radio button, and enter “10.0.0.2” in the “IP address:” field and the subnet mask as shown below. Click “OK” on each panel until you close the Network Control Panel.

18

Multi-homing

Multi-homing the same network interface

Launch System Preferences and go to the Network Preference Pane. In the Show pull-down menu select “Active Network Ports.” Select one of your interfaces and click on the Duplicate button just to the left of it. Now you have two of that interface. You can configure both of these as you normally would any other interface, but keep two things in mind: If you are multi-homing on the same subnet, make sure that the second IP address has a Subnet Mask of 255.255.255.255. This will ensure that you only route out on one IP address. Secondly, you need to make sure that only one of your duplicated interfaces has AppleTalk active. This also applies if you have multiple interfaces connected to the same physical network.

Eggplant: Getting Started

Often, you will need two IP connections on the SUT to attach both to Eggplant and also to the separate network (e.g. to test a Web application). Mac OS X can readily support this environment through its multihoming capability, allowing you to set up separate networks on either two different interfaces (for example one on your Built-in Ethernet Adaptor and a second network through Airport) or on the same network interface. The article below covers how to set up multi-homing on a single network interface. In both cases you will use the second network to create a direct connection as described above.

19

Troubleshooting

Solution Problem Solution

Problem Solution

Problem Solution Problem Solution

When you try to connect to a SUT using a network name, Eggplant reports “FAILED: No such host ...” The Eggplant system doesn’t know the network name you are using. You can use the Connect to Server command in the Finder/Go menu to see if the system can find that name or you can use the IP address of the machine. When you try to connect to a SUT using an IP address, Eggplant takes a long time and then reports “FAILED: Temporarily unable to connect: Operation timed out” The Eggplant system can’t “see” the IP address. Open the Network Utility and ping the IP address. If you can’t ping the IP address, then you could be using the wrong IP address or some component of the network is not configured correctly. Make sure that you aren’t running firewall software on the SUT. When you try to connect to a SUT, Eggplant reports “FAILED: Temporarily unable to connect: Connection refused” The IP connection to the SUT has been established, but Eggplant can’t connect to the VNC server on the SUT. This can be caused by not starting VNC on the SUT, by setting the VNC port numbers on Eggplant and the SUT differently, or by a firewall between the Eggplant system and the SUT. When you try to connect to a SUT, Eggplant reports “FAILED: Remote Login Failed - Password Rejected” The password in the Eggplant password field did not match the password in VNC on the SUT. Re-enter your password on BOTH Eggplant and the VNC server on the SUT. A connection has been established between Eggplant and the SUT, but screen updates are very slow in Live Mode. As a test, create a direct connection between Eggplant and the SUT. If this results in better performance, your local area network is not configured correctly.

Eggplant: Getting Started

Problem

20

Congratulations! Your Eggplant setup is now ready to use. If you are feeling impatient and want to go learn by experimenting on your own, now is the time to be adventurous. For more guidance as you begin to explore Eggplant, we suggest you continue with this brief introduction to the Eggplant interface and the tutorial that follows. Most of your Eggplant activity will take place in four types of windows: 1. Remote Screen Window 2. Script Editor Windows 3. Run Window 4. Suite Editor Windows

Eggplant: Getting Started

Step 6. A Quick Tour of Eggplant

21

Remote Screen Window

At the top of the Remote Screen are a series of command buttons you can click to interactively create scripts. Scripts let you automate the testing of software that is running on the networked computer.

Eggplant: Getting Started

Eggplant works by connecting to a second computer—called the system-under-test or SUT—and interacting with the user interface of that remote machine. The Remote Screen appears in an Eggplant window on your Mac. You can see and interact with software running on the SUT via the Remote Screen.

22

Script Editor

Scripts consist of SenseTalk commands and functions . You can create scripts by clicking the toolbar items at the top of the Remote Screen and interacting with the SUT within the Remote Screen (see above). For more information on Eggplant commands to interact with the remote system and your tests please see the Eggplant Reference Manual. For more information on script structure and generic scripting please see the SenseTalk Reference Manual.

Eggplant: Getting Started

The Script Editor lets you create and edit scripts. Scripts let you test software by simulating user action with a list of scripted steps. Each scripted step relates to a captured image of part of the user interface for the software you are testing.

23

Run Window

In debugger mode, the Run window allows you to pause a script and step through it line-by-line, watching the activity on the Remote Screen window, checking the values of variables, or running commands in the AdHoc Do-Box to experiment with the script behavior.

Eggplant: Getting Started

The Run window can show you a variety of levels of detail about the currently running script or scripts. You can see every line that is executed or just the individual calls to functions and commands. It provides oneclick access to the results of the latest script run in Suite Editor. From the “Ad-Hoc Do-Box” at the bottom of the window, you can execute any Eggplant/SenseTalk command, independent of a script.

24

Suite Editor

Scripts Tab The Scripts tab shows the contents of the Suite’s Scripts directory. Eggplant saves scripts automatically when you create them.

Images Tab The Images tab lets you browse the images in the Suite’s Images directory. Eggplant saves your images automatically as you capture them.

Eggplant: Getting Started

A Suite is a collection of testing elements. The Suite Editor lets you manage these elements including scripts, images, results, schedules and helpers.

25

Results Tab

Schedules Tab The Schedules tab lets you specify multiple scripts to run in a set sequence.

Helpers Tab The Helpers tab lets your suite access scripts and images from other suites.

Eggplant: Getting Started

The Results tab lets you view the test results from the Results directory. Eggplant saves a log and related captured images every time you run a script.

26

Testing involves starting Eggplant on your Macintosh; starting VNC on the SUT; connecting via VNC; setting up one or more Suites; creating Scripts and capturing images; running Scripts; and checking results. This tutorial assumes you have already established a connection to the SUT as described earlier in this document. The first three sections cover the general steps of creating a new suite, creating a new script, and getting familiar with the Remote Screen window. The remaining sections offer two paths: Generating a script against a Mac OS X SUT or generating a script against a Windows XP SUT.

Eggplant: Getting Started

Step 7. Eggplant Tutorial

27

Creating a Suite

Eggplant will create a directory structure for the suite and open a Suite Editor.

Eggplant: Getting Started

The first step for automating your testing is to set up a Suite. To do so, select the New Suite… command from Eggplant’s File menu or type shift-⌘-N and give your new suite a name.

28

Creating a New Script

Enter a name for your Script and click the Save button. Your new script will be added to the list in the Scripts pane and a Script Editor window will open with the name of your script in the title bar.

Eggplant: Getting Started

To create a script, click the New button on the Scripts pane in the Suite Editor, select the New Script… command from the File menu, or type Command (⌘)-N. A New Script sheet will drop down in the Suite Editor window and you will be asked to name your new script.

29

The Scripting Environment

Note: If you do not see icons in the toolbar, select “Customize Toolbar” from the Window menu. This will display a panel that allows you to customize the toolbar. From the “Show” dropdown menu select “Icon & Text”. Click the “Done” button on the customize panel when you are done making changes. To start with, the Remote Screen will be in “Live Mode.” That means you can interact with the SUT from your Mac, including clicking with your Mac’s mouse as if it were the SUT’s mouse; typing with your Mac’s keyboard as if it were the SUT’s keyboard. You can also cut and paste text between the SUT and your Mac. When you generate a basic Eggplant script, you perform the action you want to test much like you would if you were using the SUT directly. You tell Eggplant to double-click this, drag that, click this, type that. When Eggplant runs a script, it acts as a virtual user and repeats the actions you scripted. Click the first icon

, which should be labeled “Enter Capture Mode”. Three things will happen: The

icon will turn into an “Enter Live Mode” icon ; the disabled icons will become enabled; and the Remote Screen Window will dim except for a square area containing a small red cross in the middle of the screen. That light colored square is the Capture Area and it is used to capture images from the remote screen that tell Eggplant where to click, type, drag, and so forth.

Eggplant: Getting Started

Take a look at the Remote Screen Window. Along the top of the window you will see a toolbar displaying a series of icons, most of which are probably in a disabled state.

30

We know you’re a busy person and your’re anxious to get started, so for this beginning tutorial, we will be creating a an Eggplant script that just opens a panel and closes it. Once you’ve seen how Eggplant works, you can strike out on our own or you can continue with the other tutorial that is included in the download. If your SUT is a Mac OS X system, go to the next page to get started. If your SUT is a Windows system, then go to page 37 and the section called “A Windows XP Example”. If you will be running Eggplant against Unix, Linux, or some other system, you can read through either tutorial, and use it as general instructions for scripting a similar process on your SUT.

Eggplant: Getting Started

The Capture Area

31

A Mac OS X Example

Click the Apple Menu in the Remote Screen window. Click the “About This Mac” menu item. Type ⌘-W to close the “About This Mac” window. These steps make up a “use case”; use cases are the building blocks of the Eggplant testing approach. Next we’ll replicate the use case in Eggplant by creating a script that does exactly what we just did as a user. Let’s generate our script.

Creating Your First Script Our use case begins with clicking the Apple menu, so we will use the Capture Area to capture an image of the Apple menu. Click and hold the mouse button down at a point above and to the left of the Apple menu. Now drag to a point below and to right of it, as shown in the lefthand figure below. This will draw the Capture Area around the Apple menu as shown in the righthand figure:

Eggplant: Getting Started

Before you actually write a script, it’s important to know how to directly perform the task you want to test; let’s take a few seconds to walk through the steps of our example process. In this example, we are just going to open the “About this Mac” panel and then close it.

32

Note: If you want to move or resize the Capture Area, you can drag it to a new position or click and drag the corners and edges to make it bigger or smaller. With the Capture Area over the Apple menu, click on the Click toolbar item on the Remote Screen window. A save sheet will drop down from the top of the Remote Screen window, as shown below.

Eggplant: Getting Started

You don’t need to be too precise right now. Don’t worry if your Capture Area isn’t square or the Apple menu isn’t centered or you capture part of the desktop at the bottom of your image. There are some rules of thumb regarding image capture, but we don’t need to worry about them just yet.

33

Eventually you’ll want to know about all the controls on this sheet, but for now, just type “Apple menu” in the Image Name: field and click the “Save” button. At this point three things happen:

The Apple menu is now open on the SUT. Drag out the Capture Area around the “About This Mac” menu item as you did with the Apple menu. We need to generate another Click command, but let’s use a different approach: This time, doubleclick within the Capture Area—once again the Save sheet drops down in the Remote Screen window. Type “About This Mac” in the Image Name: field. Now click the popup field near the bottom of the sheet that currently says “Capture Image” and select the “Click” item. Click the Save button or press the Return key to add the command to the script. Finally, we need to close the “About This Mac” window. As specified in our use case, we’ll do this with the Command(⌘)-W keyboard shortcut. Click the Type Command toolbar item on the Remote Screen window’s toolbar. Type the letter “w” in the Enter Command: field of the Type Command sheet:

Press the Return key or click the OK button to enter the command in the script (no image is used with TypeCommand). The “About this Mac” window on the SUT should now be closed.

Eggplant: Getting Started

1. The image is saved. 2. The command ‘Click “Apple menu”’ is added to the script. 3. The click event occurs on the system-under-test, opening the Apple menu.

34

Your script should now look like this:

Position the script window and the Remote Screen window so that you can see the Apple menu and the area on the SUT where the “About This Mac” window will appear. Click the Run Script item on the Script Editor toolbar and watch the Remote Screen window carefully. Eggplant will execute the actions on the remote system; it can do this so quickly that you may not see every event in the Remote Screen window when you run the script. (A “Run” window will be displayed; if it comes up over the Remote Screen window, drag it out of the way and run the script again.) Run the script as many times as you’d like. Type Command(⌘)-1 (one) to bring the “Run” window forward (shown on the next page). In the top pane, you should see the script code; in the bottom pane, you can see the logged events and the result of the most recent run of the script (which should have been a success!) This window also provides features to help you debug your scripts.

Eggplant: Getting Started

As you can see, this reads very much like our use case; one of the nice things about Eggplant scripts is that you can usually understand what they are doing, even if don’t know anything about Eggplant itself.

35

Eggplant: Getting Started

You’ve now created and run your first Eggplant script. Using this same technique and some additional Eggplant commands and functions you can create scripts to perform almost any action on almost any system. For more information on Eggplant and scripting see the Using Eggplant, Eggplant Reference, and SenseTalk Reference manuals.

36

A Windows XP Example

Click the Start Menu in the Remote Screen window. Click the “Control Panel” menu item. Type Control-W to close the Control Panel. These steps make up a “use case”; use cases are the building blocks of the Eggplant testing approach. Next we’ll replicate the use case in Eggplant by creating a script that does exactly what we just did as a user.

Creating Your First Script Our use case begins with clicking the Start menu, so we will use the Capture Area to capture an image of the Start menu. Click and hold the mouse button down at a point above and to the left of the Start menu. Now, drag to a point below and to right of it as shown in the lefthand figure below. This will draw the Capture Area around the Start menu as shown in the righthand figure:

You don’t need to be too precise right now. Don’t worry if your Capture Area isn’t the same size as the one shown here or the Start menu isn’t centered or you capture part of the desktop at the top of your image. There are some rules of thumb regarding image capture, but we don’t need to worry about them just yet. Note: If you want to move or resize the Capture Area, you can drag it to a new position or click and drag the corners and edges to make it bigger or smaller.

Eggplant: Getting Started

Before you actually write a script, it’s important to know how to directly perform the task you want to test; let’s take a few seconds to walk through the steps of our example process. In this example, we are just going to open a control panel and then close it.

37

Eventually you’ll want to know about all the controls on this sheet, but for now, just type “Start menu” in the Image Name: field and click the “Save” button. At this point three things happen: 1. The image is saved. 2. The command ‘Click “Start Menu”’ is added to the script. 3. The click event occurs on the system-under-test, opening the Start menu.

The Start menu is now open on your Windows machine. Drag out the Capture Area over the “Control Panel” item as you did with the Start menu. We need to generate another Click command to open the control panel,

Eggplant: Getting Started

With the Capture Area positioned over the Start menu, click on the Click toolbar item on the Remote Screen Window. A save sheet will drop down from the top of the Remote Screen window, as shown below.

38

Finally, we need to close the Control Panel. As specified in our use case, we’ll do this with the Control-W keyboard shortcut. Click the Type Text toolbar item on the Remote Screen window’s toolbar, and type “\cw\C” in the Enter Text field. The “\c” represents “control down” while “\C” represents “control up.”

Press the return key or click the OK button to enter the command in the script (no image is used with TypeText). The Control Panel on the Windows system should now be closed.

Eggplant: Getting Started

but let’s use a different approach: This time doubleclick within the Capture Area—once again the save sheet drops down in the Remote Screen window. Type “Control Panel” in the Image Name: field. Now click the popup field near the bottom of the sheet that currently says “Capture Image” and select the “Click” item. Click the Save button or press the Return key to add the command to the script.

39

Your script should now look like this:

Position the script window and the Remote Screen window so that you can see the Start menu and the area on the SUT where the Control Panel will appear. Click the Run Script item on the Script Editor toolbar and watch the Remote Screen window carefully. Eggplant will execute the actions on the remote system; it can do this so quickly that you may not see every event in the Remote Screen window when you run the script. (A “Run” window will be displayed; if it comes up over the Remote Screen window, drag it out of the way and run the script again.) Run the script as many times as you’d like. Type Command(⌘)-1 (one) to bring the “Run” window forward (shown on the next page). In the top pane, you should see the script code; in the bottom pane, you can see the logged events and the result of the most recent run of the script (which should have been a success!) This window also provides features to help you debug your scripts.

Eggplant: Getting Started

As you can see, this reads very much like our use case; one of the nice things about Eggplant scripts is that you can usually understand what they are doing, even if don’t know anything about Eggplant itself.

40

Eggplant: Getting Started You have now created and run your first Eggplant script! You can use this same technique with some additional Eggplant commands and functions to create scripts that can perform almost any action on almost any system. For more information on Eggplant and scripting, consult the Using Eggplant, Eggplant Reference, and SenseTalk Reference manuals.

41