Question

I am creating a collection of JBehave reports during my build that I would like to enhance. The default html reports that JBehave generates are very bland and could be tweaked for easier readability on my wiki when I post them for my customers. I would like to add some simple styling via css. However, I cannot find any examples on how to accomplish this.

Does anyone know how I can apply a custom css style to JBehave reports?

Here is how I'm generating the reports right now:

@Override
public Configuration configuration() {
    ...
    return new MostUsefulConfiguration()
            ....
            .useStoryReporterBuilder(new StoryReporterBuilder()
                    .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
                .withFormats( Format.TXT,
                              Format.HTML)
                ...
            );
}
Was it helpful?

Solution

A couple things - the StoryReporter captures events during story processing - in various formats. A JBehave "view" can be created from the reports. For example the Jenkins/Hudson plugins will use the XML reports directly. But you can create a website JBehave view using the default Freemarker templates, css/js resources. You can customize those to your hearts content.

Look at the section on "View Generation" on http://jbehave.org/reference/stable/reporting-stories.html - that will get you started - and there are examples in the JBehave examples for view generation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top