收藏
回答

[Minium]使用minium的miniruntest执行用例时报错?

Windows系统

  1. 不使用suite配置文件直接执行命令miniruntest报错


    config.json配置文件如下

    {
    "debug_mode": "debug",
     "project_path": "C:\\Users\\Administrator\\test",
     "enable_app_log": true,
     "platform": "ide",
     "close_ide": false,
     "test_port": 9420,
     "no_assert_capture": false,
     "use_push": true,
     "dev_tool_path":"D:\\Program Files\\微信web开发者工具\\cli.bat",
     "remote_connect_timeout": 180,
     "device_desire":{}
    }


2.使用suite配置文件执行miniruntest报错

D:\code\MiniumDemo>miniruntest -s ./suite.json -g

Traceback (most recent call last):

  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\Scripts\miniruntest-script.py", line 11, in <module>

    load_entry_point('minium==0.0.2', 'console_scripts', 'miniruntest')()

  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\framework\loader.py", line 100, in main

    tests=load_from_suite(path,suite_path)

  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\framework\loader.py", line 28, in load_from_suite

    module_case_info_list=case_inspect.load_module(case_path)

  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\framework\case_inspect.py", line 72, in load_module

    mod=import_module(module_name)

  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\framework\case_inspect.py", line 20, in import_module

    mod=__import__(module_name)

ModuleNotFoundError: No module named 'venv.Lib'


回答关注问题邀请回答
收藏

4 个回答

  • 曾夏
    曾夏
    2019-09-25

    您好,能否贴一下demo的代码和suite.json?

    2019-09-25
    有用
    回复 3
    • 吴青
      吴青
      2019-09-25

      还想请问一下这个报错是什么问题

      DEBUG 2019-09-25 14:25:06,384 minium_object.py _do_shell       37  idePortFile: C:\Users\Administrator\AppData\Local\微信开发者工具\User Data\Default\.ide

      DEBUG 2019-09-25 14:25:07,407 minium_object.py _do_shell       37  starting ide...

      DEBUG 2019-09-25 14:25:13,131 minium_object.py _do_shell       37  IDE server has started, listening on http://127.0.0.1:64258

      DEBUG 2019-09-25 14:25:13,134 minium_object.py _do_shell       37  initialization finished

      DEBUG 2019-09-25 14:25:18,790 minium_object.py _do_shell       37  Open project with automation enabled success C:\Users\Administrator\weshop\wx82d43fee89cdc7df\dist

      INFO  2019-09-25 14:25:29,664 connection.py _connect        56  connect to WebChatTools successfully

      DEBUG 2019-09-25 14:25:29,665 connection.py send            73  SEND > {"id":"423d59d9-b4ed-469b-ae2f-e663bb87ab74","method":"App.addBinding","params":{"name":"onVideoContextCreated"}}

      Traceback (most recent call last):

        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\wechatdriver\minium.py", line 103, in launch_dev_tool

          self.app=App(connection)

        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\wechatdriver\app.py", line 14, in __init__

          self._create_context_listener()

        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\wechatdriver\app.py", line 165, in _create_context_listener

          self._expose_function("onVideoContextCreated",self._on_video_context_created)

        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\wechatdriver\app.py", line 179, in _expose_function

          self.connection.send("App.addBinding",{"name":name})

        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\wechatdriver\connection.py", line 75, in send

          return self._receive_response(max_timeout)

        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\wechatdriver\connection.py", line 100, in _receive_response

          raise Exception("receive from remote timeout, id: %s"%record_id)

      Exception: receive from remote timeout, id: 423d59d9-b4ed-469b-ae2f-e663bb87ab74

      ERROR 2019-09-25 14:26:29,673 minium.py  launch_dev_tool 108 receive from remote timeout, id: 423d59d9-b4ed-469b-ae2f-e663bb87ab74

      Traceback (most recent call last):

        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\wechatdriver\minium.py", line 103, in launch_dev_tool

          self.app=App(connection)

        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\wechatdriver\app.py", line 14, in __init__

          self._create_context_listener()

        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\wechatdriver\app.py", line 165, in _create_context_listener

          self._expose_function("onVideoContextCreated",self._on_video_context_created)

        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\wechatdriver\app.py", line 179, in _expose_function

          self.connection.send("App.addBinding",{"name":name})

        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\wechatdriver\connection.py", line 75, in send

          return self._receive_response(max_timeout)

        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\wechatdriver\connection.py", line 100, in _receive_response

          raise Exception("receive from remote timeout, id: %s"%record_id)

      Exception: receive from remote timeout, id: 423d59d9-b4ed-469b-ae2f-e663bb87ab74

      ERROR 2019-09-25 14:26:29,674 loader.py  main            116 not catch exception


      2019-09-25
      回复
    • 曾夏
      曾夏
      2019-09-25回复吴青
      这个可以看下文档里面,一般是有远程调试窗口挡住的开发者工具
      2019-09-25
      回复
    • AcE
      AcE
      2021-02-05回复曾夏
      有远程调试窗口挡住的开发者工具是什么意思,我现在也出现了这种从远程超时接收的报错想问下
      2021-02-05
      回复
  • 冬日
    冬日
    2020-01-19

    请问是安装完minium才可以使用miniruntest吗?

    2020-01-19
    有用
    回复
  • 喵星人
    喵星人
    2019-10-29

    有帮助

    2019-10-29
    有用
    回复
  • 吴青
    吴青
    2019-09-25

    suite.json

    {
    "pkg_list": [
    {
    "pkg": "TestSuite.*",
         "case_list": [
    "test_air"
         ]
    }
    ]
    }

    demo.py

    import minium
    import time

    class FirstTest(minium.Minium,minium.MiniTest):

    def test_air(self):
    miniprogram = self.app #获取小程序实例
         miniprogram.go_home()


    2019-09-25
    有用
    回复 3
    • 曾夏
      曾夏
      2019-09-25
      1. 代码写错了,应该改成:

        import minium
        import time
         
         
        class FirstTest(minium.MiniTest):
         
            def test_air(self):
                miniprogram = self.app #获取小程序实例
                miniprogram.go_home()
      2. 确认是bug,这两天会fix

      2019-09-25
      回复
    • 吴青
      吴青
      2019-10-14回复曾夏
      这样写代码的原因是minium.MiniTest
      里面的API调用失败,只能从minium.Minium中调用app去初始化实例
      miniprogram = self.app #获取小程序实例
      MiniTest报错
        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\framework\assertbase.py", line 157, in __getattribute__
          attr=super().__getattribute__(item)
      2019-10-14
      回复
    • 吴青
      吴青
      2019-10-14回复曾夏
      在上面的代码增加这句报错  
      self.capture("miniDemo.png")

      File "D:/code/MiniumDemo/demo.py", line 34, in
          FirstTest().test_input()
        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\wechatdriver\minium_log.py", line 58, in wrapper
          result=func(*args,**kwargs)
        File "D:/code/MiniumDemo/demo.py", line 30, in test_input
          self.capture("miniDemo.png")
        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\framework\minitest.py", line 96, in capture
          path=os.path.join(self.screen_dir,filename)
        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\framework\assertbase.py", line 157, in __getattribute__
          attr=super().__getattribute__(item)
        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\framework\assertbase.py", line 188, in screen_dir
          screen_dir=self.wrap_filename("images")
        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\framework\assertbase.py", line 195, in wrap_filename
          return os.path.abspath(os.path.join(self.test_config.case_output,filename))
        File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\minium-0.0.2-py3.7.egg\minium\framework\assertbase.py", line 157, in __getattribute__
          attr=super().__getattribute__(item)
      AttributeError: 'FirstTest' object has no attribute 'test_config'
      2019-10-14
      回复
登录 后发表内容
问题标签