Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For loop over dictionary in Robot Framework

Is there a proper way to loop over a dictionary in RF? I used pythonic way, but failed:

:FOR  ${key}  ${value}  IN  &{dict}

output: Number of FOR loop values should be multiple of its variables. Got 2 variables but 1 value.

Same, when i pointed dictionary as scalar variable. I couldn't find an example in documentation though. Has anyone solved that?

P.S.

I am aware of workaround solution, that you use kw. Get Dictionary Keys and Get Dictionary Values, then, to update values you use Set To Dictionary ${key} ${new_value}, but this seems to be human unfriendly and uses several for loops iterations instead one.

like image 717
user2678074 Avatar asked Feb 14 '17 14:02

user2678074


1 Answers

FOR    ${key}    ${value}    IN    &{dictionary}
    Log To Console   key = ${key}, value = ${value}
END

This works fine in RF 3.2.2

like image 195
Joost Avatar answered Sep 23 '22 17:09

Joost