android-espressoandroid-testingandroid-instrumentation

Android studio - androidTest folder is missing


I'm working on automation test using Espresso.

The folder in which Instrumentation test classes can be written is missing

Screenshot of the project

I tried by adding

android{    
        sourceSets{
        main { java.srcDirs = ['src/main/java'] }
        test { java.srcDirs = ['src/test/java'] }
        androidTest { java.srcDirs = ['src/androidTest/java'] }
    }

}

inside build.gradle but didn't work.

Tried to generate by using other solutions provided in this question still doesn't work


Solution

  • Copy and pasted existing test folder, renamed it as "androidTest" in file system worked for me.

    Because my project was shifted to new repository recently, so the folder got deleted.