Skip to content Skip to sidebar Skip to footer

Getting Gradle To Execute Junit Test (android App, Android Studio)

I am currently working on an android app and lately switched from Eclipse to Android Studio (wasn't my idea;)). However I want to configure a jenkins server to run JUnit Tests and

Solution 1:

The error message tell that there is no such property unitTest. Test dependency are declared with instrumentTest (old) or androidTest (New).

Android sdk comes already with a junit 3 dependency. So just remove that line

Solution 2:

Unit testing doesn't appear to work out of the box in Android Studio. I have a working Gradle configuration that runs unit tests using Robolectric after some minor configurations.

See: Gradlectric

Also to specify a different test folder you need to instead use androidTest:

sourceSets {
        androidTest {
            setRoot('src/test')
        }
    }

Post a Comment for "Getting Gradle To Execute Junit Test (android App, Android Studio)"