问题描述
当我们发现我们的一个Protractor Jasmine2规范存在错误时,我们通常希望跳过测试直到错误得到解决。
When we find a bug with one of our Protractor Jasmine2 specs, we usually want to skip the test until the bug has been resolved.
我知道如何使用 xit
或 pending()
和JasmineReporters TerminalReporter在颜色突出显示和列出待定规格方面做得很好。
I know how to do this with xit
or pending()
, and JasmineReporters TerminalReporter is doing a nice job of color highlighting and listing pending specs.
然而,待定测试始终报告没有理由给定
,这意味着可以给出跳过测试的原因。
However, the pending tests always report No reason given
, which implies it is possible to give a reason for the skipped test.
我目前使用问题编号评论规范,但报告禁用测试的原因和问题编号会非常好。
I currently comment the spec with an issue number, but it would be really nice to report the reason the test was disabled and the issue number.
UPDATE
根据要求,添加示例终端输出(fdescribe示例,因此报告大部分套件禁用):
As requested, adding example terminal output ( fdescribe on an example, so reporting most of the suite disabled ):
版本:
量角器2.1.0和Jasmine 2.3.1
Versions:Protractor 2.1.0 and 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()
这似乎已开始标记失败,可能与相关
This appears to have started marking it failed, probably related to 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未决的待处理(消息):
There is currently a feature request to support pending(message) outstanding for Protractor/jasminewd if you want to follow progress :
推荐答案
另一种方法是在测试本身上调用 pend
方法:
Another way would be to call the pend
method on the test itself:
xit('Pending test description', function() {
// test body
}).pend('Reason for being disabled');
这篇关于是否有可能通过xit或pending()发送跳过Jasmine 2规范的原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!