My project is normal Android project created on Android Studio.
I googled a lot to run a single test(tests in SimpleTest, 1 test in this case), everyone say that I should do like
./gradlew -Dtest.single=SimpleTest test
in my root folder.
or I did in my inner project folder
../gradlew -Dtest.single=SimpleTest test
I tried so many ways like this but it always run all tests I have.(11 tests in all Classes)
Is there a problem on my build.gradle or is there a something I missing?
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'
}
}