1

We are using aws device farm for running all our android espresso tests. In each test, the user is supposed to login into the app but I want to clear all the device's data(login info) once the test is finished, since the login credentials are getting saved in the device which is affecting our other test's flow. All our tests are independent and should be run in parallel. It seems to me that device farm is not clearing the previous data after each run.

Could anyone tell me how can I delete the device's data after each test run? I will highly appreciate your help.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
python
  • 4,403
  • 13
  • 56
  • 103
  • 1
    What do you want to reset between your tests (db, files, preferences)? An example to reset preferences between each test can be found at http://stackoverflow.com/questions/37597080/reset-app-state-between-instrumentationtestcase-runs – nenick Jun 04 '16 at 05:22

1 Answers1

3

Device Farm uninstalls your package after every test run, which should also clean the data for your package. Device Farm also clean the local/external storage.

Device Farm doesn't clean data during test run between test cases. And Device Farm will run the same test cross all selected devices instead of splitting test cases and run different pieces on different devices.

Do you have some system wide data store somewhere out side of your package?

Hongda Zhao
  • 101
  • 2
  • how can I make sure that my testA should run first then testB, testC? can arrange my tests in a certain way? – python Jun 03 '16 at 19:39
  • The test case order is not supported on Device Farm so far. One possible mitigation is to wrap the sequence in a test case. – Hongda Zhao Jun 03 '16 at 19:53
  • could you please elaborate? how we can wrap a sequence in a test case? – python Jun 03 '16 at 20:01
  • You may define a test case like: @Test public void testSequence() { testA; testB; testC; } It's not a perfect solution for sure... – Hongda Zhao Jun 03 '16 at 20:25