Confused about testCompile and androidTestCompile in Android Gradle

前端 未结 4 878
后悔当初
后悔当初 2020-11-30 20:53

I\'m new to testing world and even more to Android testing world. While doing research on Robolectric that aids with tests on android one thing confuses me the most. Sometim

4条回答
  •  借酒劲吻你
    2020-11-30 21:38

    To add Dependency for JVM testing or Unit testing (testing those rely only on java environment, we don’t need any android environment).

    We Use testCompile directive. Example:

    dependencies {
        testCompile gradleTestKit()
    }
    

    To add Dependency for Instrumentation test (Those testing mainly rely on Android environment), we use the androidTestCompile directive.

提交回复
热议问题