title: Clear/delete cache before evrey test case using espresso in android studio
body: <p>I wrote tests in Android Studio using espresso.
  Now there are a number of tests that before I run I have to delete the app's cache.
  I tried a lot of options that I know but nothing worked out.
  I searched the site for the problem and tried the results but none of them worked either.</p>
  
  <p>For example, there is a stage in the app that causes a change gender addressing(My app is in foreign language) and I test a number of things in this section, I log in from 3 different test users and each one has a different view that cann't change unless cache is deleted and without deleting the cache I cann't run them together but I can run each one of them separately.
  The app defines itself in the momnet the user logs in so to switch users I need to delete the app cache.  </p>
  
  <p>I attached some links here of what I tried and should have worked but didn't.
  They may be able to help and explain</p>
  
  <p><a href="https://stackoverflow.com/questions/48681204/clear-database-before-testcase-espresso">Clear database before testcase espresso</a></p>
  
  <p><a href="https://stackoverflow.com/questions/37597080/reset-app-state-between-instrumentationtestcase-runs">Reset app state between InstrumentationTestCase runs</a></p>
  
  <p><a href="https://github.com/chiuki/espresso-samples/issues/3" rel="nofollow noreferrer">https://github.com/chiuki/espresso-samples/issues/3</a></p>
  
  <p><a href="https://discuss.appium.io/t/android-how-to-clear-app-data-before-test/7166/10" rel="nofollow noreferrer">https://discuss.appium.io/t/android-how-to-clear-app-data-before-test/7166/10</a></p>