It is and the org/jbehave/examples/trader/stories/trader_is_alerted_of_status.story proves it.

On 21/09/2012 17:29, Roy de Kleijn wrote:

True,

But why is the @BeforeScenario (without uponType) not being executed?

*From:*Mauro Talevi [mailto:[email protected]]
*Sent:* vrijdag 21 september 2012 18:28
*To:* [email protected]
*Subject:* Re: [jbehave-user] beforestory doesn't run if I specify examples

You're confusing scenarios and examples. A scenario may be made up of multiple example scenarios, but it's still one overall scenario. As such the @BeforeScenario applies to the overall scenario, regardless of the fact that you have examples.

The @BeforeScenario(|uponType=ScenarioType.EXAMPLE)| applies to individual example scenarios, if you have examples tables.

On 21/09/2012 13:09, Roy de Kleijn wrote:

    So, you can't have one @BeforeScenario method which is executed
    before scenarios with AND without examples?

    Thanks,
    Roy

    ------------------------------------------------------------------------

    *Van:*Mauro Talevi [[email protected]
    <mailto:[email protected]>]
    *Verzonden:* vrijdag 21 september 2012 12:13
    *Aan:* [email protected] <mailto:[email protected]>
    *Onderwerp:* Re: [jbehave-user] beforestory doesn't run if I
    specify examples

    @BeforeScenario executes before each scenario.

    |@BeforeScenario(uponType=ScenarioType.EXAMPLE) executes before
    each example in a scenario.|


    The
    org/jbehave/examples/trader/stories/trader_is_alerted_of_status.story
    show this in action.

    On 21/09/2012 10:45, Roy de Kleijn wrote:

        |This one doesn't work:|
        |@BeforeScenario|

        |public||void||beforeEachScenario() {|

        |    // ...|

        |}|

        |This one is working for scenarios with examples, but not for
        scenarios without examples.|

        |@BeforeScenario(uponType=ScenarioType.EXAMPLE)|

        |public||void||beforeEachExampleScenario() {|

        |    // ...|

        |}|

        |Do I something wrong? or how can I get it work for both cases?|

        ------------------------------------------------------------------------

        *Van:*Roy de Kleijn [[email protected]
        <mailto:[email protected]>]
        *Verzonden:* vrijdag 21 september 2012 11:21
        *Aan:* [email protected]
        <mailto:[email protected]>
        *Onderwerp:* RE: [jbehave-user] beforestory doesn't run if I
        specify examples

        I mean the code in the beforeScenario is not being executed..

        ------------------------------------------------------------------------

        *Van:*Mauro Talevi [[email protected]
        <mailto:[email protected]>]
        *Verzonden:* vrijdag 21 september 2012 11:16
        *Aan:* [email protected]
        <mailto:[email protected]>
        *Onderwerp:* Re: [jbehave-user] beforestory doesn't run if I
        specify examples

        What do you mean by "beforestory doesn't run"?

        On 21/09/2012 10:15, Roy de Kleijn wrote:

            Hi,

            Is it true that we can't use beforestory if we like to
            specify Examples?
            In my case it isn't executed, only if I remove the examples.


            Thanks,
            Roy


Reply via email to