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
{{ message }}
Repository navigation
List not passed as a list using embedded argument. #2705
I have encountered problem when passing a list as embedded argument. Here is the example:
*** Settings ***
Documentation Problematic Suite
*** Variables ***
${condition} 0
*** Keywords ***
Log My List ${MyList}
Log Many @{MyList}
*** Test Cases ***
LD_0: Pass List in If Statement.
[Documentation] Problem example.
[Tags] Problem
@{LIST}= Create List item1 item2 item3
Log My List ${LIST}
Run Keyword If ${condition} == 0 Log My List ${LIST}
First usage of Log My List keyword is fine, logs the list perfectly. Second usage, in if statement keeps telling me:
Value of variable '@{MyList}' is not list or list-like
This is actually a know problem documented by #1595. Fixing it in generic manner so that all objects could be passed like this would be really hard, but we could actually workaround it when using lists or dictionaries pretty easily.
We already have #2699 about supporting @{list} and &{dict} variables with embedded arguments. We could implement that so, that if we have a keyword like
*** Keywords ***Example @{args}
Log Many @{args}
and it is used like Example ['foo', 'bar', 'zap'], the framework converts the string ['foo', 'bar', 'zap'] into a matching list. The main downside would be that you'd normally rather use syntax like Example foo, bar, zap instead. Perhaps we could support both?
Yeah, this is an old issue but it occurs so seldom and generic fix would be so hard that nobody has bothered to do anything to it. I'll close this as a duplicate of #1595. Let's see would #2699 provide a workaround for lists and dicts.
Activity
pekkaklarck commentedon Nov 3, 2017
This is actually a know problem documented by #1595. Fixing it in generic manner so that all objects could be passed like this would be really hard, but we could actually workaround it when using lists or dictionaries pretty easily.
We already have #2699 about supporting
@{list}and&{dict}variables with embedded arguments. We could implement that so, that if we have a keyword likeand it is used like
Example ['foo', 'bar', 'zap'], the framework converts the string['foo', 'bar', 'zap']into a matching list. The main downside would be that you'd normally rather use syntax likeExample foo, bar, zapinstead. Perhaps we could support both?djaromir commentedon Nov 3, 2017
Too bad the issue was discovered in 2013 originally :( If Robot Framework could support both described syntax that would be perfect.
pekkaklarck commentedon Nov 3, 2017
Yeah, this is an old issue but it occurs so seldom and generic fix would be so hard that nobody has bothered to do anything to it. I'll close this as a duplicate of #1595. Let's see would #2699 provide a workaround for lists and dicts.