Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio : difference between src/androidTest and src/main folders?

I am new to Android Studio.

My questions are :

  • what is the difference between src/androidTest and src/main folders ?
  • where should put all my classes ?
like image 840
Regis_AG Avatar asked Jun 22 '15 13:06

Regis_AG


2 Answers

Refer Android Studio Overview

Each instance of Android Studio contains a project with one or more application modules. Each application module folder contains the complete source sets for that module, including src/main/ and src/androidTest/directories. For the most part, you will need to modify the files under each module's src/main/ directory for source code updates, the gradle.build file for build specification and the files under src/androidTest/ directory for test case creation.

like image 136
Daud Arfin Avatar answered Sep 23 '22 21:09

Daud Arfin


In Android Studio 1.0 the scheme has changed a little bit.

Your path should be (app)/src/androidTest/java/com/myapp/HelloWorldTest.java

Here's how I set up Unit Tests in a new Android Studio project:

Open app in Android Studio. Set the Project explorer (left hand window) to display 'Project' mode. Tap the little drop-down at the top left and select 'Project'. Right click the 'src' directory, 'New -> Directory'. Call new directory androidTest Right click androidTest and add a 'java' directory. It will appear in green (indicating it's a test src directory). Now right-click again and add a package, e.g. com.mycompany.myapp.tests Add a new class that extends AndroidTestCase.

http://envyandroid.com/content/images/2014/02/project-structure.png

For putting the classes:- src folder --> main folder --> then java

like image 35
Chaudhary Amar Avatar answered Sep 21 '22 21:09

Chaudhary Amar