1

In FitNesse's own acceptance tests, many times we can see output in the form of HTML being displayed when a test is run. Typically the output is wrapped in <pre>..</pre> and is displayed with a blue background. The wiki markup isn't anything special, just an empty cell in a column fixture (it seems) which displays the output, e.g.

|Response Requester.| |uri|valid?|contents?| |!-VariablePage-!|true||

(This is from the test FitNesse.SuiteAcceptanceTests.SuiteWidgetTests.TestVariables)

The contents column displays nicely preformatted HTML output on a blue background when the test is run.

How is this achieved?

Mike Scott
  • 12,274
  • 8
  • 40
  • 53
  • Looking at that fixture, it says `return "
    " + HtmlUtil.escapeHTML(FitnesseFixtureContext.sender.sentData()) + "
    ";`.
    – legoscia Oct 03 '17 at 14:07
  • @legoscia I suspect this is in the Java fixture code, right? I'm using .Net and there's no HtmlUtil class. Does anyone know if there's an alternative? – Mike Scott Oct 04 '17 at 17:01
  • You'd need to escape special HTML characters to their corresponding HTML entities. There are a few suggestions in the answers to this question: https://stackoverflow.com/q/1005264/113848 – legoscia Oct 04 '17 at 22:55
  • Thanks for that suggestion, but the example from FitNesse's own acceptance tests is not HTML escaped, it's just inside a
    ...
    . So how does FitNesse get that cell to have a blue background? The text is in a span with CSS class "ignore". There's more going on here, no? Somehow the cell is given special treatment.
    – Mike Scott Oct 05 '17 at 16:29
  • 1
    The blue background suggests that there was no assertion for this value; Fitnesse is just "reporting" it without this being either a "green" or "red" value. In Slim, that happens automatically in decision tables when there is no assertion. Is this using Slim or Fit? Fit might do this differently... – legoscia Oct 05 '17 at 16:40
  • @legoscia ah that could be it. I'm using Fit and it doesn't show these "informational" cells in a different colour. – Mike Scott Oct 05 '17 at 16:47

0 Answers0