index.html#ExistingIDEapi.ning.com/files/AAHjN6ZC5txev9*3CFGXOWwT7SjfCLzWlUxQP04... · android...

11
MONKEY TALK Step by step procedure: I)Following are the step for creating emulator: 1)First of all download android SDK from this link http://developer.android.com/sdk/index.html#ExistingIDE . Go to SDK Tools and sleetc the pakage based on your system bit. II) How to install Android SDK and AVD Manager in Eclipse: 1) Step 1. Install Eclipse IDE:(if u have already downloaded then not require) http://www.eclipse.org/downloads/ 2)Open Eclipse and select help-->check for updates.(if any updates it will update if not it will show no updates). 3)click on Install new softwares..go to help-->install new softwares-->click on Add--> Name:AndroidSDK Location: https://dl-ssl.google.com/android/eclipse Click ok and it will show names below-->check those and click on next-->finish.(New pakages will install it may take 30 -40mins for installation) 4)Next you will find Android SDK and AVD Manager in windows tab 5)Click on Android SDK Manager and it will open one window check Tools,Android 4.2 and Android 2.2 (as of now for our project) and click on install ... 6)while installing it will show some popup screen click on Ok 7)Now once installation of SDK Manager done click on Android AVD Manager..go to windows-->AVD Manager-->New--> AVD Name=Android 2.2(as u wish) Device=3.2 HVGA SLider and RAM size,memory etc will enter automatically then click on OK. 8)After installing eclipse may ask for restrat.click on yes. 9)keep your application apk file in android SD ->Platformtools->Trakurmatedesign.apk (assume my apk file in my system is in path (/home/thoshi/Android/android-sdk-linux/platform-tools/Trakurmatedesign.apk) 10)clcik on AVD in eclipse -->Click on AVD created name-->start-->Launch. 11)then your emulator will open 12)Installing apk file in emulator go to sdk platform-tools folder and give this following command adb install filename.apk 13)if it ask adb command not found then go to sdk platform-tools path and enter the below command export PATH=$PATH:/path of your sdk platform-tools 14)emulator with the application is ready. III) Installing Monkey Talk Project:

Transcript of index.html#ExistingIDEapi.ning.com/files/AAHjN6ZC5txev9*3CFGXOWwT7SjfCLzWlUxQP04... · android...

MONKEY TALK Step by step procedure:

I)Following are the step for creating emulator:

1)First of all download android SDK from this link http://developer.android.com/sdk/index.html#ExistingIDE. Go to SDK Tools and sleetc the pakage based on your system bit.

II)How to install Android SDK and AVD Manager in Eclipse:

1)Step 1. Install Eclipse IDE:(if u have already downloaded then not require) http://www.eclipse.org/downloads/

2)Open Eclipse and select help-->check for updates.(if any updates it will update if not it will show no updates).

3)click on Install new softwares..go to help-->install new softwares-->click on Add--> Name:AndroidSDK Location:https://dl-ssl.google.com/android/eclipseClick ok and it will show names below-->check those and click on next-->finish.(New pakages will install it may take 30 -40mins for installation)

4)Next you will find Android SDK and AVD Manager in windows tab

5)Click on Android SDK Manager and it will open one window check Tools,Android 4.2 and Android 2.2 (as of now for our project) and click on install ...

6)while installing it will show some popup screen click on Ok

7)Now once installation of SDK Manager done click on Android AVD Manager..go to windows-->AVD Manager-->New--> AVD Name=Android 2.2(as u wish) Device=3.2 HVGA SLiderand RAM size,memory etc will enter automatically then click on OK.

8)After installing eclipse may ask for restrat.click on yes.

9)keep your application apk file in android SD ->Platformtools->Trakurmatedesign.apk(assume my apk file in my system is in path (/home/thoshi/Android/android-sdk-linux/platform-tools/Trakurmatedesign.apk)

10)clcik on AVD in eclipse -->Click on AVD created name-->start-->Launch.

11)then your emulator will open

12)Installing apk file in emulator go to sdk platform-tools folder and give this following command adb install filename.apk13)if it ask adb command not found then go to sdk platform-tools path and enter the below commandexport PATH=$PATH:/path of your sdk platform-tools

14)emulator with the application is ready.

III)Installing Monkey Talk Project:

1)Download MT Zip file form here http://www.gorillalogic.com/developer-resources/downloads Please Register and download based on ur systm bit.

