Hi Erich, the PersistenceSpec trait is targeted at the akka-persistence test suite (since it uses AkkaSpec which is not part of the published artifacts), so your uncertainty is understandable. EventsourcedProcessors are in principle tested just like normal actors, with the complication that the Journal—should it be persisted on disk—will transport state across test runs. One feature that is missing at this point is a test facility that provides an in-memory journal (we have that, but `private[persistence]`) with the ability to set snapshots and messages for a given processorId (currently clumsy) and a nice DSL for formulating test setup and persisted state verification (missing)
What I imagine this to look like is the following: val pt = PersistenceTestKit(system) val name = "myActor" val processorId = s"blog-$name" // clear out event store and set new log contents pt.setEvents(processorId, Seq( event1, event2, event3)) val actor = system.actorOf(props, name) actor ! command1 expectMsg(reply1) // this also implicitly verifies that the processorId is set correctly within the actor // retrieve only those events which were not created via setEvents above pt.getCreatedEvents(processorId) must be(Seq(event4, event5)) Alternatively there could be a pt.setSnapshot(processorId, …) if the list of events would be too long, but I would recommend not taking that route unless really forced to, because the internal representation (i.e. the snapshot) can change over time, while the events should remain valid “forever”. Think of it like the snapshot being an implementation detail while the events are part of the public interface. With the facilities sketched out above, testing of (persistent) actors is a breeze. Regards, Roland 29 apr 2014 kl. 23:22 skrev erich oliphant <erich.oliph...@gmail.com>: > I've seen the PersistenceSpec, but not entirely clear on how to use it. None > of the akka-persistence examples I've found (activator,etc) have actual tests > in them. > > -- > >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com. > To post to this group, send email to akka-user@googlegroups.com. > Visit this group at http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. Dr. Roland Kuhn Akka Tech Lead Typesafe – Reactive apps on the JVM. twitter: @rolandkuhn -- >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.