Running instrumented unit tests
Instrumented unit tests are important when a functionality can't be tested using mock objects.
Tools used
AndroidJunitRunner is used to run such tests.
Configuring build.gradle
defaultConfig {Dependencies
applicationId "appId" minSdkVersion 17 targetSdkVersion 23 versionCode 1
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"}
dependencies {Running Instrument tests:
compile 'com.android.support:support-annotations:23.0.1' compile 'com.android.support:appcompat-v7:23.0.1'
androidTestCompile 'junit:junit:4.12' androidTestCompile 'com.android.support:support-annotations:23.0.1' androidTestCompile 'com.android.support.test:runner:0.4.1' androidTestCompile 'com.android.support.test:rules:0.4.1'
}
gradlew connectedAndroidTest
Useful links: