mercredi 18 février 2015

Stop connectivity on an android unit test

I've developed an android app. I've done some unit testing. My app connects to a server. The unit test connects to a test server to perform the tests. Everything is fine until here.


How I want to do some testings simulating that the user is offline (during a short period) and the online again. How can I achieve that? How can I tell android to simulate no connectivity?


I've seen that Roboelectric mocks requests, but thats not what I want. I want to test server+app behaviour.


I've also seen this question, but the reponse is Roboelectric too. How to unit test a class that uses HttpClient in Android using the built-in framework?


Thanks


Aucun commentaire:

Enregistrer un commentaire