Re: [akka-user] dependency between tests when using ImplicitSender and forget to consume a response with any of the expect-methods
We actually often find this rather useful - for example, if there comes a response from the previous test case which I did not expect, it could fail the 2nd test as an unexpected message may come in. This helps to make sure there’s no spurious and additional messages sent around. So yes, when using ImplicitSender, the assumption is that you want to make sure you expect all messages. If however you want to have the tests separated completely - don’t use implicit sender and use test probes instead: http://doc.akka.io/docs/akka/snapshot/scala/testing.html#using-multiple-probe-actors Both styles make complete sense and come down to your personal testing style - we use both styles to test Akka itself actually. — ktoso On 21 November 2014 at 22:41:24, Florian Witteler (florian.witte...@googlemail.com) wrote: Hi! I was bitten by some special behaviour when testing my actorSystem with the help of the ImplicitSender trait. I have two testmethods. In each of them, I send a message to an actor wrapped in a TestActorRef. In the first testcase, I don't consume the answer of the actor with one of TestKit's expect-Methods, because I check its state directly (testActorRef.underlyingActor) This causes the 2nd testcase to fail, because the first message was still in the receiving mailbox. Here is an example. https://gist.github.com/FloWi/55572324f2d3adb3d51b Do you have any suggestion on how to make the tests independent of each other? Or am I just using the ImplicitSender in a wrong way? (every answer must be consumed) Any insights are appreciated! Regards, Florian -- 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. -- Konrad 'ktoso' Malawski hAkker @ typesafe http://akka.io -- 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.
Re: [akka-user] dependency between tests when using ImplicitSender and forget to consume a response with any of the expect-methods
Makes sense to mix both styles. Thanks for the insight from inside the akka-team ;-) Keep up the good work! Am Sonntag, 23. November 2014 00:51:52 UTC+1 schrieb Konrad Malawski: We actually often find this rather useful - for example, if there comes a response from the previous test case which I did not expect, it could fail the 2nd test as an unexpected message may come in. This helps to make sure there’s no spurious and additional messages sent around. So yes, when using ImplicitSender, the assumption is that you want to make sure you expect all messages. If however you want to have the tests separated completely - don’t use implicit sender and use test probes instead: http://doc.akka.io/docs/akka/snapshot/scala/testing.html#using-multiple-probe-actors Both styles make complete sense and come down to your personal testing style - we use both styles to test Akka itself actually. — ktoso On 21 November 2014 at 22:41:24, Florian Witteler ( florian@googlemail.com javascript:) wrote: Hi! I was bitten by some special behaviour when testing my actorSystem with the help of the ImplicitSender trait. I have two testmethods. In each of them, I send a message to an actor wrapped in a TestActorRef. In the first testcase, I don't consume the answer of the actor with one of TestKit's expect-Methods, because I check its state directly (testActorRef.underlyingActor) This causes the 2nd testcase to fail, because the first message was still in the receiving mailbox. Here is an example. https://gist.github.com/FloWi/55572324f2d3adb3d51b Do you have any suggestion on how to make the tests independent of each other? Or am I just using the ImplicitSender in a wrong way? (every answer *must* be consumed) Any insights are appreciated! Regards, Florian -- 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+...@googlegroups.com javascript:. To post to this group, send email to akka...@googlegroups.com javascript:. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout. -- Konrad 'ktoso' Malawski hAkker @ typesafe http://akka.io -- 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.
Re: [akka-user] dependency between tests when using ImplicitSender and forget to consume a response with any of the expect-methods
Thanks; you too! Happy hakking! — konrad On 23 November 2014 at 00:51:45, Konrad 'ktoso' Malawski (konrad.malaw...@typesafe.com) wrote: We actually often find this rather useful - for example, if there comes a response from the previous test case which I did not expect, it could fail the 2nd test as an unexpected message may come in. This helps to make sure there’s no spurious and additional messages sent around. So yes, when using ImplicitSender, the assumption is that you want to make sure you expect all messages. If however you want to have the tests separated completely - don’t use implicit sender and use test probes instead: http://doc.akka.io/docs/akka/snapshot/scala/testing.html#using-multiple-probe-actors Both styles make complete sense and come down to your personal testing style - we use both styles to test Akka itself actually. — ktoso On 21 November 2014 at 22:41:24, Florian Witteler (florian.witte...@googlemail.com) wrote: Hi! I was bitten by some special behaviour when testing my actorSystem with the help of the ImplicitSender trait. I have two testmethods. In each of them, I send a message to an actor wrapped in a TestActorRef. In the first testcase, I don't consume the answer of the actor with one of TestKit's expect-Methods, because I check its state directly (testActorRef.underlyingActor) This causes the 2nd testcase to fail, because the first message was still in the receiving mailbox. Here is an example. https://gist.github.com/FloWi/55572324f2d3adb3d51b Do you have any suggestion on how to make the tests independent of each other? Or am I just using the ImplicitSender in a wrong way? (every answer must be consumed) Any insights are appreciated! Regards, Florian -- 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. -- Konrad 'ktoso' Malawski hAkker @ typesafe http://akka.io -- Konrad 'ktoso' Malawski hAkker @ typesafe http://akka.io -- 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.
[akka-user] dependency between tests when using ImplicitSender and forget to consume a response with any of the expect-methods
Hi! I was bitten by some special behaviour when testing my actorSystem with the help of the ImplicitSender trait. I have two testmethods. In each of them, I send a message to an actor wrapped in a TestActorRef. In the first testcase, I don't consume the answer of the actor with one of TestKit's expect-Methods, because I check its state directly (testActorRef.underlyingActor) This causes the 2nd testcase to fail, because the first message was still in the receiving mailbox. Here is an example. https://gist.github.com/FloWi/55572324f2d3adb3d51b Do you have any suggestion on how to make the tests independent of each other? Or am I just using the ImplicitSender in a wrong way? (every answer *must* be consumed) Any insights are appreciated! Regards, Florian -- 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.