MonkeyTalk Modifiers



MonkeyTalk Modifiers

Optional commands are called Modifiers. We can use it whenever we required.

Modifiers can be written like as %name = value. Where the %prefix recognize a modifier. Various types of modifiers are shown below in Monkey Talk as provided below:-

→ %timeout

→ % retrydelay

→ %thinktime

→ %ignore

  1. Modifier %timeout:
    Before time out how long command will wait in ms before retrying or to continue. Written as like %timeout = TIME_IN_MILLISECONDS

Use of %timeout modifier as per following syntax:

Button LOGIN Verify LOGIN %timeout = 4000

  1. %thinktime Modifier:

%timeout modifier will wait before the executing the command in ms for first time on its using. We can use it to analysis the reaction time of human.

Written as % thinktime = TIME_IN_MILLISECONDS

Use of %thinktime Modifier:

Button LOGOUT tap %thinktime = 4000

  1. %retrydelay:

%retrydelay can be use for to wait and delay the retry attempts in ms mean how long it should wait and delay

can be write as %retrydelay = TIME_INMILLISECONDS

Use Of % retrydelay Modifier:

Button LOGOUT tap %retrydelay

  1. %ignore Modifier:
%ignore modifier is like a skip command. Test skip and setup and tear down on the individual test within the suites.

Use of %ignore Modifier:

Assume we like to ignore this command then add the “%ignore = true” as argument at the end of the command.

For an example → Label * Verify “Welcome, Best” %ignore = true

If we like to ignore a Test in the test sit then can use following

Test Script.mt Run %ignore = true

same for SetUp and TearDown

All above modifiers are using in the following Simple Script of Monkey Talk:

In MonkeyTalk Form:
Input user-name tap
Input user-name EnterText test1
Input password EnterText test1
Button LOGIN Verify LOGIN %timeout = 4000
Button LOGIN tap %thinktime = 3000
Label * Verify “Welcome, test!” %thinktime = 4000
Button LOGOUT Verify LOGOUT %thinktime = 4000
Button LOGOUT tap %retrydelay


Result Will be:
17:37:31.168: Connection set to Android Emulator or Tethered Device
17:37:42.725: Started Script Playback
17:37:42.733: Input user-name tap
17:37:43.455: Input user-name EnterText test1
17:37:44.159: Input password EnterText test1
17:37:44.956: Button LOGIN Verify LOGIN %timeout = 4000
17:37:45.666: Button LOGIN tap %thinktime = 3000
17:37:47.918: Label * Verify “Welcome, test1!” %thinktime = 4000
17:37:52.226: Button LOGOUT Verify LOGOUT %thinktime = 4000
17:37:55.367: Button LOGOUT tap %retrydelay
17:37:56.133: Completed Script Playback – OK - DONE

MonkeyTalk Modifiers
MonkeyTalk Modifiers






No comments:

Post a Comment

Popular Posts