When is it appropriate to do interaction based testing as opposed to state based testing?

Posted by Praneeth on Stack Overflow See other posts from Stack Overflow or by Praneeth
Published on 2010-05-04T13:34:06Z Indexed on 2010/05/05 10:28 UTC
Read the original article Hit count: 232

Filed under:
|
|
|

Hi,

When I use Easymock(or a similar mocking framework) to implement my unit tests, I'm forced to do interaction-based testing (as I don't get to assert on the state of my dependencies. Or am I mistaken?).

On the other hand if I use a hand written stub (instead of using easymock) I can implement state based testing.

I'm quite unclear if I want to go with interaction based testing or state based testing.

I'm biased and I want to use Easymock, but I'm not sure if there would be any side-effects that I may have to face in the future.

Can anyone please throw some light on this?

Thanks in advance!

© Stack Overflow or respective owner

Related posts about unit-testing

Related posts about TDD