I am creating an android app using Android Studio. In the project view, apart from the main folder where all my classes are stored I also have "androidTest" and "test" folders (marked with red in the image). I did not created these folders and I believe Android Studio generated these folders. What are these folders for? Is it safe to delete them?
Asked
Active
Viewed 2,159 times
-3
-
https://developer.android.com/studio/test/index.html – Ayush Gupta Jan 27 '18 at 11:43
-
They're for unit testing. – Zoe Jan 27 '18 at 11:44
-
When developing your application one can use a number of strategies to ensure that you get to your goal, i.e why one is building the application in the first place. One of the strategies for this is Test Driven Development see https://en.wikipedia.org/wiki/Test-driven_development. Briefly its a process used to set milestones and ensure the milestones have been achieved. Now the directories you asked about are for keeping your Unit tests and Instrunemtation tests see @AyushGupta 's link for more information. – Isaac Osiemo Jan 27 '18 at 11:49
-
Same question? https://stackoverflow.com/questions/34397524/ – Yousha Aleayoub Jan 07 '19 at 20:16
2 Answers
0
Yes, you can delete them (and you can delete their references from the gradle file), but why even bother? These files are just there to nudge you do the right thing.
They're like the broccoli that your mother might put on your plate even though she probably already knows that you're not going to eat them. You could refuse them and even delete them, but there is really little to no point in doing that.
If you want less visual clutter, just use the "Android View" instead of the "Project View" and don't expand those particular test folders.

Stephan Branczyk
- 9,363
- 2
- 33
- 49
0
These folders are created by default for testing your code
- src/test - Unit Tests
- src/androidtest - Android Instrumentation tests

yoAlex5
- 29,217
- 8
- 193
- 205