2)This download contains the IDE, the Agents (which you will need for the next step), and sample applications.

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

4)open the MT IDE

5)ABOUT MT IDE:MonkeyTalk IDE consists of the main parts highlighted below.

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.

6)Creating 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.

a)Click on the Create Your First Project. The New-->MonkeyTalkProject wizard will be displayed.

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

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

d)Enter name and click on finish button(it will create with .mt extension).

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

f)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.

IV)Connecting Your App:

a)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.

b)Android Emulator:

i)Open the IDE -->Start up your Android and load it with your MonkeyTalk enabled app.

ii)Click on the connection dropdown button on the tool bar (on initial start up it will be the green

android icon).

iii)Choose "Android Emulator".iv)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. v)If connection was successful, a message to that effect should appear in the console.

V)Recording Few commands using MT:a)Make sure your device is on the same wifi network as your computer.

1. Connect to your device over the network. 2. Pull up your application on the device. 3. Click “Record” on the MonkeyTalk IDE.

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

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

e)If the "Record" button is not lighting up, it may be one of two things:1. You are not properly connected to a device. To read more on connecting to a device, go here. 2. Your application is not properly set up for MonkeyTalk.

VI)ABout MT Commands:

a)Component is the kind of UI component, for example Button or Input field. Components are platform-independent.

b)MonkeyId identifies which component of the specified Component. For example, the OK Button, or the Cancel Button. Asterisk (*) is a wildcard that matches the first component found of the specified component type.

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

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

The script above is my application script.The MonkeyTalk Script Editor displays and edits scripts in a Table View.

e)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.

VII)Playing Back a recording Monkey script:a)Restart your app. (Not essential, but useful for returning to a consistent initial state.)

b)Click the “Play” button to send the recorded commands to your app.

c)If MonkeyTalk can't find a component during playback, a command will fail.For example My Application has signup screen and it takes few seconds to process a signup request,and a script may not wait long enough before trying to tap on a button that won't be displayed until the signup action has completed.

d)Failures are logged in red to the console.

VIII)Editing the Script:

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

b)The Table View provides assistance with creating MonkeyTalk commands, and is ideal for new users.

c)The MonkeyTalk view is intended for more-experienced users and provides for editing MonkeyTalk commands directly with a text editor.

d)To edit through the table view, right click on the table and choose "Append row."

e)Click in each cell to enter your new command. You can also use the drop down menus to select from a list of options.

f)To edit through the MonkeyTalk view, switch to the MonkeyTalk tab and edit the textual commands directly.

IX)Retrying the Failed Commands:a)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.

b)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.

X)Command Syntax:

a)The syntax has been designed to be easily understood by non-programmers. It’s fairly readable and straightforward to specify manually using a simple text file editor or even a spreadsheet. Additionally, MonkeyTalk has been designed to be displayed and edited within tabular consoles such as the MonkeyTalk IDE.

b)MonkeyTalk commands are newline terminated and have the following syntax:ComponentType MonkeyId Action Args… Modifiers…

c)ComponentType, MonkeyId, Action, Args, Modifers are known as command parts.

d)ComponentType (required) – The type of component on which to perform the action. Examples include Button and TextArea. Component types are not case sensitive. ComponentTypes can extend other ComponentTypes, as described

below, and inherit any defined actions as well as Arguments. ComponentTypes are typically the logical name of the UI component (like Button rather than UIButton), but can also have platform-specific aliases. All UI components inherit from the View component type, and so specifying View on a command is like specifying a wildcard that will match any component type. For example:# Tap on any component labeled "OK"View OK Tap

e)MonkeyId (required) - An identifier that is used to distinguish between components of the same type being displayed simultaneously. MonkeyId can be specified as asterisk (*), which finds the first matching component. MonkeyId’s can also be specified as a 1-based (not zero-based) index of the form #N. In this case, the MonkeyId identifies the Nth component of the specified type that’s currently displayed. Components are indexed according to upper-left-most position, i.e., by sorting components by (x,y) coordinate.

f)Action (required) – The action to be performed. Examples include Tap, Select, Long Press, EnterText etc.Actions are not case sensitive.

g)Arguments/Args (required according to ComponentType and Action) – A space-separated list of one or more arguments. Arguments are assumed to begin at the fourth token. Although always specified as strings, args are interpreted as necessary by the command. If an Argument is required but not specified (left off the end of the list), it takes on a default value. An Arg may be specified as an asterisk (*) to force it to take on it’s default value.

