Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Robot Framework, what is the difference between a List Variable and a Scalar Variable containing a list?

In Robot Framework, we can assign a list to a Scalar Variable or to a List Variable, as shown below:

| @{list} =   | Create List | a | b | c |
| ${scalar} = | Create List | a | b | c |

What is the difference between a List Variable and a Scalar Variable containing a list?

like image 353
userpal Avatar asked Sep 01 '14 09:09

userpal


People also ask

What are the 3 different types of variables in the robot framework?

There are three types of variables supported in robot framework − scalar, list and dictionary.

What is scalar variable in Robot Framework?

Scalar Variable in Robot Framework A Scalar variable holds a single value at a time, and it is a single component that assumes the range of numbers. The Scalar variable is used to store the Strings, Objects, List, etc.. The syntax for the scalar variable is ${variablename}


1 Answers

In case of the assignment shown in your question, there is no difference. If you log each of those you'll get the exact same output.

Note: this functionality was introduced in version 2.8 (see Using scalar variables as lists in Robot Framework User's Guide).

The difference comes when you use the values. When you use the @ symbol to reference a list, each of the elements in the list becomes a cell. In the following example, the following three lines give identical results:

| | A keyword that expects three arguments | a | b | c
| | A keyword that expects three arguments | @{list}
| | A keyword that expects three arguments | @{scalar}
like image 130
Bryan Oakley Avatar answered Oct 21 '22 15:10

Bryan Oakley