lundi 7 septembre 2015

Robolectric Android Studio Unit Testing

Actually i am trying to perform Unit testing of my android project built using android studio. I tried to use roboletric but everytime i run the test file its shows following error

android.content.res.Resources$NotFoundException: unknown resource 2130903065

build.gradle for the following is as follows

    buildscript {
    repositories {
        mavenCentral()
        maven {
            url 'http://ift.tt/1ca5iuY'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.1-SNAPSHOT'


    }


}
apply plugin: 'android'


repositories {
    mavenCentral()
    maven {
        url 'http://ift.tt/1ca5iuY'
    }
}

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 18
    }
    sourceSets {
        instrumentTest.setRoot('src/test')

    }

    productFlavors {
    }
}

dependencies {
    instrumentTestCompile 'junit:junit:4.10'
    instrumentTestCompile 'org.robolectric:robolectric:2.3-SNAPSHOT'
    instrumentTestCompile 'com.squareup:fest-android:1.0.+'
    testCompile 'junit:junit:4.10'
    testCompile 'org.robolectric:robolectric:3.0-rc2'
    testCompile 'com.squareup:fest-android:1.0.+'
    compile 'com.android.support:appcompat-v7:22.2.0'
}

Please Help !!!!

Aucun commentaire:

Enregistrer un commentaire