junit testing with gradle for an android project

前端 未结 5 822
青春惊慌失措
青春惊慌失措 2020-12-24 12:31

I am trying to get tests ( junit and robolectric ) working in an Android project but am totally stuck. My main problem is that all testing I found with gradle somehow pull i

5条回答
  •  误落风尘
    2020-12-24 13:23

    AndroidStudio and the new Android Gradle plugin are now offering official unit test support.

    This is supported from Android Studio 1.1+ and Android Gradle plugin version 1.1.0+

    Dependencies can now be declared as testCompile:

    dependencies {
      testCompile 'junit:junit:4.12'
      testCompile "org.mockito:mockito-core:1.9.5"
    }
    

    More details here: Unit testing support - Android Tools Project Site.

提交回复
热议问题