I have several test methods in my class. For one of my tests I need to update application preferences before test is started, i.e. before the Activity under a test is started. I’m using Robotium lib for testing, so my test class is extended from ActivityInstrumentationTestCase2. Thanks!
I have several test methods in my class. For one of my tests I
Share
To do this you need a context, this is fairly easy to get as long as you have instrumentation available. This means you cannot do it in your test class constructor but can in the setup method.
The above will give you a context of the application under test. With this reference you can do anything to shared preferences you would be able to do normally within your application, e.g.:
Then perform any edits you want and then commit it as so: