采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
[100%] /data/local/tmp/FirstU
看看tmp目录下有这个jar包吗
----adb push "F:\JAVA1安装包\eclipse_4.2.2_with_JRE_and_demo\eclipse\workspace\TetsUi\bin\FirstUi.jar" /data/local/tmp/
----execCmd: adb push "F:\JAVA1安装包\eclipse_4.2.2_with_JRE_and_demo\eclipse\workspace\TetsUi\bin\FirstUi.jar" /data/local/tmp/
[100%] /data/local/tmp/FirstU
这两个命令在命令行里单独执行下看看是不是正确
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ----execCmd: adb push "F:\eclipse\workspace\TetsUi\bin\FirstUi.jar" /storage/emulated/ 0 / [ 100 %] /storage/emulated/ 0 /FirstUi.jar ----runTest: adb shell uiautomator runtest FirstUi.jar --nohup -c com.imooc.UiTest.TestUi#testHome ----execCmd: adb shell uiautomator runtest FirstUi.jar --nohup -c com.imooc.UiTest.TestUi#testHome INSTRUMENTATION_STATUS: numtests= 1 INSTRUMENTATION_STATUS: stream= com.imooc.UiTest.TestUi: INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner INSTRUMENTATION_STATUS: test=testHome INSTRUMENTATION_STATUS: class =com.imooc.UiTest.TestUi INSTRUMENTATION_STATUS: current= 1 INSTRUMENTATION_STATUS_CODE: 1 INSTRUMENTATION_STATUS: numtests= 1 INSTRUMENTATION_STATUS: stream= Failure in testHome: junit.framework.AssertionFailedError: Method "testHome" not found |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | Total time: 2 seconds ----jar包路径: "F:\JAVA1安装包\eclipse\eclipse\workspace\TetsUi\bin\FirstUi.jar" ----adb push "F:\JAVA1安装包\eclipse\eclipse\workspace\TetsUi\bin\FirstUi.jar" /storage/emulated/ 0 / ----execCmd: adb push "F:\JAVA1安装包\eclipse\eclipse\workspace\TetsUi\bin\FirstUi.jar" /storage/emulated/ 0 / [ 100 %] /storage/emulated/ 0 /FirstU ----runTest: adb shell uiautomator runtest FirstUi.jar --nohup -c com.imooc.UiTest.TestUi#testHome ----execCmd: adb shell uiautomator runtest FirstUi.jar --nohup -c com.imooc.UiTest.TestUi#testHome INSTRUMENTATION_STATUS: numtests= 1 INSTRUMENTATION_STATUS: stream= com.imooc.UiTest.TestUi: INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner INSTRUMENTATION_STATUS: test=testHome INSTRUMENTATION_STATUS: class =com.imooc.UiTest.TestUi INSTRUMENTATION_STATUS: current= 1 INSTRUMENTATION_STATUS_CODE: 1 INSTRUMENTATION_STATUS: numtests= 1 INSTRUMENTATION_STATUS: stream= Failure in testHome: junit.framework.AssertionFailedError: Method "testHome" not found |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | -----------start--uiautomator--debug------------- ----工作空间: F:\JAVA1安装包\eclipse_4. 2 .2_with_JRE_and_demo\eclipse\workspace\TetsUi ----execCmd: cmd /c android create uitest-project -n FirstUi -t 2 -p "F:\JAVA1安装包\eclipse_4.2.2_with_JRE_and_demo\eclipse\workspace\TetsUi" Updated file F:\JAVA1安装包\eclipse_4. 2 .2_with_JRE_and_demo\eclipse\workspace\TetsUi\build.xml ----------------------- --------修改build完成--------- ----execCmd: cmd /c ant Buildfile: F:\JAVA1安装包\eclipse_4. 2 .2_with_JRE_and_demo\eclipse\workspace\TetsUi\build.xml -check-env: [checkenv] Android SDK Tools Revision 24.4 . 1 [checkenv] Installed at D:\android-sdk -build-setup: [getbuildtools] Using latest Build Tools: 24.0 . 2 [echo] Resolving Build Target for FirstUi... [getuitarget] Project Target: Android 7.0 [getuitarget] API level: 24 [echo] ---------- [echo] Creating output directories if needed... -pre-compile: compile: [javac] Compiling 1 source file to F:\JAVA1安装包\eclipse_4. 2 .2_with_JRE_and_demo\eclipse\workspace\TetsUi\bin\classes [javac] 警告: [options] 源值 1.5 已过时, 将在未来所有发行版中删除 [javac] 警告: [options] 目标值 1.5 已过时, 将在未来所有发行版中删除 [javac] 警告: [options] 要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。 [javac] 注: F:\JAVA1安装包\eclipse_4. 2 .2_with_JRE_and_demo\eclipse\workspace\TetsUi\src\com\imooc\UiTest\TestUi.java使用或覆盖了已过时的 API。 [javac] 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 [javac] 3 个警告 -post-compile: -dex: [dex] input: F:\JAVA1安装包\eclipse_4. 2 .2_with_JRE_and_demo\eclipse\workspace\TetsUi\bin\classes [dex] Found Deleted Target File [dex] Converting compiled files and external libraries into F:\JAVA1安装包\eclipse_4. 2 .2_with_JRE_and_demo\eclipse\workspace\TetsUi\bin\classes.dex... -post-dex: -jar: [jar] Building jar: F:\JAVA1安装包\eclipse_4. 2 .2_with_JRE_and_demo\eclipse\workspace\TetsUi\bin\FirstUi.jar -post-jar: build: BUILD SUCCESSFUL Total time: 2 seconds ----jar包路径: "F:\JAVA1安装包\eclipse_4.2.2_with_JRE_and_demo\eclipse\workspace\TetsUi\bin\FirstUi.jar" ----adb push "F:\JAVA1安装包\eclipse_4.2.2_with_JRE_and_demo\eclipse\workspace\TetsUi\bin\FirstUi.jar" /data/local/tmp/ ----execCmd: adb push "F:\JAVA1安装包\eclipse_4.2.2_with_JRE_and_demo\eclipse\workspace\TetsUi\bin\FirstUi.jar" /data/local/tmp/ [ 100 %] /data/local/tmp/FirstU ----runTest: adb shell uiautomator runtest FirstUi.jar --nohup -c com.imooc.UiTest.TestUi#testHome ----execCmd: adb shell uiautomator runtest FirstUi.jar --nohup -c com.imooc.UiTest.TestUi#testHome INSTRUMENTATION_STATUS: numtests= 1 INSTRUMENTATION_STATUS: stream= com.imooc.UiTest.TestUi: INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner INSTRUMENTATION_STATUS: test=testHome INSTRUMENTATION_STATUS: class =com.imooc.UiTest.TestUi INSTRUMENTATION_STATUS: current= 1 INSTRUMENTATION_STATUS_CODE: 1 INSTRUMENTATION_STATUS: numtests= 1 INSTRUMENTATION_STATUS: stream= Failure in testHome: junit.framework.AssertionFailedError: Method "testHome" not found at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java: 160 ) at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java: 96 ) at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java: 91 ) at com.android.commands.uiautomator.Launcher.main(Launcher.java: 83 ) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java: 257 ) INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner INSTRUMENTATION_STATUS: test=testHome INSTRUMENTATION_STATUS: class =com.imooc.UiTest.TestUi INSTRUMENTATION_STATUS: stack=junit.framework.AssertionFailedError: Method "testHome" not found at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java: 160 ) at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java: 96 ) at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java: 91 ) at com.android.commands.uiautomator.Launcher.main(Launcher.java: 83 ) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java: 257 ) INSTRUMENTATION_STATUS: current= 1 INSTRUMENTATION_STATUS_CODE: - 2 INSTRUMENTATION_STATUS: stream= Test results for WatcherResultPrinter=.F Time: 0.105 FAILURES!!! Tests run: 1 , Failures: 1 , Errors: 0 INSTRUMENTATION_STATUS_CODE: - 1 ******************* ---FINISH DEBUG---- ******************* |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | package com.imooc.UiTest; import com.android.uiautomator.core.UiDevice; import com.android.uiautomator.testrunner.UiAutomatorTestCase; public class TestUi extends UiAutomatorTestCase { public void testHome() { UiDevice.getInstance().pressHome(); // TODO Auto-generated constructor stub } public static void main(String[] args) { String jarName= "FirstUi" ; String testClass= "com.imooc.UiTest.TestUi" ; String androidID= "2" ; String testname= "testHome" ; new UiAutomatorHelper(jarName,testClass,testname,androidID); } } |