Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AfterScenario method seems not to be invoked for injected stages #433

Open
adrian-herscu opened this issue Oct 24, 2019 · 0 comments
Open

Comments

@adrian-herscu
Copy link

== Context ==
Stages added as per documented here
http://jgiven.org/userguide/#_stage_injection

As described in
http://jgiven.org/userguide/#_dynamic_adding_of_stages
Before/AfterScenario methods are supposedly invoked for these stages.

== The issue ==
I have no time to prove it now but it appears that having:

class Test extends ScenarioTest<G,W,T> {
  @ScenarioStage
  protected G extraFixtures;
  @ScenarioStage
  protected W extraActions;
  @ScenarioStage
  protected T extraVerifications;
  
  @Test
  public void shouldDoSomething() {
    given().something();
    extraFixtures.given().something();
    ....
    extraVerifications().then().it_should_work();
    then().it_should_work();
  }
}

At least in my case, the @AfterScenario method is not called for the extraXXXX scenario.

** I am running on TestNG, so this behavior might be specific to that only.
** Sometimes we need to work with several similar resources, e.g. two database connections or two browsers, in order to test some messaging scenario; in such cases the additional resource is not released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants