Next: , Previous: print keyword, Up: General keywords


5.6.4 var keyword

The var keyword declares a variable for the scripter. A variable can be initialized during its declaration. The value of variable can be set in script or test class. When calling methods from a test object, the declared variable can be passed as an argument to this method. If variable name appears in text used with print keyword, its value gets printed. The var keyword has one mandatory and one optional argument, described below.

Note: var keyword may be used to declare variables used in remote test case execution. See Remote test case control, expect keyword.

Argument
variable name
The variable name.
Optional argument
variable value
The value which declared variable is to be initialized.

The var keyword can be used for example in the following way:

     var variable2
     var variable1 text
     var variable2 1
     sometestobj somemethod variable1 variable2
     print variable2