T E S B O

Tesbo

How to define, set and use Local variables

Local variables are define in particular ‘Test‘ and it’s scope in that particular test.

1. Define local variable and set particular text on it

Syntax

Step: define {local Variable} and set | put | assign 'value'

i.e

Test: Local variable functionality
Step: Pause until @Email_Box is display
Step: Define {userEmail} variable and put 'admin@phptravels.com' value in it
Step: Define {userPassword} variable and assign 'demoadmin' value in it
Step: Enter {userEmail} in to @Email_Box
Step: Enter {userPassword} in @Password_Box
Step: Click on @LoginBtn
End

2. Define local variable and set Element Text, Size of Element, Page Title, Current URL, Attribute Value and CSS Value on it

Syntax

Step: define {local Variable}

Step: Get text of @element and set | put | assign in to {local variable}
Step: Get text of @element and set | put | assign in to {local variable}
Step: Get size of @element and set | put | assign in to {local variable}
Step: Get page title and set | put | assign in to {local variable}
Step: Get current url and set | put | assign in to {local variable}
Step: Get attribute 'attribute name' of @element and set | put | assign in to {local variable}
Step: Get css value 'css value' of @element and set | put | assign in to {local variable}

i.e

Test: define and set Local variable functionality
Step: Pause until @Email_Box is display
Step: Define {userEmail} variable
Step: Define {userPassword} variable and assign 'demoadmin' value in it
Step: Get text of @LoginBtn variable and put in to {userEmail}
Step: Enter {userEmail} in to @Email_Box
Step: Enter {userPassword} in @Password_Box
Step: Click on @LoginBtn
End

You can find a similar example from Tesbo-Skeleton as well

Powered by BetterDocs

Leave a Comment