最新的macaca-android驱动更新至1.0.27 后运行安卓浏览器和APP测试脚本报错
Eclipse run as maven test
运行安卓浏览器测试脚本错误:
socket server ready
socket client ready
responseHandler.js:50:12 [master] pid:11803 Send Error Respone to Client: TypeError: Path must be a string. Received undefined
responseHandler.js:56:14 [master] pid:11803 TypeError: Path must be a string. Received undefined
at assertPath (path.js:8:11)
at Object.posix.resolve (path.js:426:5)
at ADB.startApp.Promise.getApiLevel.ADB.install (/opt/nodejs/lib/node_modules/macaca-android/node_modules/macaca-adb/lib/macaca-adb.js:109:18)
at Android.stopDevice.Android.initDevice.data.filter.Android.launchApk (/opt/nodejs/lib/node_modules/macaca-android/lib/macaca-android.js:198:20)
at next (native)
at onFulfilled (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:65:19)
TypeError: Path must be a string. Received undefined
at assertPath (path.js:8:11)
at Object.posix.resolve (path.js:426:5)
at ADB.startApp.Promise.getApiLevel.ADB.install (/opt/nodejs/lib/node_modules/macaca-android/node_modules/macaca-adb/lib/macaca-adb.js:109:18)
at Android.stopDevice.Android.initDevice.data.filter.Android.launchApk (/opt/nodejs/lib/node_modules/macaca-android/lib/macaca-android.js:198:20)
at next (native)
at onFulfilled (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:65:19)
运行安卓APK测试脚本错误:
socket server ready
socket client ready
responseHandler.js:50:12 [master] pid:11803 Send Error Respone to Client: TypeError: Path must be a string. Received undefined
responseHandler.js:56:14 [master] pid:11803 TypeError: Path must be a string. Received undefined
at assertPath (path.js:8:11)
at Object.posix.resolve (path.js:426:5)
at ADB.startApp.Promise.getApiLevel.ADB.install (/opt/nodejs/lib/node_modules/macaca-android/node_modules/macaca-adb/lib/macaca-adb.js:109:18)
at Android.stopDevice.Android.initDevice.data.filter.Android.launchApk (/opt/nodejs/lib/node_modules/macaca-android/lib/macaca-android.js:198:20)
at next (native)
at onFulfilled (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:65:19)
at process._tickCallback (node.js:369:9)
TypeError: Path must be a string. Received undefined
at assertPath (path.js:8:11)
at Object.posix.resolve (path.js:426:5)
at ADB.startApp.Promise.getApiLevel.ADB.install (/opt/nodejs/lib/node_modules/macaca-android/node_modules/macaca-adb/lib/macaca-adb.js:109:18)
at Android.stopDevice.Android.initDevice.data.filter.Android.launchApk (/opt/nodejs/lib/node_modules/macaca-android/lib/macaca-android.js:198:20)
at next (native)
at onFulfilled (/opt/nodejs/lib/node_modules/macaca-cli/node_modules/co/index.js:65:19)
at process._tickCallback (node.js:369:9)
运行环境ubuntu16.04
cmd@TR:~$ macaca -v
1.1.2
cmd@TR:~$ macaca doctor
Node.js checklist:
node env: /opt/nodejs/bin/node
node version: v4.4.7
Android checklist:
JAVA version is 1.8.0_101
JAVA_HOME is set to /usr/lib/jvm/java-8-oracle
ANDROID_HOME is set to /opt/android-sdk-linux
Platforms is set to /opt/android-sdk-linux/platforms/android-24
Android tools is set to /opt/android-sdk-linux/tools/android
Installed driver list:
android: 1.0.27
chrome: 1.0.2
electron: 1.1.2
命令行mvn test执行安卓浏览器脚本错误:
cmd@TR:~/workspace/MacacaDev/uiautotest$ mvn test -Dtest=uiauto.H5MobileTest
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building uiautotest 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ uiautotest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/cmd/workspace/MacacaDev/uiautotest/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ uiautotest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ uiautotest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/cmd/workspace/MacacaDev/uiautotest/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ uiautotest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ uiautotest ---
[INFO] Surefire report directory: /home/cmd/workspace/MacacaDev/uiautotest/target/surefire-reports
T E S T S
Running uiauto.H5MobileTest
500
Response content:Internal Server Error
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.581 sec <<< FAILURE! - in uiauto.H5MobileTest
test_case_1(uiauto.H5MobileTest) Time elapsed: 2.174 sec <<< ERROR!
com.alibaba.fastjson.JSONException: syntax error, pos 1, json : Internal Server Error
at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1361)
at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1268)
at com.alibaba.fastjson.JSON.parse(JSON.java:137)
at com.alibaba.fastjson.JSON.parse(JSON.java:128)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:201)
at macaca.client.common.Utils.postRequest(Utils.java:92)
at macaca.client.common.Utils.request(Utils.java:132)
at macaca.client.commands.Session.createSession(Session.java:19)
at macaca.client.MacacaClient.initDriver(MacacaClient.java:615)
at uiauto.H5MobileTest.setUp(H5MobileTest.java:31)
test_case_1(uiauto.H5MobileTest) Time elapsed: 2.175 sec <<< ERROR!
java.lang.NullPointerException: null
at macaca.client.common.Utils.deleteRequest(Utils.java:108)
at macaca.client.common.Utils.request(Utils.java:134)
at macaca.client.commands.Session.delSession(Session.java:29)
at macaca.client.MacacaClient.quit(MacacaClient.java:633)
at uiauto.H5MobileTest.tearDown(H5MobileTest.java:60)
Results :
Tests in error:
H5MobileTest.setUp:31 » JSON syntax error, pos 1, json : Internal Server Error
H5MobileTest.tearDown:60 » NullPointer
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.139 s
[INFO] Finished at: 2016-09-18T14:11:15+08:00
[INFO] Final Memory: 12M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project uiautotest: There are test failures.
[ERROR]
[ERROR] Please refer to /home/cmd/workspace/MacacaDev/uiautotest/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
mvn test执行安卓apk脚本错误:
cmd@TR:~/workspace/MacacaDev/uiautotest$ mvn test -Dtest=uiauto.AndroidAcpTest
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building uiautotest 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ uiautotest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/cmd/workspace/MacacaDev/uiautotest/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ uiautotest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ uiautotest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/cmd/workspace/MacacaDev/uiautotest/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ uiautotest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ uiautotest ---
[INFO] Surefire report directory: /home/cmd/workspace/MacacaDev/uiautotest/target/surefire-reports
T E S T S
Running uiauto.AndroidAcpTest
500
Response content:Internal Server Error
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.615 sec <<< FAILURE! - in uiauto.AndroidAcpTest
test_case_1(uiauto.AndroidAcpTest) Time elapsed: 2.152 sec <<< ERROR!
com.alibaba.fastjson.JSONException: syntax error, pos 1, json : Internal Server Error
at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1361)
at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1268)
at com.alibaba.fastjson.JSON.parse(JSON.java:137)
at com.alibaba.fastjson.JSON.parse(JSON.java:128)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:201)
at macaca.client.common.Utils.postRequest(Utils.java:92)
at macaca.client.common.Utils.request(Utils.java:132)
at macaca.client.commands.Session.createSession(Session.java:19)
at macaca.client.MacacaClient.initDriver(MacacaClient.java:615)
at uiauto.AndroidAcpTest.setUp(AndroidAcpTest.java:39)
test_case_1(uiauto.AndroidAcpTest) Time elapsed: 2.153 sec <<< ERROR!
java.lang.NullPointerException: null
at macaca.client.common.Utils.deleteRequest(Utils.java:108)
at macaca.client.common.Utils.request(Utils.java:134)
at macaca.client.commands.Session.delSession(Session.java:29)
at macaca.client.MacacaClient.quit(MacacaClient.java:633)
at uiauto.AndroidAcpTest.tearDown(AndroidAcpTest.java:78)
Results :
Tests in error:
AndroidAcpTest.setUp:39 » JSON syntax error, pos 1, json : Internal Server Err...
AndroidAcpTest.tearDown:78 » NullPointer
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.093 s
[INFO] Finished at: 2016-09-18T14:13:34+08:00
[INFO] Final Memory: 12M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project uiautotest: There are test failures.
[ERROR]
[ERROR] Please refer to /home/cmd/workspace/MacacaDev/uiautotest/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
转到win10环境下,只有安卓浏览器的脚本报错了,安卓apk的是正常的:
socket server ready
socket client ready
responseHandler.js:50:12 [master] pid:2748 Send Error Respone to Client: TypeError: Path must be a string. Received undefined
responseHandler.js:56:14 [master] pid:2748 TypeError: Path must be a string. Received undefined
at assertPath (path.js:8:11)
at Object.win32.resolve (path.js:130:5)
at ADB.startApp.Promise.getApiLevel.ADB.install (D:\nodejs\node-global\node_modules\macaca-android\node_modules\macaca-adb\lib\macaca-adb.js:109:18)
at Android.stopDevice.Android.initDevice.data.filter.Android.launchApk (D:\nodejs\node-global\node_modules\macaca-android\lib\macaca-android.js:198:20)
at next (native)
at onFulfilled (D:\nodejs\node-global\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at process._tickCallback (node.js:369:9)
TypeError: Path must be a string. Received undefined
at assertPath (path.js:8:11)
at Object.win32.resolve (path.js:130:5)
at ADB.startApp.Promise.getApiLevel.ADB.install (D:\nodejs\node-global\node_modules\macaca-android\node_modules\macaca-adb\lib\macaca-adb.js:109:18)
at Android.stopDevice.Android.initDevice.data.filter.Android.launchApk (D:\nodejs\node-global\node_modules\macaca-android\lib\macaca-android.js:198:20)
at next (native)
at onFulfilled (D:\nodejs\node-global\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at process._tickCallback (node.js:369:9)
D:\workspace\MacacaDev\uiautotest>mvn test -Dtest=uiauto.H5MobileTest
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building uiautotest 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ uiautotest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\workspace\MacacaDev\uiautotest\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ uiautotest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ uiautotest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\workspace\MacacaDev\uiautotest\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ uiautotest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ uiautotest ---
[INFO] Surefire report directory: D:\workspace\MacacaDev\uiautotest\target\surefire-reports
T E S T S
Running uiauto.H5MobileTest
500
Response content:Internal Server Error
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 4.08 sec <<< FAILURE!
test_case_1(uiauto.H5MobileTest) Time elapsed: 3.429 sec <<< ERROR!
com.alibaba.fastjson.JSONException: syntax error, pos 1, json : Internal Server Error
at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1361)
at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1268)
at com.alibaba.fastjson.JSON.parse(JSON.java:137)
at com.alibaba.fastjson.JSON.parse(JSON.java:128)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:201)
at macaca.client.common.Utils.postRequest(Utils.java:92)
at macaca.client.common.Utils.request(Utils.java:132)
at macaca.client.commands.Session.createSession(Session.java:19)
at macaca.client.MacacaClient.initDriver(MacacaClient.java:615)
at uiauto.H5MobileTest.setUp(H5MobileTest.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
test_case_1(uiauto.H5MobileTest) Time elapsed: 3.43 sec <<< ERROR!
java.lang.NullPointerException
at macaca.client.common.Utils.deleteRequest(Utils.java:108)
at macaca.client.common.Utils.request(Utils.java:134)
at macaca.client.commands.Session.delSession(Session.java:29)
at macaca.client.MacacaClient.quit(MacacaClient.java:633)
at uiauto.H5MobileTest.tearDown(H5MobileTest.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Results :
Tests in error:
test_case_1(uiauto.H5MobileTest): syntax error, pos 1, json : Internal Server Error
test_case_1(uiauto.H5MobileTest)
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.902 s
[INFO] Finished at: 2016-09-18T16:40:22+08:00
[INFO] Final Memory: 11M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project uiautotest: There are test failures.
[ERROR]
[ERROR] Please refer to D:\workspace\MacacaDev\uiautotest\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException