Actors are not plain scala objects and that creates a couple of testability issues for me. I managed to sort them out by creating a thin layer over actors to convert my actors to POSO's. (POSO = plain old scala object, if there is such a term :) ). So now I am able to mock any references the actors get.
But I wonder if there is already something out of the box so that I can work out with actors as if they are poso's and still use testkit, testactor, testprobe and TestActorRef's. So for example one of my actors when it receives a msg, it creates a child actor via context.actorOf(...) . It then gets some other actor references from the akka-cluster. It sends those a msg and then waits for a reply from each one of those. Upon reply, it sends itself an other msg via self ! msg. So there were several issues to easily test this via TestKit, TestProbe, TestActorRef. First of all, how would I know that my code actually creates the correct actor when calling context.actorOf(...) ? Then how do I mock/testprobe() the actors from the cluster since I can't mock the cluster itself? Even if I mock the cluster, it becomes tedious to send MemberUp events to the actor under test. Finally how do I know that the actor actually send itself a msg via self ! msg ? Now there are some DI ideas out there but are tedious, i.e. to send deps via a msg , but even so self can't be mocked. Anyway as I said I've created a facade and it works nicely along with testkit but I wonder if there is something already out there. Also a good question is, why actors are not POSO's? -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
