You can configure your custom template via the view properties as
follows:
@Override
public Configuration configuration() {
Class<? extends Embeddable> embeddableClass = this.getClass();
// Start from default ParameterConverters instance
ParameterConverters parameterConverters = new
ParameterConverters();
// factory to allow parameter conversion and loading from
external resources (used by StoryParser too)
ExamplesTableFactory examplesTableFactory = new
ExamplesTableFactory(new LocalizedKeywords(), new
LoadFromClasspath(embeddableClass), parameterConverters);
// add custom converters
parameterConverters.addConverters(new DateConverter(new
SimpleDateFormat("yyyy-MM-dd")),
new ExamplesTableConverter(examplesTableFactory));
*Properties viewResources = new Properties();**
** viewResources.put("reports",
"ftl/jbehave-reports-with-totals.ftl");*
return new MostUsefulConfiguration()
.useStoryLoader(new LoadFromClasspath(embeddableClass))
.useStoryParser(new RegexStoryParser(examplesTableFactory))
.useStoryReporterBuilder(new StoryReporterBuilder()
.withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
.withDefaultFormats()
*.withViewResources(viewResources)*
.withFormats(CONSOLE, TXT, HTML, XML))
.useParameterConverters(parameterConverters);
}
That said, it works in Eclipse (presumably in other IDEs too) but not in
Maven due to a classloading issue with the Freemarker template engine.
Also it's better to rename your custom template to something like
"ftl/my-reports.ftl" because otherwise the classloader may pick up the
ones in jbehave-core.
I've opened an issue to track it http://jira.codehaus.org/browse/JBEHAVE-912
Cheers
On 18/05/2013 09:47, Kaustubh Joshi wrote:
Thanks selenium learner for sending out code sample as for some
reasons I could not do that..
This was one of main pending issue when I was following Jbehave so
curious about the answer..
Cheers,
K
On Sat, May 18, 2013 at 12:57 PM, Selenium Learner 2013
<777selen...@gmail.com <mailto:777selen...@gmail.com>> wrote:
All,
Could any of the Jbehave Dev throw some light on above mailed issue?
On Fri, May 17, 2013 at 9:11 PM, Selenium Learner 2013
<777selen...@gmail.com <mailto:777selen...@gmail.com>> wrote:
All,
I am sorry for picking old thread but since I am building
framework, I found it quite useful.
I created one sample project(took help from github.com
<http://github.com> to be honest) and added the problem
mentioned in the below thread( Adding FTL files under source
folder).I could reproduce as When I tried running by eclipse,
I could generate custom report in .html file.But When I tried
running through maven command line as mvn integration-test ,
old type of reports got generated(some how code could not read
changed FTL file).
So, could any of Jbehave Dev can provide solution? Where I
need to make changes so that even through command
prompt(maven), I could see custom report?
*Sample Zip file for dummy project has been attached.Hope you
won't find any exception when reproducing it*
as I could easily reproduce the problem..
OLD thread details:
Hi All ..
I am starting this as a new mail thread so that won't have
confusion..
Scenario Question: I wanted to have changes in the reporting
of jbehave, so i made changes in
jbehave-reports-with-totals.ftl file to get done.This got
successfully implemented as i could not see the columns i have
removed when I tried running through eclipse but then when i
try to run by command prompt (maven) as mvn test
-Dtest.application= value -Dtest.enviornment=value
-Dtest.browser=Firefox , the test
getting run successfully but when i checked reports in the
target folder , i can't see the changes i made in ftl file as
again entire report got generated and not the custom report
generated when i run through eclipse..
Any idea why it's happening? The one answer i got is that
The changes you make in the your Stories class will be
available to the Maven command-line. It's only the parameters
that are available to the Maven goals that will overwrite any
configuration in the Java class. the configuration of FTL
template resources can only be done in Java you won't have any
issues of overwriting them.
Now this has gone over my head..where i make to changes in
storyDriver.java file (where configuration exist) or in POM
file so that the changes I made in ftl will get persistent
even when i try to run through command prompt? pls
advice..it's really confusing how jbehave working differently
(one in eclipse , one command line)
Please let me know if you need more info/explanation about the
problem i asked.
Cheers,
K
Mauro Talevi via jbehave.codehaus.org
<http://jbehave.codehaus.org>
Apr 23
to dev
A zip containing all the src to build via mvn and reproduce
problem.
Keep it as simple as possible please.