The Freemarker Fixture allows a Freemarker template to be rendered to the wiki. This allows the template result to be sent to an application being tested, or saved as a mock server's response. It is usable both in script tables and dynamic decision tables.
The templates are loaded from the 'templates' directory on the class path (e.g. fixtures/templates in a standalone installation, or wiki/fixtures/templates in a Maven project based on the sample project or archetype). This location cannot be changed, but subdirectories can be used (by starting a template name with subdirectoryname/).
To edit/add templates, modify/place them in the src/main/resources/templates folder and rebuild the project using mvn compile (or your IDE). This will allow the fixture to find the files.
When debugging a template you can, of course, directly edit the files below fixtures/templates. But be warned: that location is not normally under version control and your changes will be overwritten when a new build is performed.
If the template's name contains .xml or .json the template's output will be formatted and shown as XML or JSON in the wiki.
Dynamic Decision Table Usage
The template to use can either be supplied using a constructor parameter in the table's first row, or by the name of the output column.
ddt: freemarker fixture | samplePost.ftl.xml |
countryName | post? |
United States | $postUs<-[<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"> <s11:Body/> </s11:Envelope>] |
Netherlands | $postNl<-[<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"> <s11:Body/> </s11:Envelope>] |
or
ddt: freemarker fixture | |
countryName | samplePost.ftl.xml? |
United States | $postUs2<-[<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"> <s11:Body/> </s11:Envelope>] |
Netherlands | $postNl2<-[<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"> <s11:Body/> </s11:Envelope>] |
script | string fixture | ||
check | value of | $postUs->[<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"> <s11:Body/> </s11:Envelope>] |
$postUs2->[<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"> <s11:Body/> </s11:Envelope>] |
check | value of | $postNl->[<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"> <s11:Body/> </s11:Envelope>] |
$postNl2->[<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"> <s11:Body/> </s11:Envelope>] |
Script Usage
Here we render a template using script tables[?].script | freemarker fixture | ||
set value | Netherlands | for | countryName |
$postNl3<-[<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"> <s11:Body/> </s11:Envelope>] |
apply template | samplePost.ftl.xml | |
set value | Utrecht | for | cityName |
$postNl4<-[<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"> <s11:Body/> </s11:Envelope>] |
apply template | samplePost.ftl.xml |