Questions tagged [testkit]

21 questions
10
votes
2 answers

How to test that Akka actor was created in Scala

I'm trying to write a test that will verify that my actor below is creating a heartBeatExpireWorker and a heartBeatAccepter, but I have no idea how to do it. First I was thinking I could use Mockhito mock or a spy in place of context and then…
HappyCoder86
  • 2,127
  • 2
  • 22
  • 38
8
votes
3 answers

Logging all messages sent to an Akka TestKit TestProbe

I'm trying to log all messages received by a TestKit TestProbe, which is proving to be somewhat difficult. I'm aware of the Actor Logging section in the docs where it says one should use the debug.receive option in combination with a LogginReceive…
fresskoma
  • 24,302
  • 9
  • 79
  • 122
3
votes
2 answers

Akka Scala TestKit test PoisonPill message

Given that I have a Supervisor actor which is injected with a child actor how do I send the child a PoisonPill message and test this using TestKit? Here is my Superivisor. class Supervisor(child: ActorRef) extends Actor { ... child ! "hello" …
Ayub Malik
  • 2,308
  • 3
  • 23
  • 38
3
votes
1 answer

How to ignore single test in testKit

I have a series of tests in the same class all testing the same feature , how can I skip/ignore a single one e.g: class FooTest(_system: ActorSystem) extends TestKit(_system) with ImplicitSender with WordSpecLike with Matchers { implicit val…
igx
  • 3,381
  • 6
  • 32
  • 68
3
votes
2 answers

Howto test Custom Json Objects with Spray Routing

I'm creating a Rest API with spray-routing on top of mongodb for some CRUD operations, this all works fine, expect whenever I try to test it with specs2 the following specification class RestServiceSpec extends Specification with Specs2RouteTest…
Gertjan Assies
  • 1,880
  • 13
  • 23
2
votes
1 answer

Akka Net Integration Test

I have a fairly simply scenario where I want to do a straight forward integration test. High level overview, is: I have an actor which responds to a message called PlaceOrder I want to verify this actor publishes another message upon receiving…
Dr Schizo
  • 3,245
  • 3
  • 28
  • 65
2
votes
2 answers

Is it possible to use sbt testOnly with Slick TestKit?

When I execute sbt testOnly *JoinTest* no tests are found and the following output is shown, but com.typesafe.slick.testkit.tests.JoinTest should have been executed: testOnly *JoinTest* [info] Compiling 1 Scala source to…
LuGo
  • 4,620
  • 1
  • 15
  • 19
1
vote
1 answer

How to test the behaviour of an akka actor, if it reads from `stdin` and writes to `stdout`?

I'm writing a UCI interpreter, as an Akka Finite State Machine. As per the specification, the interpreter must write its output to stdout, and take its input from stdin. I have a test suit for the actor, and I can test some aspects (message related)…
Bruno Unna
  • 411
  • 5
  • 14
1
vote
1 answer

Akka.NET Persistence unit testing - PersisteAll/PersistAllAsync never runs

I have a problem in some unit tests of a ReceivePersistentActor implementation using PersistAll and PersistAllAsync methods. The problem is that when unit testing with TestKit.NUnit, the PersistAll/Async calls never call their completion callbacks.…
AndyMoose
  • 333
  • 1
  • 10
1
vote
1 answer

akka: test for a message modulo some fields

I am currently testing an akka application. I have come across a certain pattern: I want to test that a TestProbe has received a certain message, modulo some fields. For example, if the message was: UserInfo(username: String, score: Int, timestamp:…
Mullefa
  • 1,107
  • 1
  • 14
  • 23
1
vote
1 answer

Logging recieved message with akka testkit

I'm trying to code some test cases for my actors, the problem is that some tests fail and I can't get a clue of why are they failing. In a normal scenario my code is working fine (Without any tests), but for my tests I'm mocking some parts of the…
danielrvt
  • 8,650
  • 14
  • 65
  • 110
1
vote
1 answer

Akka actor testing

Since I am currently writing Testcases for my Akka application (http://doc.akka.io/docs/akka/snapshot/scala/testing.html) I was wondering if there is a way to test the interface of an actor. What I mean with that, is that I 'd like to check if the…
Coxer
  • 1,585
  • 2
  • 25
  • 41
1
vote
1 answer

Testing play controller's interaction with an akka actor

My play application uses an akka actor to handle a long running computation: class MyController(myActor : ActorRef) extends Controller{ def doStuff = Action { implicit request => val response : Future[Any] = myActor ? DoStuff Async{ …
mushroom
  • 5,637
  • 5
  • 31
  • 60
0
votes
1 answer

Akka: Test scheduled actors using Testkit

I have a parent actor which creates a child actor and the child actor greets parent every minute as below class MasterActor extends Actor with ActorLogging { override def receive: Receive = { case "Greet" => print("Hey…
Steve
  • 85
  • 9
0
votes
0 answers

Make a TestProbe to forget all the messgaes

I am writing a code in a test driven way, and after having written many tests, I introduced a new actor, and in my test environment I use a TestProbe for it. Now in the n-th test, I am testing that the new actor receives a message. But the message…
marco
  • 621
  • 5
  • 18
1
2