如何在testKit中忽略单个测试

igx*_*igx 3 scala akka testkit akka-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
      }
}
Run Code Online (Sandbox Code Playgroud)

我确实使用了,registerIgnoredTest("test to be ignored")但我必须删除in.有更优雅的解决方案吗?像注释一样

moh*_*hit 5

你正在使用WordSpecLike.在WordSpecLike,忽略一个测试,你应该改变inignore类似"test to be ignored " ignore {....

不同的规范有不同的方式来做到这一点.如果你正在使用FlatSpec,你可以注释与ignore should喜欢ignore should "test to be ignored " in {....

您可以查看scalatest 标记部分以获取更多详细信息.