I have a method that returns the path to an image, and I want to show that image in the test output.
Is this possible?
!|script |Image |
|# Url() returnes "http://files/img.jpg"|
|$img= |Url |
# I want to see the image at http://files/img.jpg
$img
# Does fitnesse support any templating so that I can do
<img src="$img" />
I'm using FitNesse with FitSharp.
You can't render an image directly from a URL as far as I know. BUT you can have your fixture return an image to be included in the HTML output.
If you add a method Image()
which returns "<div><img src\"" + Url() + "\"/></div>"
your script can become:
!|script |Image |
|show |Image |
You can see an example of this in action (using Java Slim) in the rows using the take screenshot
command of my fixtures in https://fhoeben.gitlab.io/-/hsac-fitnesse-fixtures/-/jobs/2569203409/artifacts/example-results/example-test-1/HsacExamples.SlimTests.BrowserTests.ScriptTest.html