TestKit and how to avoid a failing (or sucesful) test affecting the other tests

30 views
Skip to first unread message

Kostas kougios

unread,
May 12, 2015, 11:22:05 AM5/12/15
to akka...@googlegroups.com
Hi,

I am having this issue where I sometimes "tell" different actors multiple messages and I want to test a single message, so I might have 1 expectMsg. But then, this affects the rest of the tests ,i.e. if the receiver is the testActor.

is there a way to "reset" TestKit for each test?

Thanks

(Note: i've asked a more detailed question similar to this but it is probably too complex and didn't get any answers yet)

Martynas Mickevičius

unread,
May 16, 2015, 4:48:56 AM5/16/15
to akka...@googlegroups.com
Hi Kostas,

I think that tools provided by ScalaTest for code reuse could help you. For example by overriding withFixture you can have a new instance of TestKit for every test.

I want to also mention that in carefully crafted tests cases sharing the same testActor can be helpful as well. In such case a not-expected message received by testActor would indicate a bug somewhere in the program.

Hope this helps.

--
>>>>>>>>>> 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.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Martynas Mickevičius
TypesafeReactive Apps on the JVM

Konstantinos Kougios

unread,
May 20, 2015, 6:24:21 AM5/20/15
to akka...@googlegroups.com
Thanks Martynas, withFixture looks promising. I've managed to sort out my tests so far even with sharing TestKit but if I get into troubles again I will try it.
You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/GV6mkXSHsHk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages