请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

正在回答 回答被采纳积分+3

插入代码

8回答

城下秋草 2017-01-16 21:35:21

 换个短些的路径,从头重新执行一遍 


0 回复 有任何疑惑可以回复我~
  • 提问者 wvguugvvc #1
    已经换了短的,机器里也有firstui.jar这个文件了
    回复 有任何疑惑可以回复我~ 2017-01-16 21:39:37
城下秋草 2017-01-15 22:48:10

[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


这两个命令在命令行里单独执行下看看是不是正确


0 回复 有任何疑惑可以回复我~
  • 提问者 wvguugvvc #1
    没有找到jar包,但是又提示push100%
    回复 有任何疑惑可以回复我~ 2017-01-16 18:27:11
  • 城下秋草 回复 提问者 wvguugvvc #2
    那有FirstU这个文件吗? 如果是这样,那就是你路径太长被截断了
    回复 有任何疑惑可以回复我~ 2017-01-16 18:53:43
  • 提问者 wvguugvvc 回复 城下秋草 #3
    是机器本地路径不对,改过之后,文件push进去了。但是文件名是FirstU,,仍然提示找不到method。。是机器上路径太长吗?
    回复 有任何疑惑可以回复我~ 2017-01-16 19:52:26
城下秋草 2017-01-15 15:26:50

main函数完整贴出来

0 回复 有任何疑惑可以回复我~
秋枫1207 2017-03-04 23:03:13

解决没?我也遇到同样的问题

0 回复 有任何疑惑可以回复我~
提问者 wvguugvvc 2017-01-16 20:44:30
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


0 回复 有任何疑惑可以回复我~
提问者 wvguugvvc 2017-01-16 19:52:40
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


0 回复 有任何疑惑可以回复我~
提问者 wvguugvvc 2017-01-15 22:08:41
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----
*******************
0 回复 有任何疑惑可以回复我~
提问者 wvguugvvc 2017-01-15 22:08:15
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);
         
    }
 
}


0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号