MonkeyTalk Modifiers

上一篇 / 下一篇  2013-08-29 14:26:09 / 个人分类:MonkeyTalk

MonkeyTalk Modifiers

Posted: October 4, 2012 in AndroidAutomationMonkeytalk
Tags: 

MonkeyTalk Modifiers:

Modifiers are optional in command, you can use it when you needed.

Modifiers can be written as %name=value. Where the % prefix identifies it as a Modifier. There are various types of modifiers are available in MaonkeyTalk.

  • %timeout
  • %thinktime
  • %retrydelay
  • %ignore

1. %timeout Modifier:

%timeout Modifier is used for how long in ms to continue retrying a command before timing out.Written as %timeout=TIME_IN_MILLISECONDS.

Use of %timeout Modifier:

Button LOGIN Verify LOGIN %timeout=3000

2. %thinktime Modifier:

%thinktime Modifier is used for how long in ms to wait before executing the command for the first time.You can use this modifier to simulate human reaction time.

Written as %thinktime=TIME_IN_MILLISECONDS.

Use of %thinktime Modifier:

Button LOGOUT tap %thinktime =3000

3. %retrydelay :

%retrydelay is used for how long in ms to delay between retry attempts.

Written as %retrydelay=TIME_IN_MILLISECONDS.

Use of % retrydelay Modifier:

Button LOGOUT tap %retrydelay

4. %ignore Modifier:

%ignore modifier” can skip commands. It can also skip tests and setup/teardown on individual tests within the suite.

Use of %ignore Modifier:

Suppose you want to ignore the command then add the “%ignore=true” as argument at the end of the command.

For example: Label * Verify “Welcome, test!”  %ignore=true

If you want to ignore a Test in a test suite then use

Test Script.mt Run %ignore=true

You can use same for SetUp and TearDown.

A Simple Script. which having all these modifiers is given below:

In MonkeyTalk Form.:

Input username tap

Input username EnterText test

Input password EnterText test

Button LOGIN Verify LOGIN %timeout=3000

Button LOGIN tap %thinktime=2000

Label * Verify “Welcome, test!” %thinktime=3000

Button LOGOUT Verify LOGOUT %thinktime=3000

Button LOGOUT tap %retrydelay

Result:

17:37:31.168: Connection set to Android Emulator or Tethered Device

17:37:42.725: Started Script. Playback

17:37:42.733: Input username tap

17:37:43.455: Input username EnterText test

17:37:44.159: Input password EnterText test

17:37:44.956: Button LOGIN Verify LOGIN %timeout=3000

17:37:45.666: Button LOGIN tap %thinktime=2000

17:37:47.918: Label * Verify “Welcome, test!” %thinktime=3000

17:37:52.226: Button LOGOUT Verify LOGOUT %thinktime=3000

17:37:55.367: Button LOGOUT tap %retrydelay

17:37:56.133: Completed Script. Playback – OK

You can also view tabular form. of this Script. in below given screenshot:

</code>


TAG:

 

评分:0

我来说两句

Open Toolbar