I am familiar with the Akka testing approaches defined here:
http://doc.akka.io/docs/akka/snapshot/scala/testing.html
I understand how to use TestKit, TestActorRef, TestProbe etc. I also understand that my core domain logic should be extracted and tested in isolation from Akka.
My question is about strategies for doing TDD on Akka Persistence actors i.e. PersistentActor and PersistentView.
I want to be able to test the following types of scenarios in a reasonably low overhead, efficient manner i.e. as close to a unit test as possible:
- Did the persistent actor persist an event with the correct id?
- Does my snapshot recovery restore state properly?
- Does my view read the correct event?
If anyone knows of a project which can help me see this in action, I would be grateful.
One approach I can think of is to have a test PersistentView which can be used to verify a PersitentActor did its job. Seems a bit convoluted though.
This is not about testing Akka persistence framework itself, but to test that my Actors have been setup properly to use it and the behaviour is as expected.