When we develop an Akka application, we should write an automated test for our actors to check whether they are working as expected. Since the actor model is different as they are asynchronous in nature, we have a different view of how we will perform unit tests on them.
First of all, we will add the akka-testkit
dependency to our application's build.sbt
. So, add the following dependency to build.sbt
:
libraryDependencies += "com.typesafe.akka" % "akka-testkit_2.11" % "2.4.4" libraryDependencies += "org.scalatest" % "scalatest_2.11" % "3.0.1"
Now move to the project root directory and run the sbt update
command; it will download the preceding dependencies. Now import the Hello-Akka
project in the IDE.