Reputation: 585
I have slight issue with step customization. I want to add some specific data from Spring context to JBehave report after successful step executing, e.g. I have step:
When login as random user
I want to see in report if all was good something like
When login as random user (%username%)
I found how to execute any logic before/after story/scenario, but I can't find correct way how to add any logic after step and how can I customize/extend basic JBehave steps.
Thank you in advance.
Upvotes: 0
Views: 208
Reputation: 1167
Use StoryReporter
API:
import org.jbehave.core.reporters.NullStoryReporter;
public class MyCustomStoryReporter extends NullStoryReporter {
@Override
public void beforeStep(String step) {
// add "before-step" logic here
}
@Override
public void successful(String step) {
// add "after-passed-step" logic here
}
@Override
public void failed(String step, Throwable cause) {
// add "after-failed-step" logic here
}
}
More information on StoryReporter
and its configuration can be found in the official documentation: Reporting Stories
Upvotes: 2