From b4bf89cfcab455774f4e99cdede30c7c39d8de2e Mon Sep 17 00:00:00 2001 From: Konrad Malawski Date: Tue, 7 Jul 2015 17:51:10 +0200 Subject: [PATCH] =doc #15569 document TestActorRef being bad for persistence --- akka-docs/rst/java/testing.rst | 10 ++++++++++ akka-docs/rst/scala/testing.rst | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/akka-docs/rst/java/testing.rst b/akka-docs/rst/java/testing.rst index f3ce9f5d16..5f90792f93 100644 --- a/akka-docs/rst/java/testing.rst +++ b/akka-docs/rst/java/testing.rst @@ -65,6 +65,16 @@ obtaining a reference to the underlying actor instance, or by invoking or querying the actor's behaviour (:meth:`receive`). Each one warrants its own section below. +.. note:: + It is highly recommended to stick to traditional behavioural testing (using messaging + to ask the Actor to reply with the state you want to run assertions against), + instead of using ``TestActorRef`` whenever possible. + + Due to the synchronous nature of ``TestActorRef`` it will **not** work with some support + traits that Akka provides as they require asynchronous behaviours to function properly. + Examples of traits that do not mix well with test actor refs are :ref:`PersistentActor ` + and :ref:`AtLeastOnceDelivery ` provided by :ref:`Akka Persistence `. + Obtaining a Reference to an :class:`Actor` ------------------------------------------ diff --git a/akka-docs/rst/scala/testing.rst b/akka-docs/rst/scala/testing.rst index ba80574bcf..9182ddd9ee 100644 --- a/akka-docs/rst/scala/testing.rst +++ b/akka-docs/rst/scala/testing.rst @@ -54,6 +54,16 @@ obtaining a reference to the underlying actor instance, or by invoking or querying the actor's behaviour (:meth:`receive`). Each one warrants its own section below. +.. note:: + It is highly recommended to stick to traditional behavioural testing (using messaging + to ask the Actor to reply with the state you want to run assertions against), + instead of using ``TestActorRef`` whenever possible. + + Due to the synchronous nature of ``TestActorRef`` it will **not** work with some support + traits that Akka provides as they require asynchronous behaviours to function properly. + Examples of traits that do not mix well with test actor refs are :ref:`PersistentActor ` + and :ref:`AtLeastOnceDelivery ` provided by :ref:`Akka Persistence `. + Obtaining a Reference to an :class:`Actor` ------------------------------------------