When using Robolectric 2.4, we could define our testRunner to obtained our AndroidManifest, and defined our getTargetSdkVersion as code below.
@Override
protected AndroidManifest getAppManifest(Config config) {
return new AndroidManifest(Fs.fileFromPath(MANIFEST_PROPERTY), Fs
.fileFromPath(RES_PROPERTY)) {
@Override
public int getTargetSdkVersion() {
return TARGET_SDK_VERSION;
}
};
}
In Robolectric 3.0, this has been changed where we define getting AndroidManifest as below
@Override
protected AndroidManifest getAppManifest(Config config) {
return createAppManifest(Fs.fileFromPath(MANIFEST_PROPERTY), Fs.fileFromPath(RES_PROPERTY), Fs.fileFromPath(ASSET_PROPERTY));
}
This is good. But now, how could I set the getTargetSdkVersion in Robolectric 3.0 now? Note in Android Studio, we don't define the TargetSdkVersion in AndroidManifest. I currently use @Config to workaround it, but would like to put everything in the TestRunner class.
Aucun commentaire:
Enregistrer un commentaire