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