Handling Android runtime permissions in UI tests

Several months ago I took a look at the new Android Permissions model where things were changing quite a lot with the introduction of Marshmallow. the implementation of this new model meant that we needed to ensure that: We checked if we had the permission we needed when it was required We requested the permission from the user when it deemed appropriate Correctly handled the request (empty states or data feedback) within the UI to represent the outcome of being granted or denied the required permission So now we’ve implemented all of the above, it looks and behaves as expected on both Marshmallow and pre-Marshmallow devices, right? 👹 Now, I’m sure you’ve written all of your functional tests like a good developer. But wait, what about tests involving screens where we require a permission, aren’t these going to fail on 6.0+ devices? And how are we meant to test the different UI states when being granted and denied a permission?!

read more Handling Android runtime permissions in UI tests