Parameterized Script for MonkeyTalk,
MonkeyTalk Parameterized Script, MonkeyTalk Form
Through driver script, Passing the
values of variable, Values for variables can be pass as the argument
in the script of driver. There is only one fore and foremost
requirement is that they should be in same order as they are declare.
Here you have two scripts driver script and second is the main code
script:
Monkey Talk Form:
# Driven Script (formtest1.mt)
vars * defines password user
Input user-name EnterText ${user}
Input password EnterText ${pass}
Button Login Tap %thinktime = 400
Button LOGOUT Tap %thinktime = 4000
We can see the tabular form of
driven (formtest1.mt)script which we have generated:
Parameterized Script |
# Driver Script
Script formtest1.mt
Run Rheys “Testpassword”
Script
formtest1.mt Run Rheys1 “testpassowrd1” %thinktime = 4000
Driver script in the form of
tabular:
MonkeyTalk Parameterized Script |
Parametrized Script by using Default
values:
#
default.mt
vars
* define username = Snesyl password = form1
Input
username Entertext ${username}
Input
password EnterText ${password}
Button
LOGIN Tap %thinktime = 4000
Label
* Verify “Welcome, ${username}!” %thinktime = 4000
Result:
17:03:44.664: Started Script
Play back
17:03:44.673: Vars * Define user-name = Snesyl
pw = form1
17:03:44.681: Input user-name EnterText Snesyl
17:03:45.340: Input password EnterText form1
17:03:46.004: Button LOGIN Tap %thinktime=4000
17:03:49.180: Label * Verify “Welcome, frend!” %thinktime=4000
17:03:53.327: Completed Script Play back – DONE
Through Driver Script When you will send the parameters:
Script default.mt Run Saluja
In this case user-name argument will take the value Saluja and
Password argument take defualt value i.e. form1
Result:
17:09:05.839: Started Script Play back
17:09:05.843: Script default.mt Run Saluja
17:09:05.848: Started Script Play back
17:09:05.851: Vars * Define usern= Synsyle pw= form1
17:09:05.855: Input username EnterText Saluja
17:09:06.614: Input password EnterText form1
17:09:07.088: Button LOGOUT tap %thinktime = 4000
17:09:07.297: Button LOGIN Tap %thinktime = 4000
17:09:10.543: Label * Verify “Welcome, Saluja!” %thinktime =
4000
17:09:11.158: Completed Script Play back – OK, Done
No comments:
Post a Comment