I want to be able to put preformatted text (i.e. containing line breaks) into a single cell of a FitNesse fixture table. Is there a way to manipulate the FitNesse wiki markup to do this?
Use !- -! to get multiline table cells and {{{ }}} to get preformatted text. The {{{ has to be outside the !-
For example:
|sql|
|{{{!- SELECT *
FROM bar
WHERE gaz = 14
-!}}}|
One way to do this is to define a variable with the multi-line text and then refer to this from the table cell:
!define sql { SELECT *
FROM bar
WHERE gaz = 14
}
|sql|
|${sql}|
richard's comment on Johannes Brodwall's answer worked for me, i.e. you don't need the "formatted 'as is'" line/block markup, just the "'as-is'/escaping" character formatting so the following is sufficient if you don't need or want the pre-formatted style too:
|sql|
|!-Some text
that spans
multiple lines.
-!|
This way allows you to keep a table row on the same line in your source code :
| col1 | col2 |
| !- col1 cell <br /> with line break -! | col2 cell without line break |
The way that ended up working best for me was using a couple of the solutions listed above together. Defining a variable and using the !- -!
define myVarWithLineBreaks {!-This is my
text with line
breaks-!}
|col |col2 |
|${myVarWithLineBreaks}|other value|
© 2022 - 2024 — McMap. All rights reserved.
{{{ … }}}
inserts<pre> … </pre>
. This may not be what you want. I saw using setHeader / setHeaders in RestFixture.!- … -!
was what was needed. – Burgeon