pe 17. elok. 2018 klo 12.08 Paolo Bizzarri (
pib...@gmail.com) kirjoitti:
>
> I am looking at a large suite of Robot Framework tests (1000+ tests).
>
> I would like to migrate them in text format from HTML because HTML is hard to mantain.
That's a good idea. The support for the HTML format is going to be
deprecated in the forthcoming RF 3.1 and removed in RF 3.2.
> The biggest obstacle at the moment is multiline arguments - typically results from queries. They would appear horribly on a single line.
>
> I saw that there was some discussion about it, but apparently there was only an option for variables, which is not a feasible option - we would have to refactor a large number of tests, plus we would reduce the visibility.
Is the problem that you currently have long strings in HTML that wrap
in table cells and the plain text format doesn't support that? Things
you can try:
1. If a keyword accepts several arguments but individual arguments
aren't overly long, you can just use `...` to split arguments into
multiple lines:
Example Keyword This argument is rather long but not super long.
... This is another pretty long, but not super long, argument.
... One more longish argument here.
2. If an individual argument is very long, you can use the `Catenate`
keyword to construct it utilizing the aforementioned `...` syntax:
${argument} = Catenate
... This is the first part of a very long argument.
... This is the second part.
... These parts are concatenated together with a space.
Example Keyword ${argument}
${argument} = Catenate SEPARATOR=\n
... It is possible to specify a custom separator by using `SEPARATOR=<sep>`.
... This example contains two lines.
Example Keyword ${argument}
3. You said you wouldn't like to use variables, but they can be pretty
handy, especially if you need the same value multiple times. Long
variables, including multiline variables, can be created using the
same logic as with the `Catenate` keyword:
*** Variables ***
${EXAMPLE 1} Quite long value but short enough to fit into
one line nicely.
${EXAMPLE 2} This value is so long that it makes sense to split it into
... multiple lines. By default the value is
concatenated together
... by using spaces.
${EXAMPLE 3} SEPARATOR=\n
... It is possible to use a custom separator when splitting
... a variable into multiple lines. This example creates
... a multiline value.
4. If your keyword accepts single long argument that you'd like to
split into multiple lines in Robot's data, you can create a wrapper
keyword that accepts parts separately and uses `Catenate` to combine
them:
*** Keywords ***
Wrapper Example
[Arguments] @{arguments}
${argument} = Catenate @{arguments}
Keyword Accepting Only One Argument ${argument}
5. If values are really long, it often makes sense to store them in
external files. This keeps Robot data simpler and typically also makes
editing the external data a lot easier. For example, Robot's own XML
library allows passing XML both as a string like
`<example>content</example>` or as a path like `${CURDIR}/data.xml`.
This makes it possible to have simple XML snippets inline in Robot's
tests data, possibly using some of the ideas explained above, but
allows also storing larger XML snippets as external files that can
then be edited with a dedicated XML editor.
Cheers,
.peke
--
Agile Tester/Developer/Consultant ::
http://eliga.fi
Lead Developer of Robot Framework ::
http://robotframework.org