【问题标题】:How to ignore single test in testKit如何忽略 testKit 中的单个测试
【发布时间】:2015-05-16 06:36:27
【问题描述】:

我在同一个课程中有一系列测试都在测试相同的功能,我如何跳过/忽略单个测试,例如:

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。有更优雅的解决方案吗?喜欢注释

【问题讨论】:

    标签: scala akka akka-testkit testkit


    【解决方案1】:

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

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

    您可以查看scalatest tagging 部分了解更多详情。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-27
      • 1970-01-01
      • 1970-01-01
      • 2020-04-14
      • 1970-01-01
      • 2017-04-01
      相关资源
      最近更新 更多