51Testing软件测试论坛

标题: Day1-6测试积点任务 [打印本页]

作者: 测试积点老人    时间: 2018-7-6 13:43
标题: Day1-6测试积点任务
问题:
1、直接运行用例时,可以正常运行,日志如下:
  1. [debug] [UiAutomator] Shutting down UiAutomator
  2. [debug] [UiAutomator] Moving to state 'stopping'
  3. [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection
  4. [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1
  5. [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=.
  6. [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
  7. [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
  8. [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
  9. [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1
  10. [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: 0
  11. [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=
  12. [debug] [AndroidBootstrap] [UIAUTO STDOUT] Test results for WatcherResultPrinter=.
  13. [debug] [AndroidBootstrap] [UIAUTO STDOUT] Time: 24.758
  14. [debug] [AndroidBootstrap] [UIAUTO STDOUT] OK (1 test)
  15. [debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: -1
  16. [debug] [UiAutomator] UiAutomator shut down normally
  17. [debug] [UiAutomator] Moving to state 'stopped'
复制代码
2、但是以这种方式运行os.popen("python case.py"),用例执行失败,日志如下:
  1. [debug] [AndroidBootstrap] Received command result from bootstrap
  2. [debug] [UiAutomator] Shutting down UiAutomator
  3. [debug] [UiAutomator] Moving to state 'stopping'
  4. [debug] [UiAutomator] UiAutomator shut down normally
  5. [debug] [UiAutomator] Moving to state 'stopped'
复制代码
3、后来实验发现有种方式可以让第2种方式成功运行:

  1. def ur(a):
  2.     if a == 1:
  3.         os.popen("python case.py")
  4.         pid = os.getpid()
  5.         os.kill(pid=pid, sig=signal.SIGKILL)
  6.     elif a == 2:
  7.         os.popen("adb logcat")
  8. pool = ThreadPool(4)
  9. lists = list([1, 2])
  10. pool.map(ur, lists)
  11. pool.close()
  12. pool.join()
复制代码

请注意:必须要这种持续运行的adb命令才行os.popen("adb logcat"),如果把"adb logcat"换成"adb devices"或者非adb命令都还是会失败。

以上都是一行一行的对比用例执行成功和失败的appium的日志发现的区别。

求原因。。。。。。谢谢!




作者: abcsell    时间: 2018-7-9 10:45
肯定是只有正确的方法才能运行
作者: qqq911    时间: 2018-7-9 10:45
环境部署的变量检查下
作者: jingzizx    时间: 2018-7-9 13:18
这个确实不知道,等高手作答
作者: 田玉函    时间: 2018-7-9 15:19
运行PY的脚本肯定是用LOGCAT呀,如果用获取设备DEVICES 设备肯定不行,因为你判断语句中运行的都是PY脚本跟设备有什么关系,ADB之外的可定不能运行呀  你这事在ADB中运行的PY脚本呀!




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2