MonkeyTalk Guide

47
Install the MonkeyTalk IDE 1. Download the zip file here . This download contains the IDE, the Agents (which you will need for the next step), and sample applications. 2. Unzip it wherever you want, but remember where you put it because you'll need it later. 3. On OS X, move the entire MonkeyTalkIDE folder into your applications folder and double click on MonkeyTalk.app to run. 4. On Windows, move the entire MonkeyTalkIDE folder into your Program Files folder and double click on MonkeyTalk.exe to run. (Note: If you choose to put MonkeyTalkIDE in your Program Files folder, you will have to choose a different location for your workspace.) How to Install the MonkeyTalk Agent If you want to jump right in to MonkeyTalk, you can try out our sample apps. You can find the apps in the samples directory of the MonkeyTalk installation zip file. These applications already have the MonkeyTalk agent installed in them, so you can just start them up and skip right to Connecting Your Device. Otherwise, if you want to set up MonkeyTalk with your own application, please continue with this step. 1

Transcript of MonkeyTalk Guide

Page 1: MonkeyTalk Guide

Instal l the MonkeyTalk IDE

1. Download the zip file here. This download contains the IDE, the Agents (which you will need for the next step), and sample applications.

2. Unzip it wherever you want, but remember where you put it because you'll need it later.

3. On OS X, move the entire MonkeyTalkIDE folder into your applications folder and double click on MonkeyTalk.app to run.

4. On Windows, move the entire MonkeyTalkIDE folder into your Program Files folder and double click on MonkeyTalk.exe to run. (Note: If you choose to put

MonkeyTalkIDE in your Program Files folder, you will have to choose a different location for your workspace.)

How to Install the MonkeyTalk AgentIf you want to jump right in to MonkeyTalk, you can try out our sample apps. You can find the apps in the samples directory of the

MonkeyTalk installation zip file. These applications already have the MonkeyTalk agent installed in them, so you can just start them

up and skip right to Connecting Your Device. Otherwise, if you want to set up MonkeyTalk with your own application, please

continue with this step.

1

Page 2: MonkeyTalk Guide

You can find the Agents in the agents folder in the MonkeyTalk installation zip file, each in their individual folders labeled. The iOS

agent in agents/ios, the Android agent in agents/android, and the Flex agent in agents/flex. Installing the MonkeyTalk

Agent is unique for each platform.

The following pages are the platform-specific agent installation instructions.

 iOSAndroid

Installing the MonkeyTalk iOS Agent1.  Download and unzip the MonkeyTalk zip file for your OS.

2.  Open your application's project in Xcode.

3. Duplicate your application's build target by right-clicking on it and selecting Duplicate from the menu. A new target will be

created called YourApp copy.

2

Page 3: MonkeyTalk Guide

Rename YourApp copy to something like YourAppMonkey.

3

Page 4: MonkeyTalk Guide

so it looks like this:

4

Page 5: MonkeyTalk Guide

 

You may also want to rename the Scheme from the Manage Schemes window:

5

Page 6: MonkeyTalk Guide

 

6

Page 7: MonkeyTalk Guide

7

Page 8: MonkeyTalk Guide

4. Add the downloaded MonkeyTalk lib to your project File > Add to “YourApp”... from the menu.

5. When the dialog box appears, navigate to the directory where you unzipped the MonkeyTalk zip file, and select the MonkeyTalk

iOS lib from pathToMonkeyTalkFolder/agents/iOS.

6. Recursively create groups for any added folders option. Note: It is up to you whether or not you want to Copy items into

destination group's folder.

8

Page 9: MonkeyTalk Guide

7. In the Add to Targets box, deselect YourApp and select YourAppMonkey.

9

Page 10: MonkeyTalk Guide

10

Page 11: MonkeyTalk Guide

8. Click Add.

9. The MonkeyTalk lib should now be visible in your project.

 

Configuring Libraries and Build Settings1. Right-click on the YourAppMonkey build target, and select the Build Phases tab.

2. On the Link Binaries With Libraries tab, you will need to add libsqlite3.dylib CFNetwork.framework and

QuartzCore.framework if your application is not already using them. (These frameworks are required by the MonkeyTalk). 

11

Page 12: MonkeyTalk Guide

12

Page 13: MonkeyTalk Guide

3. XCode will have added references to the libMonkeyTalk.a library. (Note: if you want to build iOS 4.x, make sure you change

UIKit.framework from "Required" to "Optional")

4. On the Build Settings tab, scroll down to the Linking section and add to your Other Linker Flags: -all_load -lstdc++

13

Page 14: MonkeyTalk Guide

14

Page 15: MonkeyTalk Guide

5. Choose your duplicated test target from the Scheme menu in Xcode and Run on the Simulator or Device.

Log output will show that MonkeyTalk has successfully loaded in your app (as seen below)

