You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally submitted to Google Code by deville.moodys on 31 May 2013
It'd like to provide dictionaries (key/value) parameters to several functions of my librairies.
Consequently I'd like to have the possibility to create variables of type "dictionary".
I know it is possible to create such variables in a test case, but it could be more "user-friendly" if we could create them as currently scalar and list variables.
Thanks for your reply
Cheers
Originally submitted to Google Code by deville.moodys on 17 Jun 2013
Hi, I have indeed tried "Create Dictionary" and that is what I refeered in my request.
However, as my dictionary variable will contain a "fixed value", I'd rather setting it like scalar and list variables. Setting it at runtime is not so clear for anybody that will have a look at the test. Don't you share this point of view ?
Cheers
I didn't understand your initial description correctly. Yes, it would be handy if there was a separate variable type for dictionaries like we have @{var} for lists. Being able to create them in the variable table would be convenient, but most importantly they could be used when passing named arguments to keywords. That is required by issue 1561.
This new variable type should work so that they can be created in the variable table like:
*** Variables ***
&{EXAMPLE} key=value key2=another value
Then it should be possible to use them in the test data as scalar variables like:
Should Contain ${EXAMPLE} key # First argument is a dictionary
Using them in &{name} format would mean unpacking the dictionary and passing individual arguments to a keyword as named arguments. Following two keyword calls should be identical:
My Keyword &{EXAMPLE}
My Keyword key=value key2=another value
Activity
spooning commentedon Jun 29, 2014
Have you tried
Create Dictionaryin CollectionsLibrary? If you need lot of dictionaries, you could consider using variable files.spooning commentedon Jun 29, 2014
Hi, I have indeed tried "Create Dictionary" and that is what I refeered in my request.
However, as my dictionary variable will contain a "fixed value", I'd rather setting it like scalar and list variables. Setting it at runtime is not so clear for anybody that will have a look at the test. Don't you share this point of view ?
Cheers
spooning commentedon Jun 29, 2014
I didn't understand your initial description correctly. Yes, it would be handy if there was a separate variable type for dictionaries like we have @{var} for lists. Being able to create them in the variable table would be convenient, but most importantly they could be used when passing named arguments to keywords. That is required by issue 1561.
This new variable type should work so that they can be created in the variable table like:
Then it should be possible to use them in the test data as scalar variables like:
Using them in &{name} format would mean unpacking the dictionary and passing individual arguments to a keyword as named arguments. Following two keyword calls should be identical:
spooning commentedon Jun 29, 2014
Issue 1385 has been merged into this issue.
spooning commentedon Jun 29, 2014
It would also be nice to be able index the dictionary variable in the same way a list variable can be indexed.
E.g.:
Log &{EXAMPLE}["key"]
spooning commentedon Jun 29, 2014
I'm assuming this would also cover the case of having kwargs passed into user keywords?
E.g.:
Output:
Log: "Hello World!"
Comment by @pekkaklarck: This is part of separate but highly related issue #1561.
Support &{dict} variables in variable table
Support &{dict} also when creating variables in variable table (#1450).
Using &{dict} variables with keyword.
Added built-in variable &{EMPTY}
Make it possible to use dict variables as lists. Related to #1450.
Enhancements to assigning variables from return values.
Cleaned up assigning variables.
pekkaklarck commentedon Feb 8, 2015
Forgot to mention this issue in few commits.
&{dict}[key].Enhanced and cleaned up setting variables from variable files.