serenity-bdd / serenity-maven-plugin

19 stars 21 forks source link

Get status of Story in @AfterStory block (JBehave custom StoryReporter) #51

Closed oleks-d closed 7 years ago

oleks-d commented 7 years ago

Hi,

I have to run specific code after execution of story based on story status. I think using of JBehave @AfterStory will help Problem is: How to get status of current story execution from @AfterStory?

Looks like solution is implementation of custom StoryReporter (org.jbehave.core.reporters.StoryReporter).

But how to use it in Serenity?

Thank you for your time! Alex

wakaleo commented 7 years ago

You can try using the Serenity event bus to get the latest test outcome, e.g.

        StepEventBus.getEventBus().getBaseStepListener().getTestOutcomes()
oleks-d commented 7 years ago

Thank you! I will try this approach!