2012-06-08 66 views
26

我需要将我的测试用例之一放入“待处理”状态。Specs2:忽略指定消息?

我想要在运行测试时在输出上显示某些消息,比如JUnit与@Ignore("Pending: issue #1234 needs to be fixed")

是否有与Specs2的等价物?

class MySpec extends mutable.Specification { 
    args(skipAll = true) // Can I include a message here in the output somehow? 

    "cool MyClass feature" should { 
    "which is broken unfortunately" in { 
     failure 
    } 
    } 
} 

在此先感谢!

回答

39

对于个别例子,我相信你可以使用:

class MySpec extends mutable.Specification { 

    "cool MyClass feature" should { 
    "which is broken unfortunately" in { 
     failure 
    }.pendingUntilFixed("message about the issue") 
    } 

} 

我不知道是否有扩大这在一个规范的所有例子标记为与相同的消息未决的方式,如你似乎希望。

+6

你也可以在你的例子中使用'Pending(“message”)'而不是'failure'(假设之前没有调用'FailureException',在这种情况下'pendingUntilFixed是最好的方法) – Eric

+0

Thx for帮助,也是@Eric替代方法。 – rlegendi

+2

我认为答案实际上是错误的 - 不编译。 .pendingUntilFixed(“关于该问题的消息”)必须移动一行。 –