Archive for the ‘Android’ Category

MonkeyTalk all Actions/methods  with their Description and Examples:

MonkeyTalk Action Description Example for android
Device Rotate This method is used for Change the device orientation.
Android:Landscape,Portrait
Ios:Left,Right
Device *  Rotate Landscape
Back iOS: Pops the current UINavigationItem (if there is one)
Android: Presses the hardware device key
Device *  back
forward iOS: Pushes the next UINavigationItem, if there is one
Android: ignored.
N/A on Android.
search iOS: ignored.
Android: Presses the device search key.
Device *  Search
Screenshot This method is used to create screenshot folder in running project and we can capture screenshot at any point Device *  Screenshot
Menu Android: Presses the device menu key.
iOS: ignored
Device * Menu
Shake This method is used for specific apps.  Device * Shake
Get This method returns “iOS” or “Android”. Device * Get a
Table Select This method is used to select an element from the table. Table * Select Boron
SelectRow Select a row.
row – the row to select
section – the section containing the row. (Ignored on Android).
Where row and section are arguments.
ScrollToRow(by row) Scroll to a row by row number.
Row – the row to select
section – the section containing the row. (Ignored on Android).
Where row and section are arguments and both args should be integer.
ScrollToRow(by Value) Scroll to a row by value.
value (int)- the value of the row to scroll to.
SetEditing Enable/disable table editing. iOS: Enabled editing mode for table. Android: ignored. N/A on Android.
Insert Insert a row into the table. iOS: Inserts a row. Android: Ignored. N/A on Android.
Remove Remove a row from the table.  iOS: Deletes the row. Android: Ignored. N/A on Android.
Move Move a row. iOS: Moves a row. Android: Ignored N/A on Android.
SelectIndex Selects an item by index. Table * SelectIndex 3
Where 3 is item no i.e index and index should be integer.
LongSelectIndex Long press an item by index. Table * LongSelectIndex 4
Where 4 is item no i.e index and index should be integer.
View verify Verifies that a property of the component has some expected value.If  Expected value is null then it  verifies the existence of the component. Syntax: ComponentType MonkeyId  Verify arg
where for argument pass expected value for verification and componenttype can be any component of monkeytalk like label,button,tabbar etc.
Example: Label #1 Verify “Welcome, test!” %thinktime=8000
Label LOGOUT Verify LOGOUT %thinktime=3000
or
View  LOGOUT Verify LOGOUT %thinktime=3000
verifyNot Verifies that a property of the component does not have some value.If  Expected value is null then it  verifies the non-existence of the component. ComponentType MonkeyId  VerifyNot arg
Label LOGOUT VerifyNot Login %thinktime=3000
or
View LOGOUT VerifyNot Login %thinktime=3000
verifyRegex Verifies that a property of the component matches some regular expression.
verifyNotRegex Verifies that a property of the component does not have a value matching a regular expression
verifyWildcard  Verifies that a property of the component does have a value matching some wildcard expression
verifyNotWildcard  Verifies that a property of the component does not have a value matching some wildcard expression
Get Retrieves a property value from the component Syntax: ComponentType MonkeyId Get Variable PropPath
Example: Button LOGIN Get b :text
Label #1 Get a
Tap Taps on the component. On Android, plays a “click”. On iOS, plays a TouchDown/TouchMove/TouchUp sequence. Button LOGOUT Tap
Swipe Swipe(scroll)  the component in direction Left, Right, Up, or Down (case insensitive) WebView webview swipe Down
Table * Swipe Up
Slider * Swipe Right
Drag Touch down, drag across the component, then up Input username Drag 43 154 181 162
where 43 and 154 are x1,y1 i.e starting cordinates and 181 & 162 are x2,y2  i.e ending cordinates.
TouchDown Start touching the component. Input username TouchDown 43 154
where 43 and 154 are x and y cordinates of touch and x,y should be integer.
TouchMove Drag across the component.
one or more (x,y) coordinate pairs specifying the path of the drag gesture
Input username TouchMove 146 170
TouchUp Stop touching the component Input username TouchUp 43 154
where 43 and 154 are x and y cordinates of touch where touch is released and x,y should be integer.
Pinch Pinch the component.
scale – The scale factor relative to the points of the two touches in screen coordinates
velocity – The velocity of the pinch in scale factor per second (read-only)
Exec Call a method on a component. The method must take zero or more String arguments and return a String result. Not implemented yet by gorilla logics.
LongPress Performs a long press on the component. On Android, plays a “longClick”. On iOS, plays a longPush gesture View LOGOUT  LongPress
Button LOGIN  LongPress
ButtonSelector Select Select an item by value. ButtonSelector forms_radios select A
SelectIndex Selects an item by index.
LongSelectIndex Long press an item by index.
Input EnterText Enter text into the input field.
text – the text to enter
hitDone – iOS: if true, hit Done key after entering text. Android: ignored.
Where text and hitdone are arguments of entertext action.
Input username EnterText test
Clear Clear text from the input field Input username Clear
Script Run Run the script with the given args. Script test1.mt Run john “my password” %thinktime=3000
RunWith Run the script with the given CSV file. Script datdriven.mt RunWith credentials.csv
Slider Select Select a numeric component value Slider forms_slider_bar Select 52 %thinktime=3000
TabBar Select Select an item by value. TabBar * Select hierarchy %thinktime=1000
SelectIndex Selects an item by index. TabBar * SelectIndex 2 %thinktime=5000
LongSelectIndex Long press an item by index.
Vars Define Define the named variables used in the script. Vars * Define user pass
CheckBox On This action sets or returns the checked state of a checkbox. CheckBox forms_checkbox on
Off This action sets or returns the Unchecked state of a checkbox. CheckBox forms_checkbox off
ItemSelector Select Select an item by value. ItemSelector * Select Carbon
SelectIndex Selects an item by index. ItemSelector * SelectIndex 8
LongSelectIndex Long press an item by index. ItemSelector * LongSelectIndex 8
Button Tap Taps(click) on the Button. On Android, plays a “click”. On iOS, plays a TouchDown/TouchMove/TouchUp sequence. Button LOGOUT Tap
DatePicker EnteDate Change the current date value.
A date with the format YYYY-MM-DD where YYYY is the year, MM is the month (01-12), and DD is the day (01-31).
NumericSelector select Select a numeric component value
RatingBar select Select a numeric component value
Scroller scroll Scroll to the specified coordinates.
x – the x-coordinate (horizontal)
y – the y-coordinate (vertical)
TextArea EnterText Enter text into the input field.
text – the text to enter
hitDone – iOS: if true, hit Done key after entering text. Android: ignored.
Where text and hitdone are arguments of entertext action.
TextArea * enterText “This is a textarea”
Clear Clear text from the input field TextArea * Clear
ToolBar SelectIndex Selects an item by index.
LongSelectIndex Long press an item by index.
VideoPlayer Play Play the video from the current playback point.
Pause Stop the video at the current playback point
Stop Stop the video and set playback to the starting point.
Menu Select Select an item by value. Menu * select About
Verify Menu * Verify About
SelectIndex Selects an item by index.
LongSelectIndex Long press an item by index.
Doc vars Document the named variables used in the script.
script Document the script itself.
Label All methods of view are applicable on label. Label #1 Verify “Welcome, test!”
Label LOGOUT VerifyNot LOGIN
Setup Run Run the setup script with the given args. SetUp login.mt run john “my password”
RunWith Data-drive the setup script with the given CSV data file. SetUp login.mt runwith cre.csv
(where the first arg is the data file filename )
Teardown Run Run the teardown script with the given args TearDown logout.mt run
RunWith Data-drive the teardown script with the given CSV data file. TearDown logout.mt runwith logout.csv
Test Run Run the test script with the given args. Test testcase1.mt run
RunWith Data-drive the test script with the given CSV data file. Test testcase1.mt runwith login.csv
Toggle On Enabled the switch on. Toggle MonkeyId On
Off Disabled the switch. Toggle MonkeyId Off

