如何阻止量角器在失败时运行更多的测试用例?
如果测试用例在量角器中失败,是否有办法退出测试套件并停止执行更多测试用例?
Is there a way of quitting test suite and stop executing further test cases, if a test case fails in protractor?
如果是 jasmine
测试框架,你不是第一个询问它的人。
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:
- Bail on first failure
- --fail-fast option?
- Please add --fail-fast support
长简而言之,这是一个开放的问题,有一天 jasmine
会内置这个功能。目前,使用第三方 jasmine-bail-fast
模块。
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.
除此之外,还有一个方便的 realtimeFailure
茉莉花设置。如果你将它设置为 true
它将不会在整个测试运行中失败,但它会实时显示错误 - 发生后立即 - 这可能会涵盖您的用例。在中设置jasmineNodeOpts
:
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
}
}