I am writing tests using cucumber-jvm and I want the system to stop running tests on the first scenario that fails. I found example code written for Cucumber Ruby that does thi
I could not find any way to do it natively with Cucumber-JVM, but you can always do this:
static boolean prevScenarioFailed = false;
@Before
public void setup() throws Exception {
if (prevScenarioFailed) {
throw new IllegalStateException("Previous scenario failed!");
}
// rest of your setup
}
@After
public void teardown(Scenario scenario) throws Exception {
prevScenarioFailed = scenario.isFailed();
// rest of your teardown
}