ftl.jbehave-xml-output.ftl Maven / Gradle / Ivy
<#ftl strip_whitespace=true>
<#macro renderMultiline text>${text?replace("\n", "
")}#macro>
<#macro renderMeta meta>
<#assign metaProperties=meta.getProperties()>
<#list metaProperties.keySet() as name>
<#assign property = metaProperties.get(name)>
#list>
#macro>
<#macro renderNarrative narrative>
<#assign isAlternative=narrative.isAlternative()?string>
<#if isAlternative == "true">
${narrative.asA}
${narrative.iWantTo}
${narrative.soThat}
<#else>
${narrative.inOrderTo}
${narrative.asA}
${narrative.iWantTo}
#if>
#macro>
<#macro renderGivenStories givenStories>
<#list givenStories.getStories() as givenStory>
parameters="${givenStory.parameters}"#if>>${givenStory.path}
#list>
#macro>
<#macro renderLifecycle lifecycle>
<#if !lifecycle.getBeforeSteps().isEmpty()>
<#list lifecycle.getBeforeSteps() as step>
${step?xml}
#list>
#if>
<#if !lifecycle.getAfterSteps().isEmpty()>
<#list lifecycle.getOutcomes() as outcome>
${outcome}
<#assign metaFilter=lifecycle.getMetaFilter(outcome)>
<#if !metaFilter.isEmpty()><#assign metaFilterAsString=metaFilter.asString()>${metaFilterAsString} #if>
<#list lifecycle.getAfterSteps(outcome) as step>
${step?xml}
#list>
#list>
#if>
#macro>
<#macro renderTable table>
<#assign rows=table.getRows()>
<#assign headers=table.getHeaders()>
<#list headers as header>
${header?xml}
#list>
<#list rows as row>
<#list headers as header>
<#assign cell=row.get(header)>
${cell?xml}
#list>
#list>
#macro>
<#macro renderOutcomes table>
<#assign outcomes=table.getOutcomes()>
<#assign fields=table.getOutcomeFields()>
<#list fields as field>
${field?xml}
#list>
<#list outcomes as outcome>
<#assign isVerified=outcome.isVerified()?string>
<#if isVerified == "true"> <#assign verified="verified"><#else><#assign verified="notVerified">#if>
${outcome.description?xml} <@renderOutcomeValue outcome.getValue() table.getDateFormat()/> ${outcome.matcher?xml} <#if isVerified == "true">${keywords.yes}<#else>${keywords.no}#if>
#list>
#macro>
<#macro renderOutcomeValue value dateFormat><#if value?is_date>${value?string(dateFormat)}<#else>${value?xml}#if>#macro>
<#macro renderStep step>
<#assign formattedStep = step.getFormattedStep(EscapeMode.XML, "{0} ")>
${formattedStep}<#if step.getTable()??> <@renderTable step.getTable()/> #if>
<#if step.getFailure()??> ${step.failureCause?xml} #if><#if step.getOutcomes()??><@renderOutcomes step.getOutcomes()/>#if>
#macro>
<#if story.getMeta()??><@renderMeta story.getMeta()/>#if>
<#if story.getNarrative()??><@renderNarrative story.getNarrative()/>#if>
<#if story.getLifecycle()??><@renderLifecycle story.getLifecycle()/>#if>
<#assign scenarios = story.getScenarios()>
<#list scenarios as scenario>
<#if scenario.getMeta()??><@renderMeta scenario.getMeta()/>#if>
<#if scenario.getGivenStories()??><@renderGivenStories scenario.getGivenStories()/>#if>
<#if scenario.getExamplesTable()??>
<#list scenario.getExamplesSteps() as step>
${step?xml}
#list>
<@renderTable scenario.getExamplesTable()/>
<#if scenario.getExamples()??>
<#list scenario.getExamples() as example>
${example?xml}
<#assign steps = scenario.getStepsByExample(example)>
<#list steps as step>
<@renderStep step/>
#list>
#list>
#if>
<#else>
<#assign steps = scenario.getSteps()>
<#list steps as step>
<@renderStep step/>
#list>
#if>
#list>
<#if story.isCancelled()?string == 'true'>
#if>
<#if story.getPendingMethods()??>
<#list story.getPendingMethods() as method>
${method?xml}
#list>
#if>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy