問題描述
如果測試用例在量角器中失敗,有沒有辦法退出測試套件并停止執行進一步的測試用例?
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.
第一次失敗后退出有相關的公開討論/問題,--fail-fast
選項:
There are relevant open discussions/issues on exiting after a first failure, --fail-fast
option:
- 第一次失敗時保釋
- --fail-fast 選項?
- 請添加--fail-fast支持
長話短說,這是一個未解決的問題,有一天 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
jasmine 設置.如果您將其設置為 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
}
}
這篇關于如何阻止量角器在失敗時運行進一步的測試用例?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!