paul
paul

Reputation: 4487

If one scenario fails continue with next Scenario in a cucumber feature file

How can I continue running a feature on failure of 1 scenario to next?

Currently if first Scenario fails out of 10 (lets say) next 9 will not execute and it quits current session on driver/browser (WebDriver).

I am using Cucumber with Java, Junit, Serenity on Windows 7.

Upvotes: 1

Views: 1750

Answers (2)

Manish Kumar
Manish Kumar

Reputation: 1

For anyone who still facing the issue:

I was also getting same issue and resolved it by replacing hard assertions (org.junit.Assert) to soft assertions (org.assertj.core.api.SoftAssertions) in previous scenario that was failing.

For example: Before I was using:

Assert.assertTrue("Error description",true);

Resolved it by:

softAssertion.assertThat(true).as("Error description").isTrue();

Upvotes: 0

paul
paul

Reputation: 4487

After updating all dependencies, plugins in pom.xml to their latest versions, fixed the issue.

Specially -

maven-surefire-plugin, maven-failsafe-plugin, maven-compiler-plugin

Upvotes: 0

Related Questions