Hi Mauro,
Finally I could return to my tests with jbehave / bdd stuffs....
I did what you suggest me, but I think it will not work for my case too
for while... Its because the beforeStory and afterStory are being called
for every textual file, including each Given Scenarios.
So if I have one main scenario file with only one scenario and two Given
Scenario for that scenario, I could see that those methods will be
called before and after each Given Scenarios and again before and after
the main scenario of the main file.
Is that the right behavior?
Shouldn't those methods be called only on time in that file?
thanks and best regards
Cristiano
Mauro Talevi escreveu:
Cristiano Gavião wrote:
Hi Mauro,
Im using selenium and I've made a LOGIN scenario where I can setup a
session with some context variables that will be used for all
application.
So I am using Given Scenarios to reuse it across all other scenarios
on my system test...
But my strategy is not working because after every scenario jbehave
close and stops selenium...
@AfterScenario
public void afterScenario() throws Exception {
selenium.close();
selenium.stop();
}
And I need to only close and stops selenium after the last
scenario... ( I think it should be the same when having more than one
scenario in same file).
For now, I've removed @AfterScenario and @BeforeScenario from
SeleniumSteps class... and I'm doing these calls manualy on my own
steps...
Question: Is there a way to catch when the first scenario that have
giveScenarios have starded (or more than one scenario in a file)? and
maybe to know when the last scenario have fineshed?
Hi Cristiano,
at the moment, there is no lifecycle management at story level in the
same way there is at scenario level (ie with @Before/After annotations).
I guess there is nothing stopping us from introducing
@Before/AfterStory annotations.
In the interim, you could think about decorating the ScenarioReporter,
specifically the beforeStory() and afterStory() events, which are
invoked at the beginning and end of each textual scenario:
public class SeleniumLifecycleDecorator implements ScenarioReporter {
private final ScenarioReporter delegate;
private final SeleniumLifecycleManager manager;
public SeleniumLifecycleDecorator(ScenarioReporter delegate,
SeleniumLifecycleManager manager) {
this.delegate = delegate;
this.manager = manager;
}
public void beforeStory(final Blurb blurb) {
delegate.beforeStory(blurb);
manager.start();
};
public void afterStory() {
delegate.afterStory();
manager.stop();
}
}
Cheers
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email