Hi Geert,

you could use the lifecycle steps before/after the desired scenarios. Which steps you run can be controlled via meta properties:

https://github.com/jbehave/jbehave-core/blob/master/examples/core/src/main/java/org/jbehave/examples/core/stories/lifecycle.story

Cheers

On 23/07/2015 11:17, woozong wrote:
Hi all,

I'm investigating how to use jbehave in the project that I'm working on.
My initial feeling is that this matches very well with what we're trying to do.

I have a technical question on implementing Steps, and could not find what I was looking for in the API docs.

Depending on the story/scenario that will be run, some steps (Then...) will need to initialize listeners on a message-bus, to verify if a specific message was sent out. But what we don't want to do, is initialize all possible listeners for all possible types of messages in the system. We would like to only initialize the listeners needed for the scenario about to be run.

Is there a way we can hook into jbehave somewhere (i.e. between the parsing/finding of necessary steps for a scenario and the actual execution of steps), so that the appropriate listeners can be initialized ? (Problem is that a "When" step might trigger a message on the bus, so it needs to be captured for later evaluation in a "Then" step, hence the appropriate listener initialized and only capture messages that will be tested/verified)

In what I have in mind, this would be the sequence of events:
1) parse story/scenario
2) match/find appropriate steps for the scenario
3) =>> call some 'initialize' methods on the selected steps
4) run the scenario (i.e. execute the sequence of steps for the scenario)

Is there an easy way to do this ?

Many thanks in advance,

Geert

--
You received this message because you are subscribed to the Google Groups "JBehave User" group. To unsubscribe from this group and stop receiving emails from it, send an email to jbehave-user+unsubscr...@googlegroups.com <mailto:jbehave-user+unsubscr...@googlegroups.com>. To post to this group, send email to jbehave-user@googlegroups.com <mailto:jbehave-user@googlegroups.com>. To view this discussion on the web, visit https://groups.google.com/d/msgid/jbehave-user/5413938a-ba65-436d-bffa-de5c754a7c25%40googlegroups.com <https://groups.google.com/d/msgid/jbehave-user/5413938a-ba65-436d-bffa-de5c754a7c25%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "JBehave 
User" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jbehave-user+unsubscr...@googlegroups.com.
To post to this group, send an email to jbehave-user@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/jbehave-user/55B0E3DD.4050903%40aquilonia.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to