Android Studio / Gradle test folder naming convention

I saw a lot of tutorials and supporting projects for testing in the Android Studio / Gradle project. I am interested to know the test folder naming convention. I saw two similar names: test and androidTest . Is there any real difference? Is the IDE / Gradle processing data differently?

  • Appendix
    • CSI
      • androidTest
        • Java
      • Main
        • Java
        • Res

vs

  • Appendix
    • CSI
      • test
        • Java
      • Main
        • Java
        • Res

EDIT:

@jonalmeida So, if I read this documentation correctly, my build.gradle dependencies should match the original set, right?

 dependencies { // dependency injection compile 'com.squareup.dagger:dagger:1.2.1' provided 'com.squareup.dagger:dagger-compiler:1.2.1' // networking compile 'com.squareup.retrofit:retrofit:1.6.1' // testing androidTestCompile 'org.easytesting:fest:1.0.16' androidTestCompile 'junit:junit:4.+' androidTestCompile 'org.robolectric:robolectric:2.3' testCompile 'com.squareup:fest-android:1.0.8' // <---- this guy won't work } 
+6
source share
2 answers

Starting with Android Studio 1.1 you should put your unit tests in /src/test and Android toolkit tests in /src/androidTest

See: http://tools.android.com/tech-docs/unit-testing-support#TOC-Setting-up-Android-Studio

For Android Studio 2.0 onwards, see: https://youtu.be/kL3MCQV2M2s?t=114

+12
source

In Android Studio, you should use androidTest for testing. Detailed information can be found on the Android Tools website .

+1
source

Source: https://habr.com/ru/post/973980/


All Articles