15

Page 16: MonkeyTalk Guide

Installing the MonkeyTalk Web Agent

16

Page 17: MonkeyTalk Guide

Actually, there is nothing to install in your app to test desktop web applications. But, before you can start testing, you first need to

download and install Mozilla Firefox web browser. In the future, MonkeyTalk will support other browsers for test playback, but

Firefox is the only browser supported for both test playback and recording.

Once you have Firefox installed:

1. Open up the MonkeyTalk IDE that you installed earlier in this tutorial

2. Create your first blank MonkeyTalk project outlined here

3. Choose FireFox from the Connections dropdown menu

17

Page 18: MonkeyTalk Guide

18

Page 19: MonkeyTalk Guide

In the console you will see the message "Connection set to Web Application" and a clean FireFox browser will automatically

launched with the MonkeyTalk Agent for Web pre-installed as a Firefox extension. You can now use this browser to record and

playback MonkeyTalk comments. Be Patient, because it can sometimes take 10-20 seconds for Firefox to launch for the first time.

19

Page 20: MonkeyTalk Guide

20

Page 21: MonkeyTalk Guide

NOTE: unlike the other agents, there is nothing you need to add or install into your web app. The Firefox browser that is launched by MonkeyTalk already has the web agent pre-installed as a Firefox extension.

MonkeyTalk IDE consists of the main parts highlighted below.

21

Page 22: MonkeyTalk Guide

Toolbar - Contains controls for connecting, recording and playing.

Editor - Displays and edits recorded scripts.

Files - Shows scripts, suites, and data files that can be run or edited.Console - Reports status and test results from running scripts.

Create a Testing ProjectA MonkeyTalk Project is a folder that contains all your test scripts, suites, and reports. A project contains the test suites for an

application. You should create separate projects for each application to be tested. 

The first time you start MonkeyTalk, the Welcome Page will be displayed.

22

Page 23: MonkeyTalk Guide

23

Page 24: MonkeyTalk Guide

Tip: You can return to the Welcome Screen by selecting Help > Welcome from the main menu.

Click on the Create Your First Project. The New Project wizard will be displayed.

 

24

Page 25: MonkeyTalk Guide

Enter a name for your project and click Finish. The workbench window will open.

 

25

Page 26: MonkeyTalk Guide

26

Page 27: MonkeyTalk Guide

 

To create a test script, right-click on the project folder and select New > Test. The MonkeyTalk test editor will open with a new

empty test.

 

 

Pick a name for your new test.

 

27

Page 28: MonkeyTalk Guide

28

Page 29: MonkeyTalk Guide

 

The script editor will open and the MonkeyTalk toolbar will be displayed.

 

29

Page 30: MonkeyTalk Guide

30

Page 31: MonkeyTalk Guide

 

Assuming you've already linked the MonkeyTalk Agent into the app you want to test, you are now ready to connect and begin

recording a test script.You can create new projects any time by selcting  the File > New MonkeyTalk Project menu option.

Connecting to Emulator, Simulator, or HardwareThe IDE communicates with the app over HTTP via a USB tether or Wi-Fi connection. You can record and play back tests against

apps running on your local computer or network, or remotely over the internet.

31

Page 32: MonkeyTalk Guide

Android Emulator / iOS SimulatorOpen the IDEStart up your Android or iOS emulator/simulator and load it with your MonkeyTalk enabled app.Click on the connection dropdown button on the tool bar (on initial start up it will be the green android icon).

Choose "Android Emulator" or "iOS Simulator", depending on your platform of choice.If you are connecting to an Android device for the first time, you will be prompted to point the MonkeyTalk IDE to your local

Android SDK. Check the "Include Android Testing?" checkbox and point it to the SDK. You can also set this in your MonkeyTalk Preferences.

If connection was successful, a message to that effect should appear in the console.

32

Page 33: MonkeyTalk Guide

Android and iOS Hardware1.Open the IDE2.Start up your Android or iOS device, connect it to your local wireless network, and load it with your MonkeyTalk enabled app.3.Click on the connection dropdown button on the tool bar (on initial start up it will be the green android icon).4.Choose "Networked Android or iOS device...".5.Enter the IP address of the mobile device.If connection was successful, a message to that effect should appear in the console.

Recording through the MonkeyTalk IDEConnect to your device.Pull up your application on the device.Click “Record” on the MonkeyTalk IDE.

33

Page 34: MonkeyTalk Guide

If the Record button is disabled, it is because you are not connected. Click the Connect button to initiate a connection.

34

Page 35: MonkeyTalk Guide

35

Page 36: MonkeyTalk Guide

Interact with your application. MonkeyTalk should record each action as a new command in the table.To stop recording, click the “Stop” button.

 

If the Record button is not lighting up, it may be one of two things:

36

Page 37: MonkeyTalk Guide

6.You are not properly connected to a device. To read more on connecting to a device, go here.Your application is not properly set up for MonkeyTalk. To read more on installing the MonkeyTalk agent and setting your app up correctly, go here.

About MonkeyTalk CommandsMonkeyTalk records each user interface action as a Command. Every MonkeyTalk Command has the same, simple format;

ComponentType MonkeyId Action Arguments...

 

ComponentType is the kind of UI component, for example Button or Input field. ComponentTypes are platform-independent.

MonkeyId identifies which component of the specified ComponentType. For example, the OK Button, or the Cancel Button.

Asterisk (*) is a wildcard that matches the first component found of the specified component type.

Action is the UI interaction, for example, Tap or EnterText.

Arguments are any additional values needed to describe the action, for example, the text to enter into an Input field.

 

37

Page 38: MonkeyTalk Guide

 

The script above is a simple login test the enters a userid and password, taps the login button, and then taps the logout button. The

MonkeyTalk Script Editor displays and edits scripts in a Table View.

You can also edit scripts using any simple text editor. Clicking on the MonkeyTalk tab in the editor will let you edit the script as text.

38

Page 39: MonkeyTalk Guide

A MonkeyTalk command is made up of the values displayed in the columns of the Table View. To specify an empty table cell in a

text command, use an asterisk (*).

Learn More About MonkeyTalk CommandsMonkeyTalk Command Language Reference.

Playing Back a Recorded MonkeyTalk ScriptRestart your app. (Not essential, but useful for returning to a consistent initial state.)Click the “Play” button to send the recorded commands to your app.

39

Page 40: MonkeyTalk Guide

If

MonkeyTalk can't find a component during playback, a command will fail. For example, in a login script, the application might

take a few seconds to process a login request, and a script may not wait long enough before trying to tap on a button that

won't be displayed until the login action has completed.Failures are logged in red to the console.

40

Page 41: MonkeyTalk Guide

Editing Scripts

41

Page 42: MonkeyTalk Guide

You can currently edit MonkeyTalk script in two different ways: through the table view and through the MonkeyTalk view. The Table

View provides assistance with creating MonkeyTalk commands, and is ideal for new users. The MonkeyTalk view is intended for

more-experienced users and provides for editing MonkeyTalk commands directly with a text editor.

7.8.To edit through the table view, right click on the table and choose "Append row." Click in each cell to enter your new command.

You can also use the drop down menus to select from a list of options.9.To edit through the MonkeyTalk view, switch to the MonkeyTalk tab and edit the textual commands directly.

 If you wish to know more about MonkeyTalk commands, you can start by reading about the Command Syntax or the User Guide entry for Playback.

Retrying Failed CommandsMonkeyTalk retries every command until it either succeeds or times out. By default, MonkeyTalk retries every command for two

seconds before failing. You can specify a timeout on a command to increase or decrease the maximum time MonkeyTalk should

retry the command before failing. 

You can increase the timeout by entering a value in the Timeout column for any command you want to retry for a longer period of

time before failing.

42

Page 43: MonkeyTalk Guide

43

Page 44: MonkeyTalk Guide

Verification in MonkeyTalkDuring script playback, MonkeyTalk verifies that each referenced UI component exists and then executes the associated action. If

an expected component doesn't exist, MonkeyTalk will report a script failure. For example, if your script attempts to tap on an OK

button, and no OK button is currently displayed, the script will fail.

Additionally, you can use MonkeyTalk's Verify commands to add explicit verification steps to your script to check that expected

values match actual ones.

For example,Perform an action through recording or editing the MonkeyTalk script.Check that the action was performed correctly with a verify. This is a very simple example, and you can do much more with creative

verifies. Suppose we have an application where the user can set a value using a Slider control, and there is an associated label that shows the selected value. The following script moves the slider to the value 8000 and then tests that the label has updated.

#set slider to 8000

Slider * Select 8000

#verify that label called "CurrentValue" displays 8000

Label CurrentValue Verify 8000

Now run the script as normal by pressing the Play button. The script's success or failure is reported in the console.

 

You can do more than just Verify for simple values. Read the Test Specification or the User Guide entry for Tests for more

information. 

http://www.gorillalogic.com/testing-tools/monkeytalk/documentation/monkeytalk-spechttp://www.gorillalogic.com/testing-tools/monkeytalk/documentation/monkeytalk-user-guidefor running the tests with Ant Scripts: http://www.gorillalogic.com/testing-tools/monkeytalk/documentation/monkeytalk-user-guide/ant

44

Page 45: MonkeyTalk Guide

Common Problems:

ERROR : Unable to send command to http://localhost:16863/fonemonkey: Connection refusedSolution : The connection is gone! try to reconnect with the emulator/device.

45