问题
I have been working on a project that lets me test the behaviours of my companies webpage.
I have written an API and the testcase I am working on runs through JUnitRunner and the test passes.
The next step is to get the results displayed on a webpage, oes anyone know what plugin I need to get the JBehave results in HTML format or as a file.
I know I should be posting my code but there is no problems with the code, I just need the output in a different formatt.
Thanks
回答1:
To get the HTML output you need to make sure that you are generating the views with STATS and HTML output.
In MostUsefulConfiguration, add
.useStoryReporterBuilder(
new StoryReporterBuilder()
.withReporters(new MyStoryReporter())
.withFormats(Format.CONSOLE, Format.HTML, Format.STATS)
In the Embedder method add
embedder = configuredEmbedder();
embedder
.embedderControls()
.doGenerateViewAfterStories(true)
This should be all you need to do to get HTML output.
We wanted more information than is provided in the default output so we created a new StoryReporter class to capture the additional data and '@Override' the existing methods where appropriate. The new reporter class also needs to be added to the mostUseFulConfiguration
.useStoryReporterBuilder(
new StoryReporterBuilder()
.withReporters(new MyStoryReporter())
We also needed to amend or create a new Freemarker template (jbehave-reports-with-totals.ftl) to actually get it to write out the new data from the new story reporter class into an HTML file. I am not going to provide an example here. Please read the Freemarker documentation which is very good.
回答2:
check the reporting setup at JBehave's site.
and check the examples source code here. almost all examples is reporting to html and others.
来源:https://stackoverflow.com/questions/19587337/jbehave-results-displayed-on-a-webpage