Another possibility is to create a new TestKit for each test:

     new TestKit(system) {
        target.tell(message, testActor)
        expectMsg(answer)
      }

/Patrik

On Tue, Jan 27, 2015 at 2:53 PM, Björn Antonsson <
[email protected]> wrote:

> Hi,
>
> One posibillity would be to use a new test probe for each test, instead of
> the implicit test actor, like this.
>
> val testProbe = TestProbe()
> testProbe.send(target, message)
> testProbe.expectMsg(answer)
>
> B/
>
> On 27 January 2015 at 13:58:10, Jeremy Vuillermet (
> [email protected]) wrote:
>
> I'm using akka testkit to test some actors.
>
> I have issues with tests that do not catch all the messages and yet are
> "valid" tests.
> Then we the next test is executed, the first expectMsg will throw because
> it's actually catching messages from the previous one.
>
> Although I could understand it's the test responsibility to catch all
> messages, even if it tries to do so, it will be hard to find the source of
> the error when some one send too many messages.
>
> How are you doing it ?
> Can I empty the testActor mailbox ? Is it OK to do that ?
>  --
> >>>>>>>>>> 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.
>
>
> --
> Björn Antonsson
> Typesafe <http://typesafe.com/> – Reactive Apps on the JVM
> twitter: @bantonsson <http://twitter.com/#!/bantonsson>
>
>  --
> >>>>>>>>>> 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.
>



-- 

Patrik Nordwall
Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
Twitter: @patriknw

-- 
>>>>>>>>>>      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.

Reply via email to