当我们发现某个量角器Jasmine2规范中的错误时,我们通常希望跳过测试,直到错误得到解决。
我知道如何使用xit
或pending()
做到这一点,JasmineReporters TerminalReporter在颜色突出显示和列出待定规格方面做得很好。
但是,挂起的测试总是报告No reason given
,这意味着可以给出跳过测试的原因。
我目前在规范中添加了一个问题编号,但如果能报告测试被禁用的原因和问题编号,那就太好了。
更新
根据请求,添加示例终端输出(在示例中使用fdescribe,因此禁用了大部分套件的报告):
版本: Protractor 2.1.0和Jasmine 2.3.1
使用xit
Skipped
* will display the platform if available ...
...
SUCCESS: 85 specs, 0 failures, 1 skipped, 72 disabled in 34.734s.
Pending:
1) will display the platform if available
No reason given
使用pending()
这似乎已开始将其标记为失败,可能与https://github.com/angular/protractor/issues/1852有关
Failures:
1) will display the platform if available
Message:
Failed: => marked Pending
Stack:
Error: Failed: => marked Pending
已更新:此功能的相关功能请求和问题
如果您想要跟踪进度,当前有一个功能请求支持Protractor/jasminewd的未决(消息):
https://github.com/angular/jasminewd/issues/32 https://github.com/angular/protractor/issues/2454
发布于 2015-09-29 16:28:09
另一种方法是在测试本身上调用pend
方法:
xit('Pending test description', function() {
// test body
}).pend('Reason for being disabled');
发布于 2015-07-29 07:31:06
pending()
接收一个message
参数,该参数实际上是一个“挂起的原因”:
pending("doesn't work, issue #123")
仅供参考,以下是初始功能请求:
以及官方文档:
https://stackoverflow.com/questions/31688650
复制相似问题