You can clone with
HTTPS or Subversion.
I think it would be very useful to stop execution of a testcase if the beforeEach fails (i.e. throws an exception or similar).
Example: precondition is used for login -> if the login does not succeed, it does not make any sense to run the actual test.
I already tried to expect() something in the beforeEach (or in a function that it calls, to be more exact), and throwing an exception. The first did not work at all for my purposes (as other steps in the beforeEach were still executed), the 2nd at least registers as an error but the execution still continues.
Or maybe something like an option to stop executing the testcase as soon as one expectation fails could work, but I didn't find any such option.
Having a manual way of stopping a test case execution would be really handy. For example when creating tests for Selenium Webdriver and during the flow for example login fails thus I cannot perform rest of my steps I could fail the test with predefined message and skip the rest of the execution and jump to next one.
Is a manual fail method sufficient? If so, we have this in our backlog.
I don't think the manual fail method solves this by itself. It sounds to me like the desired behavior is that a single spec stops execution upon encountering its first expectation failure or exception and proceeds straight to the next spec. This would probably need to be some other kind of option to jasmine similar to whats requested in #414 but for a single spec instead of the whole suite.
I'm not sure what we would want to do as far as afterEach calls in this mode as well.
I've created a set of stories in tracker that detail how we want to address this issue.
Story for core: https://www.pivotaltracker.com/story/show/1165916
Story to update npm: https://www.pivotaltracker.com/story/show/89323102
Story to update gem: https://www.pivotaltracker.com/story/show/89323040
Story to update py: https://www.pivotaltracker.com/story/show/89323226
We'd be happy to review pull requests for this functionality.
Thanks for using jasmine!
Allow user to stop a specs execution when an expectation fails
[finish #1165916] #577