Can I extend a custom Application in Espresso?

With a custom instrumentation runner, you can override newApplication and have it instantiate something other than the default application from the manifest.

public class MyRunner extends AndroidJUnitRunner {
  @Override
  public Application newApplication(ClassLoader cl, String className, Context context)
      throws Exception {
    return super.newApplication(cl, MyCustomEspressoApplication.class.getName(), context);
  }
}

Be sure to update testInstrumentationRunner with your custom runner’s name.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)