My project is a regular Android project created on Android Studio .

I searched a lot to run one test (tests in SimpleTest, 1 test in this case), everyone says what I have to do, for example
./gradlew -Dtest.single=SimpleTest test
in my root folder.
or I did it in my internal project folder
../gradlew -Dtest.single=SimpleTest test
I tried as many ways as this, but it always ran all the tests that I have. (11 tests in all classes)
Is there a problem in my build.gradle or is there something I can't see?
Here is my build.gradle file.
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.6.+' classpath 'com.github.jcandksolutions.gradle:android-unit-test:1.0.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.1.1" defaultConfig { minSdkVersion 10 targetSdkVersion 18 // I changed this for this question packageName "com.XXX.XXXX" } sourceSets { instrumentTest.setRoot('src/test') } } apply plugin: 'android-unit-test' dependencies { repositories { mavenCentral() } compile 'com.android.support:support-v4:18.0.+' compile 'com.android.support:appcompat-v7:+' compile 'com.google.code.gson:gson:2.2.4' compile group:'com.squareup.picasso', name:'picasso', version:'2.1.1' compile group:'com.squareup.okhttp', name:'okhttp', version:'1.2.1' compile group:'com.squareup', name:'otto', version:'1.3.4' compile group:'com.jakewharton', name:'butterknife', version:'3.0.0' compile group:'com.github.kevinsawicki', name:'http-request', version:'5.4.1' compile fileTree(dir: 'libs', include: '*.jar') testCompile 'junit:junit:4.10' testCompile 'org.robolectric:robolectric:2.2' testCompile 'com.squareup:fest-android:1.0.+' instrumentTestCompile 'junit:junit:4.10' instrumentTestCompile 'org.robolectric:robolectric:2.2' instrumentTestCompile 'com.squareup:fest-android:1.0.+' } tasks.withType(Compile) { options.encoding = "UTF-8" } tasks.withType(Test) { testLogging { events 'started', 'passed' } }
android android-studio testing gradle robolectric
Wooseong kim
source share