2015-03-13 177 views
3

单一的测试我有一系列的测试,在同一类别的所有测试相同的特征,我怎么能跳过/忽略一个一个如:如何忽略testKit

class FooTest(_system: ActorSystem) extends TestKit(_system) 
with ImplicitSender 
with WordSpecLike 
with Matchers 
{ 
    implicit val timeout = Timeout(10.seconds) 

    def this() = this(ActorSystem("TESTActorSystem")) 

    "Service " should { 
    "test something" in { 
     OK 
     } 
    } 
    "test to be ignored " in{ 
     "Not implemented" //ignore this test 
     } 
} 

我没有使用registerIgnoredTest("test to be ignored")但我必须删除in。有更优雅的解决方案吗?像注释

回答

4

您正在使用WordSpecLike。在WordSpecLike中,要忽略测试,应该将in更改为ignore,如"test to be ignored " ignore {...

不同的规格有不同的方式来做到这一点。如果您使用的是FlatSpec,则可以使用ignore should注释ignore should "test to be ignored " in {...

你可以看到scalatesttagging部分了解更多详情。