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
Creating cucumber hooks in the step definition file helps to stop the test after a scenario fails. This involves creating @Before and @After methods. Take a look at this example:
@Before
public void setUp() {
if (prevScenarioFailed) {
throw new IllegalStateException("Previous scenario failed!");
}
}
@After()
public void stopExecutionAfterFailure(Scenario scenario) {
prevScenarioFailed = scenario.isFailed();
}