I've done a lot of programming on a messaging system (not using Akka) and my advice is that a test should never wait for nothing. In fact, I had that as a rule and would ask testers to re-write any tests where it did that. The problem is that you don't know how to long to wait for. It's quite possible that your testing system is running very slow and might return something after your timeout. Thus, to actually test this safely, you have to have very long timeouts - which then slow down your tests and discourage your developers from using them.
Sometimes, I would use a technique of finding a way to force the system to send a message after the message I expected not to be sent. Let me reword that: You could do: Send Message A -> (nothing expected back so no assert) Send Message B -> Expect Message C back. If you get Message C but nothing else previously you can probably conclude that Message A didn't result in anything getting sent back. Cheers, Edward On Friday, August 1, 2014 8:03:01 AM UTC-7, Lawrence Wagerfield wrote: > > Most of my tests currently following this format: > > expectMsg(...) > expectMsg(...) > expectNoMsg(100.millis) > > The justification is that any additional/unexpected outputs from an actor > are a bug. This follows the same mentality as ScalaMocks, in that a call to > an unexpected method will fail the test. > > However, these are starting to appear all over my test code and I'm > concerned this is not idiomatic to Akka testing. Furthermore, they add > additional latency to the tests. > > What are the opinions on this? > -- >>>>>>>>>> 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.
