Android Studio Gradle androidTest vs instrumentTest

I am adding unit tests to my existing Android Studio project and I am a bit confused about the setup. In particular, the androidTest vs instrumentTest flags in a gradle script. Can someone explain the differences between the two sections and the fact that they are aimed against the other.

My project was migrated from an Eclipse project, so it does not have a gradle default structure. Here is what I played with:

androidTest { setRoot('tests') java.srcDirs = ['tests/src'] } instrumentTest { setRoot('tests') java.srcDirs = ['tests/src'] manifest.srcFile file('tests/AndroidManifest.xml') } 

Is there a reason to have both?

+6
source share
1 answer

Is there a reason to have both?

No, because it is the same as instrumentTest was renamed androidTest in version 0.9.0 of the Gradle plugin for Android .

+7
source

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


All Articles