Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are TestKit, TestActorRef and TestProbe in Akka?

kind of new to akka actors

but will like the know the use and differences between the TestKit , TastActorRef and TestProbe

as used in akka unit testing.

I have seen them used for unit testing akka systems but do not seem to understand the concept

tried searching the internet but looks like documentation is sparse.

Any brief explanation is welcomed.

thanks ll .

like image 626
faisal abdulai Avatar asked Oct 22 '12 22:10

faisal abdulai


People also ask

What are dispatchers in Akka?

An Akka MessageDispatcher is what makes Akka Actors “tick”, it is the engine of the machine so to speak. All MessageDispatcher implementations are also an ExecutionContext , which means that they can be used to execute arbitrary code, for instance Future s .

What is ActorSystem in Akka?

Companion object ActorSystem An actor system is a hierarchical group of actors which share common configuration, e.g. dispatchers, deployments, remote capabilities and addresses. It is also the entry point for creating or looking up actors. There are several possibilities for creating actors (see akka.

How does Akka handle concurrency?

Akka's approach to handling concurrency is based on the Actor Model. In an actor-based system, everything is an actor, in much the same way that everything is an object in object-oriented design.

What is props in Akka?

Props is a configuration object using in creating an Actor; it is immutable, so it is thread-safe and fully shareable.


1 Answers

Your searching skills need some honing, I think:

http://doc.akka.io/docs/akka/snapshot/scala/testing.html

http://doc.akka.io/docs/akka/snapshot/java/testing.html

But in short:

  • TestKit can be used as base-class for your tests, it provides an internal actor which can receive replies and a host of assertion methods for these replies

  • TestProbe is a wrapped-up TestKit which you can inject into message flows

These two were about integration testing, the next is for unit testing:

  • TestActorRef allows you to peek inside the actor and run its code synchronously, JUnit style.
like image 133
Roland Kuhn Avatar answered Sep 24 '22 23:09

Roland Kuhn