Home > other >  Cannot resolve symbol "TestKit"
Cannot resolve symbol "TestKit"

Time:10-05

Getting started with "Testing Akka Actors"

I think there is something wrong with my "akka-testkit" library-dependency. I copied it from Lightbend Testing Classic Actors

build.sbt

version := "0.1.0-SNAPSHOT"

scalaVersion := "2.12.7"

val akkaVersion = "2.5.13"

libraryDependencies   = Seq(
  "com.typesafe.akka" %% "akka-actor" % akkaVersion,
  "org.scalatest" %% "scalatest" % "3.0.5",
  "com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test
)

.scala

package part3testing

import akka.actor.ActorSystem
import akka.testkit.TestKit

class BasicSpec extends TestKit(ActorSystem("BasicSpec")){

}

CodePudding user response:

Marking a dependency as % Test means that only code in the test directories (by default, src/test) will depend on it. Main application code (by default in src/main) does not depend on test-scope dependencies; the benefit of this is that the test dependencies aren't needed for distributing/deploying the built software so don't get included or need to be provided.

  • Related