简体   繁体   中英

Writing UI tests using Espresso for APK without source code

I am trying to write UI tests using Espresso for an APK but I don't have the source code. I am trying to init the ActivityTestRule using classpath.

I followed this article

  private static final String CLASSNAME = "com.mytaxi.android_demo.activities.AuthenticationActivity";
  private static Class<? extends Activity>  activityClass = (Class<? extends Activity>) Class.forName(CLASSNAME);
  @Rule
  public ActivityTestRule<?> mActivityRule = newActivityTestRule(CLASSNAME);

but I caught this exception "java.lang.RuntimeException: No activities found"

Chances are, this APK is proguard protected. So the classes/packages names are currently obfuscated. In another words, the names are currently different.

Try using Monkey Runner instead

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM