Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Combined JUnit, Cucumber and MultiDex instrumentation test runner
public class MultiDexCucumberJUnitRunner extends AndroidJUnitRunner {
private final CucumberInstrumentationCore mInstrumentationCore = new CucumberInstrumentationCore(this);
@Override
public void onCreate(Bundle arguments) {
MultiDex.install(getTargetContext());
mInstrumentationCore.create(arguments);
super.onCreate(arguments);
}
@Override
public void onStart() {
super.onStart();
waitForIdleSync();
mInstrumentationCore.start();
allFinished();
}
private int mResultCode;
private Bundle mResults = new Bundle();
/**
* Catch calls to finish() and aggregate results into a bundle
*/
@Override
public void finish(int resultCode, Bundle results) {
mResultCode = resultCode;
mResults.putAll(results);
}
private void allFinished() {
super.finish(mResultCode, mResults);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.