jeudi 9 mars 2017

How to mock out SMS sent to device in automated tests

In my application I make a call to a server endpoint which will then trigger sending an SMS to the phone. The Activity then automatically detects the SMS and tells the user before moving on. All of this works fine in production.

What I'm trying to do now is to automate the testing of this flow to make sure the UI responds correctly. Mocking out the server call is fine (I'm using okhttp, so I have mock servers, dispatchers, and responses), but how do I mock out the SMS part? Basically I need the device to receive a fake SMS as it normally would so that I can check that the UI responds as I expect it to.

Aucun commentaire:

Enregistrer un commentaire