简体   繁体   English

使用Espresso for APK编写UI测试,无需源代码

[英]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. 我正在尝试使用Espresso为APK编写UI测试,但我没有源代码。 I am trying to init the ActivityTestRule using classpath. 我正在尝试使用classpath初始化ActivityTestRule

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" 但我抓住了这个异常“java.lang.RuntimeException:找不到任何活动”

Chances are, this APK is proguard protected. 机会是,这个APK受到保护。 So the classes/packages names are currently obfuscated. 所以类/包名称目前是混淆的。 In another words, the names are currently different. 换句话说,名称目前不同。

Try using Monkey Runner instead 尝试使用Monkey Runner

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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