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

I am new to Android Studio.

My questions:

  • What is the difference between src / androidTest and src / main folders?
  • where should all my classes be placed?
+4
source share
3 answers

Consult Android Studio Overview

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

+5

Android Studio 1.0 .

(app)/src/androidTest/java/com/myapp/HelloWorldTest.java

Unit Tests Android Studio:

Android Studio. ( ), "".   "". 'src', 'New → Directory'. androidTest androidTest "java". ( src). , . com.mycompany.myapp.tests , AndroidTestCase.

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

: - src → → java

+1

androidTest:

Unit testing is performed on the local JVM on your development machine. The Gradle plugin will compile the source code found in src / test / and execute it using the usual Gradle testing mechanisms.

To answer in one word. The main difference between androidTest and android and main folders is " Testing ", and later for development.

0
source

All Articles