0

I have a bool resource called should_init_data that I want to have different values for in src/main vs src/androidTest.

So I created it in src/main/res/values/bools.xml. I want to override this value during androidTest - but it's not working with a src/androidTest/res/values/bools.xml file with that value overidden.

How do I fix this? Why is this something that the Android Gradle Plugin does not support?

Cœur
  • 37,241
  • 25
  • 195
  • 267
ZakTaccardi
  • 12,212
  • 15
  • 59
  • 107
  • You should test a specif buldType or a flavor. Why are you trying to override some values in test? – Gabriele Mariotti Sep 02 '15 at 16:05
  • because my application class automatically starts initializing data via an intent service based on the value of a shared preference. this causes an SQLDatabaseLockedException in instrumentation tests if the service is running. there's no way for me to hook into the application class fast enough to manually set that preference to false. So, I want to tell my application class to not automatically start initializing the data during testing. – ZakTaccardi Sep 02 '15 at 16:10
  • Not sure about it, but you can use a custom Application class only for test.check: http://stackoverflow.com/questions/29750164/can-i-extend-a-custom-application-in-espresso – Gabriele Mariotti Sep 02 '15 at 16:17

0 Answers0