You should then configure

storyControls.doResetStateBeforeScenario(false)

so that the previous failure will not be reset and it will be reported at the end of the execution.

On 22/06/2015 17:43, Paul Robbins wrote:
Hi All,
I have a few scenarios that are parameterised by an example table. I want to do some specific processing afterwards depending on whether or not the scenario was a success or a failure. This problem I'm running into is that jBehave is treating the result of the LAST example as the result for the WHOLE scenario. So, if the first two examples fail but the last one succeeds (as in my sample below) the scenario will be treated as a success. Does anyone know of any way to configure this so that if ANY of the examples fail the whole scenario is considered a failure? To be clear I only want to do the processing AFTER the whole scenario has run, so using uponType=ScenarioType.EXAMPLE will not work. I've included my sample code below:

Story File:
|
Feature: Some Feature

Narrative:
As a user
I want to do a thing
So that I can do another thing

Scenario: Some scenario

Given a word '<word>'
When something happens
Then something else should happen

Examples:
|word|
|lemon|
|lemon|
|banana|
|

Step File:
|
public class SomeSteps {

@AfterScenario(uponType=ScenarioType.NORMAL, uponOutcome=Outcome.FAILURE)
public void afterScenarioFail () {
System.out.println("******FAILURE");
}

@AfterScenario(uponType=ScenarioType.NORMAL, uponOutcome=Outcome.SUCCESS)
public void afterScenarioPass () {
System.out.println("******SUCCESS");
}

@Given("a word '$word'")
public void performSearch(@Named("word") String word) {
if(!"banana".equals(word)) {
fail("Failed");
}
}
@When("something happens")
public void imageResultsDisplayed() {
}

@Then("something else should happen")
public void seeRefinedSearchSuggestion() {
}
}
|


--
You received this message because you are subscribed to the Google Groups "JBehave User" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>. To view this discussion on the web, visit https://groups.google.com/d/msgid/jbehave-user/cd5c437b-33bb-41d3-ac20-6f181e4bfba1%40googlegroups.com <https://groups.google.com/d/msgid/jbehave-user/cd5c437b-33bb-41d3-ac20-6f181e4bfba1%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "JBehave 
User" 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-user/5588357E.3030305%40aquilonia.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to