MonkeyTalk Parameterized script

Posted: September 18, 2012 in Android, Automation, Monkeytalk
Tags: , , ,

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 (

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 ( script which i have created:

# Driver Script

Script Run john “mypassword”

Script Run john1 “mypassword1” %thinktime=3000

Driver script in tabular form:

Parametrized script by using default  values:


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


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 Run pooja

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


17:09:05.839: Started Script Playback

17:09:05.843: Script 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

  1. prabhusrinivasan says:

    i created as like two .mt files and if i click runas it showing alert as “No recent launches”.While right clicking on run as its not showing any option blankly showing run configuration option only.Further what i need to do run this script

  2. adi says:

    I created a parameterized script.This script runs another script.The second script’s name is received as a parameter for the first script.
    My question is:
    In ant i use

    in order to run a monkeytalk script.How can i send the script name with the parameters needed in ant?

  3. rk says:

    Can we do the same using javascript? please explain how can I?

  4. rk says:

    Yes we can do the same using javascript by passing a variable through the function funnel.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s