В общем начал разбираться с Espresso. Написал кастомный раннер
public class CustomRunner extends AndroidJUnitRunner {
@NotNull
@Override
public Application newApplication(ClassLoader cl, String className, Context context) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return super.newApplication(cl, MockApplication.class.getName(), context);
}
}
кусок градла
defaultConfig {
testInstrumentationRunner "ru.packadge.CustomRunner"
minSdkVersion 15
targetSdkVersion 21
versionCode 115
versionName "2.4.3"
multiDexEnabled true
}
dependencies {
/*=====================================================
=================== TEST LIBRARY =====================
=====================================================*/
androidTestCompile ('com.android.support.test:testing-support-lib:0.1'){
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
}
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
androidTestCompile 'com.squareup.okhttp:mockwebserver:2.2.0'
/*=====================================================
================= COMMON LIBRARIES ====================
======================================================*/
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:appcompat-v7:22.0.0'
compile('com.android.support:support-v4:22.0.0') { force = true }
compile 'com.google.code.gson:gson:2.3.1'
compile fileTree(dir: 'libs', include: '*.jar')
compile "com.mixpanel.android:mixpanel-android:4.2.1@aar"
compile 'com.sothree.slidinguppanel:library:2.0.4'
compile('com.crashlytics.sdk.android:crashlytics:2.1.0@aar') { transitive = true; }
compile 'com.octo.android.robospice:robospice:1.4.14'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.octo.android.robospice:robospice-retrofit:1.4.14' exclude module: 'httpclient'
compile 'org.roboguice:roboguice:3.0.1'
provided 'org.roboguice:roboblender:3.0.1'
//noinspection GradleDynamicVersion
compile 'org.jetbrains.kotlin:kotlin-stdlib:0.1+'
compile 'io.reactivex:rxjava:1.0.11'
compile 'io.reactivex:rxandroid:0.24.0'
compile 'com.google.android.gms:play-services-location:7.3.0'
compile 'com.google.android.gms:play-services-gcm:7.3.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.guava:guava:18.0'
compile 'droidkit:droidkit:3.3.2'
compile 'com.squareup.dagger:dagger:1.2.2' exclude module: 'javax.inject'
apt 'com.squareup.dagger:dagger-compiler:1.2.2' exclude module: 'javax.inject'
}
Самое странно, при запуске падает с ошибкой и все. в гугле ничего не нашел вообще. может можно флаги задать, чтобы можно было побольше инфы вытащить?
Test running failed: Instrumentation run failed due to 'java.lang.IllegalStateException'