In which cases Robolectric is a relevant solution?

Posted by Francis Toth on Programmers See other posts from Programmers or by Francis Toth
Published on 2012-12-04T14:04:27Z Indexed on 2012/12/04 17:19 UTC
Read the original article Hit count: 458

Filed under:
|

As you may now, Robolectric is a framework that provides stubs for Android objects, in order to make tests runnable outside the Dalvik environment.

My concern is that, by doing this, one can fake a third party library, which is, I believe, not a good practice (it should be encapsulated instead). If you make assumptions about an interface you don't own, which is changed once your test has been written, you won't be always noticed about the modifications. This can lead to a misunderstanding between your implementations and the interface they depends on.

In addition, Android use mostly inheritance over interfaces which limits contract testing.

So here's my question: Are there situations when Robolectric is the way to go?

Here are some links you can check for further information:

test-doubles-with-mockito

in-brief-contract-tests

© Programmers or respective owner

Related posts about android

Related posts about TDD