大佬教程收集整理的这篇文章主要介绍了android – 从命令行测试UiAutomator 2.0,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
adb sHell am instrument -w test.simple.uiatest/android.test.instrumentationTestRunner
按照建议here,但我明白了
instrUMENTATION_STATUS: id=Activitymanagerservice instrUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponenTinfo{test.simple.uiatest/android.test.instrumentationTestRunner} instrUMENTATION_status_code: -1 android.util.AndroidException: instrUMENTATION_Failed: test.simple.uiatest/android.test.instrumentationTestRunner at com.android.commands.am.Am.runinstrument(Am.java:951) at com.android.commands.am.Am.onRun(Am.java:316) at com.android.internal.os.baseCommand.run(BaseCommand.java:47) at com.android.commands.am.Am.main(Am.java:99) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:250)
下面是我的代码片段和build.gradle,我做错了什么?
package test.simple.uiatest; import android.support.test.uiautomator.UiDevice; import android.test.instrumentationTESTCase; public class ApplicationTest extends instrumentationTESTCase { private UiDevice theDevice; @Override public void setUp() throws Exception { super.setUp(); theDevice = UiDevice.geTinstance(getinstrumentation()); theDevice.pressHome(); } public void testName() throws Exception { theDevice.pressHome(); } }
的build.gradle
apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "23.0.0 rc2" defaultConfig { testinstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" applicationId "test.simple.uiatest" minSdkVersion 21 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro' } } packagingOptions { exclude 'LICENSE.txt' } } dependencies { compile fileTree(dir: 'libs',include: ['*.jar']) androidTESTCompile 'com.android.support.test:runner:0.2' androidTESTCompile 'com.android.support.test:rules:0.2' androidTESTCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.0' }
要列出设备上可用的检测测试,您可以运行adb sHell pm list检测.您应该看到如下行:
instrumentation:test.simple.uiatest/android.test.instrumentationTestRunner (target=simple.target.app)
如果您没有看到与测试匹配的行,则需要安装测试APK.如果已安装,请仔细检查pm list检测输出的test.simple.uiatest / android.test.instrumentationTestRunner部分是否与您的仪器命令匹配.
以上是大佬教程为你收集整理的android – 从命令行测试UiAutomator 2.0全部内容,希望文章能够帮你解决android – 从命令行测试UiAutomator 2.0所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。