Details
Description
When using OutcomesTable with some date values to validate, there's a problem with the freemarker plugin.
Freemarker seems to expect the .ftl file to include the date part to render, as specified in the exception.
AFAIK, i don't have any control under the ftl generation...
java.lang.RuntimeException: ftl/jbehave-xml-output.ftl
at org.jbehave.core.reporters.TemplateableOutput.write(TemplateableOutput.java:182)
at org.jbehave.core.reporters.TemplateableOutput.afterStory(TemplateableOutput.java:171)
at org.jbehave.core.reporters.DelegatingStoryReporter.afterStory(DelegatingStoryReporter.java:49)
at org.jbehave.core.reporters.ConcurrentStoryReporter.afterStory(ConcurrentStoryReporter.java:125)
at org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:316)
at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:211)
at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:172)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:229)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:201)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.jbehave.core.reporters.FreemarkerProcessor$FreemarkerProcessingFailed: Freemarker failed to process template ftl/jbehave-xml-output.ftl using configuration freemarker.template.Configuration@44f942c4 and data model
at org.jbehave.core.reporters.FreemarkerProcessor.process(FreemarkerProcessor.java:25)
at org.jbehave.core.reporters.TemplateableOutput.write(TemplateableOutput.java:179)
... 13 more
Caused by: freemarker.template.TemplateModelException: Can't convert the date to string, because it is not known which parts of the date variable are in use. Use ?date, ?time or ?datetime built-in, or ?string.<format> or ?string(format) built-in with this date.
at freemarker.core.Environment.formatDate(Environment.java:765)
at freemarker.core.Expression.getStringValue(Expression.java:105)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)
at freemarker.core.Environment.visit(Environment.java:417)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.Macro$Context.runMacro(Macro.java:172)
at freemarker.core.Environment.visit(Environment.java:603)
at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.Macro$Context.runMacro(Macro.java:172)
at freemarker.core.Environment.visit(Environment.java:603)
at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)
at freemarker.core.Environment.visit(Environment.java:417)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)
at freemarker.core.Environment.visit(Environment.java:417)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.Environment.process(Environment.java:190)
at freemarker.template.Template.process(Template.java:237)
at org.jbehave.core.reporters.FreemarkerProcessor.process(FreemarkerProcessor.java:23)
... 14 more
Activity
Field | Original Value | New Value |
---|---|---|
Fix Version/s | 3.6.9 [ 18650 ] |
Status | Open [ 1 ] | Resolved [ 5 ] |
Assignee | Mauro Talevi [ maurotalevi ] | |
Resolution | Fixed [ 1 ] |
Fix Version/s | 3.7 [ 18390 ] |
This may happen if the object in the OutcomesTable is a Date. Freemarker does not have a default way of handling it.
Can you provide an example of the data that caused the error.
Workaround is create Outcomes using their String representation, e.g.