Graham,

Not sure that anyone answered this - there is no @BeforeStep /
@AfterStep as you've obviously looked for.
There is the monitoring interfaces - you may be able to do what
you want to do via a StepMonitor.

The other option is to use AOP on your steps classes - however
this will potentially hit a bug in that the generated code no
longer looks like a steps class as the @Given/@When/@Then
annotations aren't seen by JBehave anymore - this depends on your
AOP solution and at some point we will have an unwrap(object)
method on a configurable interface somewhere to allow for AOP on
Steps.

Hope that helps
Brian

----- Original message -----
From: "Graham Abell" <[1][email protected]>
To: [2][email protected]
Date: Wed, 15 Feb 2012 11:36:29 +0000
Subject: [jbehave-user] run code before and after each step
Hi,

Does anyone know if it's possible to create beforeStep(),
afterStep() methods? how can I register methods like that to be
called?

We're managing our logs in a DB so I basically want to be able to
indicate in the logs that a step has started and therefore all
logs below it belong to that step and then finish the step. So
ideally I'd like to be able to pass the test of the step
including any parameters for example,

@"when my order total is $value"
public void placeOrder(double value)
{
...
}

I'd like to be able to call:
createStepInLogs("when my order total is 50");

thanks!
graham

References

1. mailto:[email protected]
2. mailto:[email protected]

Reply via email to