首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未能使用uiAutomator2.0进行测试

未能使用uiAutomator2.0进行测试
EN

Stack Overflow用户
提问于 2016-12-14 09:29:39
回答 1查看 248关注 0票数 0

我想从命令行进行uiAutomator2.0测试。我的步骤如下:

  1. 创建一个仪器项目,代码如下: 包com.android.uiautomator.client;导入org.junit.Before;导入org.junit.Test;导入org.junit.runner.RunWith;导入android.app.Application;导入android.app.Instrumentation;导入android.content.Context;导入android.support.test.InstrumentationRegistry;导入android.support.test.runner.AndroidJUnit4;导入android.test.ApplicationTestCase;@RunWith(AndroidJUnit4.class)公共类初始化{@ testStartServer() {System.out.println(“这是测试”);}}
  2. 使用gradlew生成测试apk
  3. 将测试apk安装到android模拟器中。 亚行外壳推动${apkPath}/test.apk /data/local/tmp/com.android.test adb shell pm安装-r /data/local/tmp/com.android.test
  4. 检查测试apk是否已安装成功。我可以找到安装好的apk。 亚洲开发银行外壳下午列表包
  5. 安装后,我在仿真程序中检查仪器,但是我找不到关于测试apk的测试工具。这将导致在执行命令时失败: 亚行外壳am仪器类com.android.uiautomator.client.test/android.support.test.runner.AndroidJUnitRunner -e com.android.uiautomator.client.Initialize -w -w

所以我很困惑。为什么我在安装了测试apk之后就找不到仪器了?

EN

回答 1

Stack Overflow用户

发布于 2016-12-14 23:07:41

你应该跑

代码语言:javascript
复制
$ adb shell pm list instrumentation | grep 'target=applicationId'

applicationId替换为applicationId,以检查应用程序可用的工具。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41139044

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档