-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Cucumber should support the ability to gracefully abort a test suite #1854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't see much reason to provide this in Cucumber. There are a few way to do this using only the JUnit 4 framework. JUnit SuiteJUnit allows you to compose different runners into a suite. By extending the MavenAlternatively Maven lets you attach a |
Thanks @mpkorstanje - that makes sense. Closing issue. |
@mpkorstanje - just a quick question about the Maven approach: Is it possible for the Listeners added in this way to get a handle on the RunNotifier (in order to request that the suite stop)? |
Ah. You're right.
Pretty sure there is a way because I have seen surefire call pleaseStop
before.
Maybe this?
http://maven.apache.org/surefire/maven-surefire-plugin/examples/skip-after-failure.html
…On Tue, Jan 7, 2020, 10:12 andyRokit ***@***.***> wrote:
@mpkorstanje <https://github.com/mpkorstanje> - just a quick question
about the Maven approach: Is it possible for the Listeners added in this
way to get a handle on the RunNotifier (in order to request that the suite
stop)?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1854?email_source=notifications&email_token=ABVAAZ7CJUYXT7WJULU7XJTQ4RBOJA5CNFSM4KDFBV3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIIGRZY#issuecomment-571500775>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABVAAZZWRK4KP7DMSSSUPJLQ4RBOJANCNFSM4KDFBV3A>
.
|
Yeah - I noticed that mechanism, but that'll stop the run on any failure(s). I'd want to stop the run on a specific event. I.e. "Downstream system X has got into an invalid state, no point in continuing". Surefire doesn't appear to support adding any hooks on its listeners. It just initialises them and adds them. Edit |
Yeah. The other option would be to use |
That's an interesting thought. Thanks for the insight - it's been really helpful. |
Regarding the Maven Surefire option; I opened a feature request for maven surefire to see if it would make sense for them to provide the ability for their custom listeners to abort the test run. |
It is an OSS project and so I expect the user's to develop this feature in Surefire. It is nothing new because this feature exists in three other providers and so it can be, so called, copy-paste in junit5 provider and it is quite feasible feature. Pls participate in the JIRA issue SUREFIRE-1743. If you need me to guide you regarding the development approach, feel free to ask me in JIRA. |
@Tibor17 I didn't see a "please stop" implementation in JUnit 5. I did see you requested one. Would you happen to know if it has been implemented? |
Ah thanks! I think it is possible for JUnit 5 to facilitate this but each |
The TestNG also does not have it implemented and we had to implement a similar extension in provider |
Is your feature request related to a problem? Please describe.
During tests suites, conditions may arise where it makes sense to stop the test suite.
E.g. While running set of integration tests, a downstream system has got into an invalid state.
Currently this is achievable by adding a
System.exit
to the test. E.g.However, that effectively kills the JVM and prevents and other processes completing. E.g. Generating reports or cleaning up data.
I would suggest that a mechanism be added that allow a test to gracefully exit the suite.
Describe the solution you'd like
Add a new RunListener which listens for a specific exception coming from a test failure. If that exception is detected request that the test suite is abandoned using RunNotifier.pleaseStop().
This may be a new cucumber-specific exception or there may already be an exception which fits this purpose. E.g. StoppedByUserException
The text was updated successfully, but these errors were encountered: