For a while now I have been using and have replaced VAR syntax this way in my code (Robocop: off is used as there is no value assigned to my variable):
VAR @{list} # robocop: off
But I’m wondering how to handle easily/properly the fact that an ${EMPTY} value is assigned, as the following will create a list [ ’ ', ‘aaa’, ‘bbb’] instead of [‘aaa’, ‘bbb’]):
VAR @{list} ${EMPTY}
FOR ${i} IN aaa bbb
Append To List ${list} ${i}
Log ${list}
END
Of course I can stack a Remove from List ${list} ${EMPTY} after the VAR definition, but would be interested if there are some more suitable solutions.
@CharlieScene Why don’t you just use VAR @{list} as you did in your first example? That creates an empty list. See Robot Framework User Guide
Or is the Robocop extension complaining that the variable is empty? In that case just use the RobotCode extension from Daniel Biehl .
No, no problem with Robocop actually. And I use Robotcode already.
Thing behind this is that I import the xml file in third party (Jira/Xray) through API and the fact that the @{list} variable is empty (in fact has no tag in the xml file) gives back an error 500.
So I was simply thinking of adding ${EMPTY} to definition (that allow import), but this add this empty item in the list that I don’t need.
Hence the question about managing this.
I already have Xray support on this but I’m not sure about the outcome of this syntax support in short notice.