1

I´m making an Android app.

So I´m starting with some instrumentation testing where I want to start with data enabled and location disabled and I want to test that a dialog asking me to enable location appears.

For my second test I want to start with data disabled and location enabled and I want to test that a dialog asking me to enable data appears.

How can I manipulate the location and data for an instrumentation test?

Thanks in advance.

Eugen Martynov
  • 19,888
  • 10
  • 61
  • 114
linker85
  • 1,601
  • 5
  • 26
  • 44

1 Answers1

0

If you do separation of the concerns then you have special class or classes for checking if some user settings are enabled/disabled. So you can mock it in test and check that dialogues are shown.

However, to test the class that checks user settings you need to manipulate with emulator/device directly. Check Is there an ADB command to enable/disable mobile data?(Rooted Device) or https://github.com/linkedin/test-butler

Community
  • 1
  • 1
Eugen Martynov
  • 19,888
  • 10
  • 61
  • 114