I'm using Cucumber + Java + Selenium to UI test an application.
I'm using the same set of tests whether my application is deployed in qualification (for tests) or in production.
However, when I'm in production, I would like to stop my tests sooner (as to not save the data I just changed in my test).
So, is there a way to make a cucumber test scenario stop and exit with success even though all the steps weren't played?
I have found this answer who is useful. However, I'm using JUnit 5 (not 4 like in the answer) and if I try using:
import org.junit.jupiter.api.Assumptions; Assumptions.assumeTrue(HOME_PAGE.contains("qual"));
My test exit with an error.
I have though about using
System.exit(0);. However, this exit everything without execution the
@After of my test (so my test don't end really cleanly) and all the tests scenarios that were supposed to be played after are skip! (nb: I just want to skip the remaining steps, not scenarios.)
So, is there a way that I can skip some test's steps, exit the test scenario with success and happily go to the next test scenario (without having everything ending like it's the case when using "System.exit")?