Re: keyword argument on multiple lines when using "Space separated format"

5,931 views
Skip to first unread message
Message has been deleted

Pekka Klärck

unread,
Jan 6, 2013, 6:00:03 PM1/6/13
to lau...@bristiel.com, robotframe...@googlegroups.com
2013/1/4 Laurent Bristiel <lau...@bristiel.com>:
> Hello,
>
> does aynone know if it is possible to have a single argument of a keyword
> split over multiple lines when using "Space separated format" text format ?

I often use BuiltIn keyword `Catenate` for this. It catenates strings
using spaces by default, but you can also give a custom separator:

${str} = Catenate Hello tellus, mars
... and venus!
Should Be Equal ${str} Hello tellus, mars and venus!
${str} = Catenate SEPARATOR=\n
... First line.
... Second line.
... Last line.
Should Be Equal ${str} First line.\nSecond line.\nLast line.

You can also create your own user keywords that accept long strings in
pieces and catenate them internally:

Example Keyword
[Arguments] @{lines}
${content} = Catenate SEPARATOR=\n @{lines}
Do Something ${content}

Very long strings I would read from external files with `Get File`,
import using variable files, or handle with a custom keyword in
Python.

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org
Message has been deleted

Pekka Klärck

unread,
Jan 7, 2013, 6:32:36 PM1/7/13
to lau...@bristiel.com, robotframe...@googlegroups.com
2013/1/7 Laurent Bristiel <lau...@bristiel.com>:
> I also though about simply setting up the variable at the begining of my
> file in a "variables" section,
> so that my steps are more simple/dense and hence easier to understand.

That works well too. Unfortunately creating long variables in the
variable table isn't that convenient until this issue is implemented:
http://code.google.com/p/robotframework/issues/detail?id=1009
Reply all
Reply to author
Forward
0 new messages