Call Function


Is there any function like “Call” in other object oriented language?

For Example…

I have script for login scenario.

I need to reuse it for multiple instance.

How to perform this?

Function login(username,password)!!

I need to use this functions in another script.
How to do it?

If you have a script called login in your suite, you can call it from another script as a command, like this:

login username,password

If the login script returns a value (such as true or false to indicate success or failure) then you would want to call it as a function, which could be done like this (in an if statement here, but could be in any context where a value is used):

if login(username,password) then ...

Could you please explain breifly?

Create a script called login that looks like this:

params name, password

log "The login script was called with name=" & name & " and password=" & password

Create a second script called main that looks like this:

log "This is the main script"

login "Alexander", "qxc#5%k2"

log "This is the main script continuing"

Run the main script.

The name and password passed to the login script could of course be in variables in the main script rather than coded directly.