h)Modifiers… (optional) - A space-separated list of named arguments of the form %name=value, where the % prefix identifies it as a Modifier. There are three system-defined modifiers:

• %timeout - how long in ms to continue retrying a command before timing out • %thinktime - how long in ms to wait before executing the command for the first time • %retrydelay - how long in ms to delay between retry attempts

XI)Steps to Integrate ANT with Monkey-Talk:

a)Apache Ant is a software tool for automating software build processes.It is implemented using Java Language.

b)To get up and running with the binary edition of Ant quickly, follow these steps:

• Make sure you have a Java environment installed

• Download ANT from the following link, http://www.windows7download.com/win7-apache-ant/download-piopxbhe.html .

• Uncompress the downloaded file into a directory.

• Set environmental variables JAVA_HOME to your Java environment, ANT_HOME to the directory you uncompressed Ant to, and add ${ANT_HOME}/bin (Unix) or %ANT_HOME%/bin (Windows) to your PATH

c)Set JAVA_HOME for Single user:

• Login to your account and open vi ~/.bash_profile file.

• Set JAVA_HOME as follows using syntax export JAVA_HOME=<path-to-java>.

for example: I set Environment varaibles based on my system paths as follows

export ANT_HOME=/home/thoshi/Workspace/ant

export JAVA_HOME=/usr/lib/jvm/java-7-oracle

export PATH=${PATH}:${ANT_HOME}/bin

• Save and close the file. Just logout and login back to see new changes. Alternatively, type the following command to activate the new path settings immediately:

• $ source ~/.bash_profile

• enter ant -version and check whether ant is installed properly or not.if it properly installed it will show ant version.

d)Copy and paste the monkey talk ANT jar file in “Monkey Talk ” folder beside .mt file.

e)Also paste the Monkey Talk ANT jar file in “Lib” folder of ANT.

f)Create .XML file

Syntax:

<?xml version="1.0" encoding="UTF-8"?> <project name="eServices - Simulator" xmlns:monkeytalk="antlib:com.gorillalogic.monkeytalk.ant"> <target name="mySuite"> <monkeytalk:run agent="android" script="C:/Users/Mindpro/Desktop/monkeytalk/MonkeyTalkIDE/workspace/eServices - Simulator/eComm For INTUIT.mts" reportdir="C:/Users/Mindpro/Desktop/monkeytalk/MonkeyTalkIDE/workspace/eServices - Simulator/Reports_Ant" thinktime="1" timeout="5000" verbose="true" /> </target> </project>

and name it as build.xml

example My build.xml file looks like below:

<?xml version="1.0" encoding="UTF-8"?>

<project name="TrackURMate" default="TestTrackURMate" xmlns:monkeytalk="antlib:com.gorillalogic.monkeytalk.ant">

<property environment="en"/>

<property name="version" value="1.0.1"/>

<property name="adb" value="/home/thoshi/Android/android-sdk-linux/platform-tools/adb"/>

<property name="host" value="localhost"/>

<path id="monkeytalk.classpath"

path="/home/thoshi/Workspace/monkeytalk/TUM/TrackURMate/libs/monkeytalk-ant-1.0.47"/>

<typedef resource="com/gorillalogic/monkeytalk/ant/antlib.xml"

uri="antlib:com.gorillalogic.monkeytalk.ant"

classpathref="monkeytalk.classpath"/>

<target name="TestTrackURMate">

<sleep milliseconds="10000"/>

<monkeytalk:run agent="androidEmulator" adb="${adb}"

script="/home/thoshi/Workspace/monkeytalk/TUM/TrackURMate/NrmlChat.mt"

host="${host}" reportdir="/home/thoshi/Workspace/monkeytalk/TUM/TrackURMate/reports" />

</target>

<target name="debug">

<property name="debug" refid="monkeytalk.classpath"/>

<echo message="debug=${debug}"/>

</target>

</project>

g)Create the above xml file in notepad and save in “.xml” format (For eg, build.xml).

h)Place your build.xml file in the folder where your monkeytalk test suite is located.

i)Go to command prompt and set the path (Path of your monkeytalk project's folder).

j)Enter “ant mySuite” in command prompt and press enter.

Note:Make sure your emulator was in initial screen based on your script starting.