Hi Mauro,

thank you for your fast response. My mistake, I meant @BeforeScenario. 

What I want to do is sth. like that:

private HumanBuilder humanBuilder = new HumanBuilder();
private Human human;

@Given("the human is male")
public void humanIsMale() {

humanBuilder.withGender(Gender.MALE);
}

@Given("the human is 26 years old")
public void humasIs26() {

humanBuilder.withAge(26);
}

@AfterGiven
public void buildEntities() {

human = humanBuilder.build();
}

@When("the human buys a, insurance")
public void humanBuysInsurance() {

human.buyInsurance();
}

@Then("the human is poor")
public void humanIsPoor() {

Assert.assertEquals(0, human.getMoney());
}

That way I can make sure in the builder that the generated entity is 
consistent and I can reuse this builder in every jUnit and jBehave test.

Thank you very much,
Marcus

Am Freitag, 23. Oktober 2015 22:53:40 UTC+2 schrieb mauro.talevi:
>
> Hi,
>
> there is no such feature at present and no @BeforeSteps annotation. 
>
> Could you please provide an example of how you'd use this feature? 
>
> Thanks
>
> On 23/10/2015 12:01, Marcus Held wrote:
>
> Hi,
>
> I would like to have a hook between the @Given and @When steps in every 
> scenario. Similar to the @BeforeSteps etc. annotation. 
> The purpose is, that I'd like to use builders to create all the entities 
> in the @Given steps that I use in my scenario. That way I can assure that 
> every used entity in the @When and @Then has a consistent state.
>
> Is something like that already planned or even existent?
>
> Greetings,
> Marcus
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JBehave Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected] 
> <javascript:>.
> To view this discussion on the web, visit 
> <https://groups.google.com/d/msgid/jbehave-dev/389c3db9-878d-405f-afb3-9931d2ae7231%40googlegroups.com?utm_medium=email&utm_source=footer>
> https://groups.google.com/d/msgid/jbehave-dev/389c3db9-878d-405f-afb3-9931d2ae7231%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JBehave Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/jbehave-dev/4e8d9be7-f909-47c8-aa12-58878a1e423a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to