Akka comes with a dedicated module akka-testkit for supporting tests at different levels.
Questions tagged [akka-testkit]
140 questions
3
votes
2 answers
Akka Http Test Gzip Response
So, I have a set of Akka Http routes written in scala. Which looks like this
val route: Route = {
handleRejections(PrimaryRejectionHandler.handler) {
handleExceptions(PrimaryExceptionHandler.handler) {
cors() {
…

debduttoc
- 304
- 2
- 9
3
votes
1 answer
Mocking child actor in Akka
I'm trying to write unit tests for my actor and am stuck on basic mocking.
PriceAggregateActor is using akka persistence and I don't want to pass in all the conf for it and would like to mock it completely.
This is the actor that I want to…

Reeebuuk
- 1,363
- 2
- 21
- 42
3
votes
1 answer
Scala and Akka - Testing actors as a system with Akka Testkit
In my Scala application say I have Actor A and Actor B. I want to devise a test case in ScalaTest that would allow me to send a message to Actor A and see what message it sends to Actor B in order to see if A is properly processing it's data and…

Rig
- 1,276
- 3
- 22
- 43
3
votes
1 answer
How to not bind to localhost with ScalatestRouteTest
I want to test routes with ScalatestRouteTest as follows:
trait MyRoutes extends Directives {
self: Api with ExecutionContextProvider =>
val myRoutes: Route =
pathPrefix("api") {
path("") {
(get & entity(as[MyState])) {
…

user2609980
- 10,264
- 15
- 74
- 143
3
votes
2 answers
Find out which Akka version is used by Play
I need to add dependency on akka-testkit to my Play! application. I would like to avoid hardcoding the version of Akka and stick to the one used by Play instead (to ensure compatibility).
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test…

Artur Nowak
- 5,254
- 3
- 22
- 32
3
votes
1 answer
simulate network partition using akka cluster multi-jvm testkit
I'm trying to build a brain split resolver for akka cluster. But it's quite hard to simulate the scenario where certain nodes are unreachable from the rest of the origin cluster and form their own cluster.
It can't be done by stoping and restart…

vincent chou
- 91
- 2
- 8
3
votes
1 answer
Testing self message send in Akka.NET
I am new in Akka.NET, at moment I am having difficulty in test if my actor sent any message to himself.
This is my actor code:
public class MySuperActor : ReceiveActor
{
private readonly IActorRef _anotherActor;
public…

Alberto Monteiro
- 5,989
- 2
- 28
- 40
3
votes
1 answer
Akka Actor restarts after exception during Unit test
My Actor looks like
import akka.actor.Status.Failure
import akka.actor.{Actor, ActorLogging, Props}
import akka.event.LoggingReceive
object Runner {
def props(race: Race) = Props(classOf[Runner], race)
}
class Runner(race: Race) extends Actor…

daydreamer
- 87,243
- 191
- 450
- 722
3
votes
1 answer
TestActorRef: Could not get the underlyingActor, says Nothing
I am trying to write my first ScalaTest for following Actor
object Runner {
def props(race: Race) = Props(classOf[Runner], race)
}
class Runner(race: Race) extends Actor with ActorLogging {
import context.dispatcher
…

daydreamer
- 87,243
- 191
- 450
- 722
3
votes
2 answers
Unit testing private methods in Akka
I'm new to akka and I'm trying akka on java. I'd like to understand unit testing of business logic within actors. I read documentation and the only example of isolated business logic within actor is:
static class MyActor extends UntypedActor {
…

Alex Larikov
- 754
- 4
- 11
3
votes
3 answers
Child actor Termination validation
I have following actor hierarchy parent -> child -> worker
where child's life scope is tight to request - when request is completed child actor should be terminated. That I wanted to verify as a part of the test. I created StepParent as a for…

jaksky
- 3,305
- 4
- 35
- 68
2
votes
1 answer
Cannot resolve symbol "TestKit"
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…

Always_a_learner
- 285
- 12
2
votes
1 answer
How to test akka-http route to handle exception?
I have a simple akka-http application to upload files in chunks to the server. It has two routes, the first / opens a HTML form to search the file, and the second route links the upload button to the logic that divide the file in chunks and upload…

Felipe
- 7,013
- 8
- 44
- 102
2
votes
1 answer
Mock actor and its response in unit test
I have an actor that gets initiated inside the actor, i want to mock the actorB so that
the message actorB ? GetDataForProcessing(value) is not sent to actorB and i can test the unit functionality of ActorExp.
My actor is:
class ActorExp(a:…

ARYA
- 223
- 1
- 5
- 15
2
votes
1 answer
Akka http testkit, how to test streaming response timing
I am trying to test an endpoint that I write using Akka HTTP.
This endpoint transform a source of something into a streaming HTTP response.
I would like to be able to test timing of this response, for example, I would like to express something such…

Luc DUZAN
- 1,299
- 10
- 18