Steps I have done to solve the problem:
1) build.gradle: sourceSets { androidTest { java.srcDirs = ['androidTest/java'] } }
2) Run - Edit configuration - + Android Tests - add new configuration (All in Module, Specific instrumentation runner (optional) - android.support.test.runner.AndroidJUnitRunner, Target - Emulator).
3) Sync Project with Gradle files.
4) Build Variants - Android Instrumentation Tests.
But the folder androidTest/java doesn't change the color. And I cannot add class test.
How can I overcome this?