51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2061|回复: 4
打印 上一主题 下一主题

[原创] Day1-6测试积点任务

[复制链接]
  • TA的每日心情
    擦汗
    11 小时前
  • 签到天数: 495 天

    连续签到: 2 天

    [LV.9]测试副司令

    跳转到指定楼层
    1#
    发表于 2018-7-6 13:43:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    1测试积点
    问题:
    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的日志发现的区别。

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



    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    开心
    2021-12-27 08:30
  • 签到天数: 471 天

    连续签到: 1 天

    [LV.9]测试副司令

    2#
    发表于 2018-7-9 10:45:12 | 只看该作者
    肯定是只有正确的方法才能运行
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    10 小时前
  • 签到天数: 1483 天

    连续签到: 2 天

    [LV.10]测试总司令

    3#
    发表于 2018-7-9 10:45:56 | 只看该作者
    环境部署的变量检查下
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    12 小时前
  • 签到天数: 2775 天

    连续签到: 2 天

    [LV.Master]测试大本营

    4#
    发表于 2018-7-9 13:18:06 | 只看该作者
    这个确实不知道,等高手作答
    回复

    使用道具 举报

  • TA的每日心情
    无聊
    2021-2-19 10:46
  • 签到天数: 7 天

    连续签到: 1 天

    [LV.3]测试连长

    5#
    发表于 2018-7-9 15:19:21 | 只看该作者
    运行PY的脚本肯定是用LOGCAT呀,如果用获取设备DEVICES 设备肯定不行,因为你判断语句中运行的都是PY脚本跟设备有什么关系,ADB之外的可定不能运行呀  你这事在ADB中运行的PY脚本呀!
    回复

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-9-24 20:23 , Processed in 0.075352 second(s), 22 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表