Questions tagged [akka-testkit]

Akka comes with a dedicated module akka-testkit for supporting tests at different levels.

140 questions
0
votes
0 answers

User/Actor not receiving message from system/TestActor Akka TestKit

I have a simple scala class CartService which creates a actor and sends it some message and the actor sends back a response to the service via sender ! result Actor code package actors import java.util.UUID import…
nitin_sh
  • 83
  • 1
  • 9
0
votes
1 answer

How to restart node in Akka Multi Node test?

I want to do some Akka Multi Node test and restart one node when some barrier is reached. Something like: runOn(nodeA) { // do something while both nodes are up and running enterBarrier("nodeBCrashes") // do something while I'm the only node…
gabrielgiussi
  • 9,245
  • 7
  • 41
  • 71
0
votes
1 answer

Test the message returned by an akka actor containing a Try[T]

I am developing an Akka actor that respond with a message of type PutAck[Try[String]]. The problem is not how to develop the actor itself, but the unit tests. Given that the following actor code private def put(store: Map[String, Array[Byte]], key:…
riccardo.cardin
  • 7,971
  • 5
  • 57
  • 106
0
votes
1 answer

Setting the time wait period for Get() in akka-http testkit?

I am using the akka-http test suite. I have the following code, where the test "fails" whenever I delay the server response by more than 1 second. "should give default" in { Get("/test/") ~> route ~> check { responseAs[Array[Byte]]…
stian
  • 1,947
  • 5
  • 25
  • 47
0
votes
0 answers

Why do my actor tests fail non-deterministically?

I'm using Akka 2.4.2 with TestKit and Scalatest for writing and testing actors. It looks like there is a race condition whenever I'm inspecting some mutable state encapsulated by my actor. I have a really simple actor that saves some state in a…
nmurthy
  • 1,337
  • 1
  • 12
  • 24
0
votes
1 answer

Akka.net Testkit does not mark test case failed despite ActorInitializationException exception

Following is the actor, I've defined (trying to get my head around persistent actor!!) public class Country : ReceivePersistentActor { public override string PersistenceId => GetType().Name + state.Id; private CountryState state; …
101V
  • 492
  • 1
  • 6
  • 13
0
votes
1 answer

Akka HTTP Java: not override abstract method yeOldeTestNames() in org.scalatest.Suite

I am going to use akka-http with Java. The routing done successfully and run. But when i trying to write test case using JUnitRouteTest, i got an error. com.james.controllers.PingPongApiTest is not abstract and does not override abstract method…
Harmeet Singh Taara
  • 6,483
  • 20
  • 73
  • 126
0
votes
1 answer

In akka testkit,why use a event rather then a normal method get the actor state?

In book of akka in actor's chapter three. It use a message event to test silent actor's state. The actor as this: object SilentActorProtocol { case class SilentMessage(data: String) case class GetState(receiver: ActorRef) } class SilentActor…
LoranceChen
  • 2,453
  • 2
  • 22
  • 48
0
votes
2 answers

Identifying an Actor using an ActorSelection

I'm writing an Actor that should watch another Actor; let's call the latter one the target. My Actor should stop itself once its target is stopped. For this target I only have an ActorSelection. To watch it, I obviously need an ActorRef, so I…
mthmulders
  • 9,483
  • 4
  • 37
  • 54
0
votes
1 answer

Akka - test supervision strategy

I have the following scenario: the parent supervisor actor creates a child for each message using a factory (function) passed in the constructor. class supervisorActor(childActorMaker: ActorRefFactory => ActorRef) extends Actor with…
ab_732
  • 3,639
  • 6
  • 45
  • 61
0
votes
1 answer

Specs2 tests for activator's minimal-akka-scala-seed fails at times

I attempted to test the ping-pong example (from activator's minimal-akka-scala-seed) using both scalatest, and specs2 (I wrote the specs2 tests myself; see below). The scalatest always passes. However, the specs2 tests do not pass all the time…
Sunil Sandhu
  • 385
  • 4
  • 13
0
votes
2 answers

Akka.NET TestKit getting timeout error

I am testing with NUnit. What am I doing wrong? public class ZipActor : ReceiveActor { public ZipActor() { Receive(message => HandleZipMessage(message)); } private void HandleZipMessage(ZipMessage message) { …
0
votes
1 answer

ExpectMsg error with AkkaTest

I am getting Type mismatch: expected ReaperSpec.this.Register, actual: String where expectMsg(...) is when using AkkaTest with ScalaTest as specified here (http://doc.akka.io/docs/akka/snapshot/scala/testing.html) What am I missing? import…
user1187135
0
votes
1 answer

how to test actor is main class with testkit in scala

I have started writing test for scala actor. I read this blog. http://blog.matthieuguillermin.fr/2013/06/akka-testing-your-actors/ Then I started. I wrote Application Actor. But I realized the application actor which is different others are in blog.…
Burak Dağlı
  • 512
  • 2
  • 10
  • 33
0
votes
1 answer

Akka TestKit how to wait for the message to be processed

In my TestKit test "A History Actor" must { // given val historyActorRef = TestActorRef(new HistoryActor("history-file.log")) // Creation of the TestActorRef val writerActorRef = TestActorRef(new WriterActor("history-file.log")) …
ses
  • 13,174
  • 31
  • 123
  • 226
1 2 3
9
10