MonkeyTalk Test Suite:

MonkeyTalk Test Suite is a file with extension .mts in which you can manage the number of scripts. You can use SetUp, TearDown and Test commands in test suites. A test suite can only contain three types of commands.

Test is a script which runs as part of test suite.

Setup-A script to run before each test in the script.

TearDown – A script to run after each test in the script.

Steps to create Test Suite:

  • Right click on Project.
  • Select new.
  • Then Select Test Suite.

Scripts which you want to run through testsuite should have extension .mt.

Test Suite Must contains at least one Script.

Advantage:

We can Run no of scripts in one go and Screenshots are captured and stored in screenshot folder under project in report folder for failures automatically.

Test suites output the standard XML report, making MonkeyTalk easy to integrate into existing systems.

Results:

The results are displayed in the JUnit panel at the bottom of the screen.

You can also view Results from Test Xml file under project in report folder.

List of MonkeyTalk Component Types:

MonkeyTalk Android IOS
Device Device Device
Table ListView UITableView
View View View
ButtonSelector RadioGroup UISegmentedControl
Input EditText UITextField
Script
Slider SeekBar UISlider
TabBar TabHost UITabBar
Vars
CheckBox CheckBox UISwitch
ItemSelector Spinner UIPicker
Button Button UIButton
DatePicker DatePicker UIDatePicker
NumericSelector
RatingBar Slider RatingBar
Scroller Scroller UIScrollView
TextArea TextView UITextView
ToolBar ActionBar UIToolBar
VideoPlayer VideoView MPMoviePlayerController
Menu Menu TabBar
Doc
Label TextView UILabel
Setup
Teardown
Test
Toggle ToggleButton UISwitch

