I have a sort of solution.
I can add the following to a step class
@AfterScenario(uponType=ScenarioType.EXAMPLE,
uponOutcome=Outcome.FAILURE)
public void end() throws Exception {
pages.loginPage().end();
}
@BeforeScenario(uponType=ScenarioType.EXAMPLE)
public void start() throws Exception {
pages.loginPage().start();
}
and then this to the page object:
public void start() throws Exception {
if (init) {
((RemoteWebDriverProvider) getDriverProvider()).initialize();
init = false;
}
}
private boolean init = false;
public void end() {
((RemoteWebDriverProvider) getDriverProvider()).end();
init = true;
}
Not very elegant but it will end the session on an example failure and
start the next one if it was ended. Not going to work for a multi-threaded
scenario though.
On 23 May 2013 14:10, Paul Mander <[email protected]> wrote:
> I'm using jbehave and selenium to perform regression tests on an
> application as part of my CI process. I want to expand the coverage of
> these tests which means running the same scenarios hundreds of time with
> different data.
>
> I am using Parameterized scenarios such as
>
> When <user> logs on with password <pass>
> Then landing page is shown
> When user searches for customer <customer>
> Then the customer name "<name>" is shown
> When user logs off
> The logon page is shown
>
> Examples:
> |user|pass|customer|name|
> |test1|test1|001|Fred Bloggs|
> |test1|test1|001|George Bloggs|
> |test1|test1|001|Susan Bloggs|
> |test2|test2|001|Fred Bloggs|
> |test2|test2|001|George Bloggs|
> |test2|test2|001|Susan Bloggs|
>
> etc
>
> I know how to configure the tests so that that continue with other stories
> and scenarios if a failure happens but I need also to
>
> a) run the example line in the example if one fails
> b) start a new browser session for each example
>
> I need 'b' because the failure would not log off the app...
>
> Thanks
>
>
>