How to create a scalar variable, empty variable, List variable, Dictionary Variable in a robot framework?

Variables in robot framework are case-insensitive, Spaces, and underscored are ignored.

example : ${Var 1}, ${var 1}, ${Var_1}, ${var_1}. All these variable represent as one variable.

Creating Scalar Variables in Robot Framework.

$ is used to define the scalar variable in the robot framework. The variable name will be present inside {} open curly braces and closing curly braces.

example : ${var1}

Creating List Variable in Robot Framework.

@ is used to define the list type variable in robot framework. You can also create list as shown below.

${List} = Create List

List with some values.

@{List} 10 20 30 40 50

${List} = Create List 10 20 30 40

Creating empty list variables.

@{List} @{EMPTY}

${List} = Create List

example : @{list}

example : ${Var 1}

Creating dictionary variables in robot framework.

& is used to represent dictionary variables in the robot framework. In the dictionary, each item is present in key-value pair, where the key describes value.

example : &{dict}

Dictionary with some values.

example : ${dict} Create Dictionary name=ram age=19 subject=PCM

example : &{dict} name=ram age=19 subject=PCM

Empty dictionary in robot framework.

example : &{dict} &{EMPTY}

example : ${dict} Create Dictionary

2 thoughts on “How to create a scalar variable, empty variable, List variable, Dictionary Variable in a robot framework?”

Leave a Comment

Your email address will not be published. Required fields are marked *