Test Cases For Games Apps:

 

Mobile Game Testing
Check for background music
and sound effects
ON/OFF sound & background music
Receive the call and check
Verify if sound effects are in sync with action
ON/OFF device sound(native sound) and check
Check for vibration effect if present
User Interface Check in Landscape/Portrait mode
Check for animation, movement of character, graphics, Zoom In/Out (all gestures) etc
There should not be any clipping (cutted background)
Test whether one object overlaps with another
Verify if loading indicator is displayed wherever required
Character should not move out of the screen/specified area
Test for enable and disable images/icons/buttons etc
Check for screen title
Check for message title, message description, label (should be appropriate)
Check scrolling
Font displayed (color, size etc)
Check other objects too (ex -if its a car race- you need to look at road, people, other objects like buildings etc)
Performance Check the loading time of a game
Make sure that any action is not taking considerable time, game flow should be fast
Score score calculation
Verify leaderboards General/All time/Weekly/local etc
Check the score registration functionality
Check the format (whether, comma is required in score etc ideally if customer is a foriegner coma should be in millions not in thousands )
Check for level completion syncs with the score
Time Out Check for time out
Do the actions when time-out yet to happen
Multitasking Switch b/w different apps and play game , check for sound, score, UI, time-out etc
Pause Check if game is paused when call received or multitasking or sleep mode
Save Settings Turnoff and ON device, check if settings are saved
Log out /On , check same
User should not loose his game in above conditions
User profile Put a all types of images in Player profile and check
Put special character, numbers,space in username and check
Password should be in masked
Chat feature Check the profile images
max limit of chat description
Enter empty string, special character and check
For a opponent , there should be a notification that he has received a message
Functionality Check game area, game logic
play till last level
get the cheat codes from development team and check all the levels
Check for the features that will be unlocked level-wise
Check for bonus score
Check the score hike when level gets increased
Check for multi-tap action (example in a car race we hold accelerator and left/right turn button simultaneously)
Menu options
Different game modes/location
Help & About Screen Should be in easily understandable format
free from spelling mistakes
URL should be hyperlinked (depends)
Multiplayer game Session expiry check
login/log out
Registration (Sign Up)
Verify account (receive verification mail)
login with registered but not verified account (without clicking verification link)
Forgot password checks (many cases here)
Game flow
Check for WIN/lost/Draw
Check user statistics graph
Challenge/Decline challenge/receive challenge
Check for forfeit
Check when player 2’s turn is on Player 1 is not able to do actions (should not be able to forfeit also)
Check for pass turn
Check for time-out (for one player)
Check the score for both the players till game ends
Memory leak Check the game when device memory is low
Network (n/w) check N/w messages if n/w is not present
check if what happens when n/w not present and user plays a move (whether score submitted for that move etc)
Check for localization Should be Support of different languages
Check for time format Change the device time , format etc
Size User wont like if your game takes lot of device space, so keep one eye on game file size
Device , OS Check in supported screen sizes and os versions (basicaly depend upon Client requirement)
Depends on platform Sometime we need to check as per OS guidliness as well. For ex in Wp7 we need to check in 2 background (light/dark).
Check Share options Post score via mail/FB/Twitter
Check the posted/sent messages in FB/Twitter/Mail. Check links are hyperlinked and application icon is displayed in
the post (depends)
If twitter integration is a manual ( custom UI developed by developer), check what happens when u enter more than
140 chars (as twitter limit is 140)
Music playing during app
launche
If music player running and we start installing any game app, music player should pauses without prompting for the user permission.
Steps for checking this:
1. Play a music file.
2. Launch the application.
3. Verify that while the application loads, it does not pause, resume or stop the actively playing music.
Interuption If app(game) is in running mode, then Check the behaviour of interuption like like Bluetooth, Infra red and CALL/SMS/MMS.
Upgrade the game
/ Battery effect
Upgrade of Games to the latest version and while migration all data should persist [ score, user profile etc ]
What if Battery goes down/switched of the cell while playing, Wheter the score wil get saved?

Data Driven Script:

In MonkeyTalk you can use/create the Data Driven Script by using RunWith action and three files are required for Data Driven Script.

1. Main file– Its extension is .mt.In this main script is written.

datadriven.mt

Vars * Define user pass
Input username tap
Input username EnterText ${user}
Input password EnterText ${pass}
Button LOGIN Verify LOGIN %thinktime=1000
Button LOGIN tap
Label * Verify “Welcome, ${user}!” %thinktime=3000
Button LOGOUT VerifyNot LOGIN
Button LOGOUT tap %thinktime=5000

you can view tabular form of Tabular form datadriven.mt script:

 

2. Driver script: Its extension is .mt. This script is use to run the main file.

Script datdriven.mt RunWith credentials.csv

you can view tabular form of Tabular form Driver script:

3. CSV File:Its extension is .csv.

You can create csv file in your MonkeyTalk project by following below mentioned steps :

Right click on project folder

new >>other >>Click on General >>choose file >> give a name with extension .csv

Now  in this file give values for variables which you are defined in main file/script. In first row of this file mention variables name separated by space which you have define in main file.

user pass
joew,sword1
jyoti,password1
charlie,test

you can view tabular form of Tabular form csv file:

MonkeyTalk Parameterized script:

Passing variable values through driver script. Value for variables can be passed as arguments in a driver script. The only requirement is that they should be provided in the same order as they are declared. We have two scripts here one is the main code (driven) script and the driver script.

In MonkeyTalk form:

# Driven script (test1.mt)

Vars * Define paswords user

Input username EnterText ${user}

Input password EnterText ${pass}

Button LOGIN Tap %thinktime=500

Button LOGOUT Tap %thinktime=3000

You can view the tabular form of driven (test1.mt) script which i have created:

# Driver Script

Script test1.mt Run john “mypassword”

Script test1.mt Run john1 “mypassword1” %thinktime=3000

Driver script in tabular form:

Parametrized script by using default  values:

# default.mt

Vars * Define username=Jyoti  password=test

Input username EnterText ${username}

Input password EnterText ${password}

Button LOGIN Tap %thinktime=3000

Label * Verify “Welcome, ${username}!” %thinktime=3000

 Result:

17:03:44.664: Started Script Playback

17:03:44.673: Vars * Define username=Jyoti pw=test

17:03:44.681: Input username EnterText jyoti

17:03:45.340: Input password EnterText test

17:03:46.004: Button LOGIN Tap %thinktime=3000

17:03:49.180: Label * Verify “Welcome, fred!” %thinktime=3000

17:03:53.327: Completed Script Playback – OK

when we send the parameters through driver script

Script default.mt Run pooja

In this case username argument will take pooja and password argument takes default value i.e. test

 Result:

17:09:05.839: Started Script Playback

17:09:05.843: Script default.mt Run pooja

17:09:05.848: Started Script Playback

17:09:05.851: Vars * Define usr=jyoti pw=test

17:09:05.855: Input username EnterText pooja

17:09:06.614: Input password EnterText test

17:09:07.088: Button LOGOUT tap %thinktime=3000

17:09:07.297: Button LOGIN Tap %thinktime=3000

17:09:10.543: Label * Verify “Welcome, pooja!” %thinktime=3000

17:09:11.158: Completed Script Playback – OK