scalaakkaakka-testkittestkit

How to ignore single test in testKit


I have a series of tests in the same class all testing the same feature , how can I skip/ignore a single one e.g:

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
      }
}

I did use registerIgnoredTest("test to be ignored") but I have to remove the in. Is there more elegant solution ? like annotation


Solution

  • You are using WordSpecLike. In WordSpecLike, to ignore a test, you should change in into ignore like "test to be ignored " ignore {....

    Different spec has different way to do it. If you were using FlatSpec, you could have annotated the with ignore should like ignore should "test to be ignored " in {....

    You can see scalatest tagging section for more details.