Reputation: 1211
Can I use variable into create list?
Right now I am maintaining variable, and create list is exact string in different format.
I want to reduce the work by maintain just one variable.
How can I rework this line @{list} Create List [email protected] [email protected]
*** Variables ***
${RECIPIENTS-TO} [email protected];[email protected]
*** Test Cases ***
Add email recipient
@{list} Create List [email protected] [email protected]
FOR ${EMAIL} IN @{list}
Wait Until Page Contains ${EMAIL}
END
Upvotes: 0
Views: 64
Reputation: 7291
I am not sure if I understand your question correctly but why do not you declare your list in the variable table.
*** Variables ***
@{RECIPIENTS-TO} [email protected] [email protected]
Regarding this:
Can I use variable into create list?
the answer is yes. Any variable can be passed as a list element to Create List
keyword, but mind that ${RECIPIENTS-TO}
will mean one element with a value of [email protected];[email protected]
.
If you want to convert ${RECIPIENTS-TO} [email protected];[email protected]
to a list you could use the Evaluate keyword for splitting by the ;
character like below:
*** Variables ***
${RECIPIENTS-TO} [email protected];[email protected]
*** Test Cases ***
Add email recipient
@{list} Evaluate "${RECIPIENTS-TO}".split(';')
FOR ${EMAIL} IN @{list}
Log ${EMAIL}
END
You can do the same using the Split String keyword form the String library as well.
Upvotes: 2