How to stop protractor from running further testcases on failure?

Aman Gupta picture Aman Gupta · Mar 6, 2015 · Viewed 19.8k times · Source

Is there a way of quitting test suite and stop executing further test cases, if a test case fails in protractor?

Answer

alecxe picture alecxe · Mar 6, 2015

In case of jasmine testing framework, you are not the first asking about it.

There are relevant open discussions/issues on exiting after a first failure, --fail-fast option:

Long story short, this is an open issue and some day jasmine would have the functionality built-in. Currently, use a third-party jasmine-bail-fast module.

Aside from that, there is a handy realtimeFailure jasmine setting. If you set it to true it would not fail the whole test run, but it would show errors in a real time - immediately after happening - this can possibly cover your use case. Set it in jasmineNodeOpts:

exports.config = {
    seleniumAddress: 'http://127.0.0.1:4444/wd/hub',

    ...

    jasmineNodeOpts: {
        realtimeFailure: true
    }
}