Posts Tagged ‘action’

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

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