Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"

like image 586
Eslam Hussein Avatar asked Dec 08 '25 16:12

Eslam Hussein


1 Answers

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

like image 156
Muhammad Youssef Avatar answered Dec 10 '25 21:12

Muhammad Youssef