Anda di halaman 1dari 45

I n s t a l l t h e M o n k e yT a l k I D E

1. 2. 3. 4. Download the zip file here. This download contains the IDE, the Agents (which you will need for the next step), and sample applications. Unzip it wherever you want, but remember where you put it because you'll need it later. On OS X, move the entire MonkeyTalkIDE folder into your applications folder and double click on MonkeyTalk.app to run. 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.

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. iOS Android

Installing the MonkeyTalk iOS Agent


1. 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.

Rename YourApp copy to something like YourAppMonkey.

so it looks like this:

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

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.

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

10

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

Configuring Libraries and Build Settings


1. 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

12

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

14

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

Installing the MonkeyTalk Web Agent

16

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

18

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

20

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

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 Project


A 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

23

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

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

25

26

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

28

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

29

30

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 Hardware


The 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

Android Emulator / iOS Simulator


Open the IDE Start 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.

32

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

Android and iOS Hardware


1. Open the IDE 2. 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 IDE


Connect to your device. Pull up your application on the device. Click Record on the MonkeyTalk IDE.

33

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

34

35

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

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 Commands


MonkeyTalk 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

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

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 Commands


MonkeyTalk Command Language Reference.

Playing Back a Recorded MonkeyTalk Script


Restart 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

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

41

Editing Scripts
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 Commands


MonkeyTalk 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

43

Verification in MonkeyTalk
During 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-spec http://www.gorillalogic.com/testing-tools/monkeytalk/documentation/monkeytalk-user-guide for running the tests with Ant Scripts: http://www.gorillalogic.com/testing-tools/monkeytalk/documentation/monkeytalk-userguide/ant

44

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

45

Anda mungkin juga menyukai