Minium:1.2.0(1.0.9至1.2.1)
Android wechat:8.0.15
OS:windows
微信开发者工具:1.05.2110110
1、如下测试脚本在pycharm执行,使用IDE的真机调试2.0,拉起小程序后不执行脚本命令,直到超时后IDE自动结束真机调试,然后minium会再次retry拉起小程序,但是因为真机调试窗口上已经结束真机调试,所以手机上的小程序并没有拉起来,一片空白,会retry 2次。
在脚本运行期间IDE、手机、pycharm都未进行任何干预操作!针对minium报Launch APP Error,手机前台已经打开微信,小程序也处于空白界面
2、测试脚本:
3、pycharm日志:
C:\Anaconda3\python.exe “C:\Program Files\JetBrains\PyCharm Community Edition 2021.2\plugins\python-ce\helpers\pycharm\_jb_pytest_runner.py” --target Test_demo.py::Test_Demo
Testing started at 16:14 …
Launching pytest with arguments Test_demo.py::Test_Demo --no-header --no-summary -q in C:\Users\Magic\PycharmProjects\HCMiniAutoMinium\Case
============================= test session starts =============================
collecting … collected 1 item
Test_demo.py::Test_Demo::test_demo ERROR [100%]minumexception: {‘TimeStamp’: ‘2021-10-15 16:18:27’, ‘Type’: ‘MiniLaunchError’, ‘Args’: ‘Launch APP Error’, ‘Trace’: ‘’, ‘Uin’: 0, ‘version’: ‘’, ‘ext’: ‘’}
INFO 2021-10-15 16:14:45,572 adbwrap.py __init__ 152 [‘3ebc310d’]
DEBUG 2021-10-15 16:14:45,579 adbwrap.py _run 219 adb -s 3ebc310d shell pm path com.tencent.mm.atstub.test
DEBUG 2021-10-15 16:14:45,691 adbwrap.py _run 219 adb -s 3ebc310d shell ls /data/app/com.tencent.mm.atstub.test-TYbu1dOBIbcWA1ctD_fgdg==/base.apk
DEBUG 2021-10-15 16:14:45,796 adbwrap.py _run 219 adb -s 3ebc310d pull /data/app/com.tencent.mm.atstub.test-TYbu1dOBIbcWA1ctD_fgdg==/base.apk C:\Users\Magic\AppData\Local\Temp\temp.apk
WARNI 2021-10-15 16:14:45,854 adbwrap.py _run 248 5623 KB/s (28798 bytes in 0.005s)
DEBUG 2021-10-15 16:14:45,856 apkinfo.py __init__ 21 parse apk:C:\Anaconda3\lib\site-packages\minium\native\lib\at\bin\AtServerTest.apk
DEBUG 2021-10-15 16:14:45,861 apkinfo.py __init__ 21 parse apk:C:\Users\Magic\AppData\Local\Temp\temp.apk
INFO 2021-10-15 16:14:45,865 adbwrap.py check_installed_apk 1236 com.tencent.mm.atstub.test check result:True
DEBUG 2021-10-15 16:14:45,866 adbwrap.py _run 219 adb -s 3ebc310d shell pm path com.tencent.mm.atstub
DEBUG 2021-10-15 16:14:46,020 adbwrap.py _run 219 adb -s 3ebc310d shell ls /data/app/com.tencent.mm.atstub-qje_uBNI1xmmQ7AZvIOELw==/base.apk
DEBUG 2021-10-15 16:14:46,149 adbwrap.py _run 219 adb -s 3ebc310d pull /data/app/com.tencent.mm.atstub-qje_uBNI1xmmQ7AZvIOELw==/base.apk C:\Users\Magic\AppData\Local\Temp\temp.apk
WARNI 2021-10-15 16:14:46,751 adbwrap.py _run 248 6330 KB/s (3477581 bytes in 0.536s)
DEBUG 2021-10-15 16:14:46,751 apkinfo.py __init__ 21 parse apk:C:\Anaconda3\lib\site-packages\minium\native\lib\at\bin\AtServer.apk
DEBUG 2021-10-15 16:14:46,760 apkinfo.py __init__ 21 parse apk:C:\Users\Magic\AppData\Local\Temp\temp.apk
INFO 2021-10-15 16:14:46,783 adbwrap.py check_installed_apk 1236 com.tencent.mm.atstub check result:True
INFO 2021-10-15 16:14:46,783 command_line.py check_at_env 23 环境检查OK!
DEBUG 2021-10-15 16:14:46,783 adbwrap.py _run 219 adb -s 3ebc310d shell pm list packages
DEBUG 2021-10-15 16:14:46,930 adbwrap.py _run 219 adb -s 3ebc310d shell pm list packages
DEBUG 2021-10-15 16:14:47,070 adbwrap.py _run 219 adb -s 3ebc310d forward tcp:58852 tcp:9999
DEBUG 2021-10-15 16:14:47,119 basedriver.py set_app_server_run 83 true_or_false:False
DEBUG 2021-10-15 16:14:47,120 adbwrap.py _run 219 adb -s 3ebc310d shell ps
DEBUG 2021-10-15 16:14:47,282 adbwrap.py _run 219 adb -s 3ebc310d shell ps -A
INFO 2021-10-15 16:14:47,450 javadriver.py _run_app_server 236 adb -s 3ebc310d shell am instrument -w -r -e class ‘com.tencent.mm.atstub.atserver.StubRunner#testStartServer’ com.tencent.mm.atstub.test/androidx.test.runner.AndroidJUnitRunner
DEBUG 2021-10-15 16:14:49,438 javadriver.py _run_app_server 283 java print:INSTRUMENTATION_STATUS: class=com.tencent.mm.atstub.atserver.StubRunner
DEBUG 2021-10-15 16:14:49,438 javadriver.py _run_app_server 283 java print:INSTRUMENTATION_STATUS: current=1
DEBUG 2021-10-15 16:14:49,439 javadriver.py _run_app_server 283 java print:INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
DEBUG 2021-10-15 16:14:49,439 javadriver.py _run_app_server 283 java print:INSTRUMENTATION_STATUS: numtests=1
DEBUG 2021-10-15 16:14:49,439 javadriver.py _run_app_server 283 java print:INSTRUMENTATION_STATUS: stream=
DEBUG 2021-10-15 16:14:49,439 javadriver.py _run_app_server 283 java print:com.tencent.mm.atstub.atserver.StubRunner:
DEBUG 2021-10-15 16:14:49,439 basedriver.py set_app_server_run 83 true_or_false:True
DEBUG 2021-10-15 16:14:49,439 javadriver.py _run_app_server 283 java print:INSTRUMENTATION_STATUS: test=testStartServer
DEBUG 2021-10-15 16:14:49,439 javadriver.py _run_app_server 283 java print:INSTRUMENTATION_STATUS_CODE: 1
DEBUG 2021-10-15 16:14:50,451 adbwrap.py _run 219 adb -s 3ebc310d shell am start -W -n com.tencent.mm.atstub/.ui.LauncherUI
DEBUG 2021-10-15 16:14:50,882 adbwrap.py start_app 765 Starting: Intent { cmp=com.tencent.mm.atstub/.ui.LauncherUI }
Status: ok
LaunchState: WARM
Activity: com.tencent.mm.atstub/.ui.LauncherUI
TotalTime: 298
WaitTime: 300
Complete
DEBUG 2021-10-15 16:14:50,882 javadriver.py wait_for_ui_ready 206 wait_for_ui_ready start
DEBUG 2021-10-15 16:14:50,882 basedriver.py request 168 id=1772636912944, http://127.0.0.1:58852/ping, params:None
DEBUG 2021-10-15 16:14:50,904 basedriver.py __redo_ret 124 {“ret”:0,“msg”:“pong”,“data”:{“result”:true,“value”:“pong”}}, java request costs 21ms
DEBUG 2021-10-15 16:14:50,906 basedriver.py request 168 id=1772636912944, http://127.0.0.1:58852/hasReady, params:None
DEBUG 2021-10-15 16:14:51,432 basedriver.py __redo_ret 124 {“ret”:0,“msg”:"",“data”:{“result”:true}}, java request costs 524ms
INFO 2021-10-15 16:14:51,432 javadriver.py wait_for_ui_ready 233 At init completed
DEBUG 2021-10-15 16:14:52,433 adbwrap.py _run 219 adb -s 3ebc310d shell ps
DEBUG 2021-10-15 16:14:52,540 adbwrap.py _run 219 adb -s 3ebc310d shell ps -A
DEBUG 2021-10-15 16:14:52,722 adbwrap.py _run 219 adb -s 3ebc310d shell am force-stop com.tencent.mm
DEBUG 2021-10-15 16:14:52,988 adbwrap.py _run 219 adb -s 3ebc310d shell am start -W -n com.tencent.mm/.ui.LauncherUI
DEBUG 2021-10-15 16:14:54,089 adbwrap.py start_app 765 Starting: Intent { cmp=com.tencent.mm/.ui.LauncherUI }
Status: ok
LaunchState: COLD
Activity: com.tencent.mm/.ui.LauncherUI
TotalTime: 977
WaitTime: 979
Complete
INFO 2021-10-15 16:14:54,090 wx_minium.py launch_dev_tool 186 Starting dev tool and launch MiniProgram project …
INFO 2021-10-15 16:14:54,091 minium_object.py _do_shell 60 de shell: “C:\Program Files (x86)\Tencent\微信web开发者工具\cli.bat” auto --project C:\Users\Magic\WeChatProjects\miniprogram-3 --auto-port 9420
INFO 2021-10-15 16:15:01,180 minium_object.py _do_shell 78 err:
- initialize
× IDE may already started at port 20142, trying to connect
√ IDE server started successfully, listening on http://127.0.0.1:22466
-
preparing
-
Fetching AppID (wx409afe628cb83e37) permissions
√ Using AppID: wx409afe628cb83e37
√ auto
INFO 2021-10-15 16:15:01,181 minium_object.py _do_shell 79 out:
INFO 2021-10-15 16:15:11,181 wx_minium.py connect_dev_tool 280 Trying to connect Dev tool …
INFO 2021-10-15 16:15:11,247 connection.py _connect 134 connect to WebChatTools successfully
DEBUG 2021-10-15 16:15:11,247 connection.py send 180 SEND > {“id”:“1cee733d-9836-4f95-89cf-29142d3f5597”,“method”:“App.callWxMethod”,“params”:{“method”:“getSystemInfoSync”,“args”:[]}}
DEBUG 2021-10-15 16:15:11,251 connection.py _on_message 227 RECV < {“id”:“1cee733d-9836-4f95-89cf-29142d3f5597”,“result”:{“result”:{“model”:“iPhone XR”,“pixelRatio”:2,“windowWidth”:414,“windowHeight”:808,“system”:“iOS 10.0.1”,“language”:“zh_CN”,“version”:“8.0.5”,“screenWidth”:414,“screenHeight”:896,“SDKVersion”:“2.20.0”,“brand”:“devtools”,“fontSizeSetting”:16,“benchmarkLevel”:1,“batteryLevel”:100,“statusBarHeight”:44,“safeArea”:{“top”:44,“left”:0,“right”:414,“bottom”:862,“width”:414,“height”:818},“deviceOrientation”:“portrait”,“platform”:“devtools”,“enableDebug”:false,"…
DEBUG 2021-10-15 16:15:11,252 connection.py send 180 SEND > {“id”:“a1cec000-caca-48b2-983c-56e9509e94fe”,“method”:“App.addBinding”,“params”:{“name”:“onAppRouteDone”}}
DEBUG 2021-10-15 16:15:11,254 connection.py _on_message 229 RECV < {“id”:“a1cec000-caca-48b2-983c-56e9509e94fe”,“result”:{}}
DEBUG 2021-10-15 16:15:11,255 connection.py send_async 190 ASYNC_SEND > {“id”: “c468c799-c263-44dd-8648-55374be5bee7”, “method”: “App.callFunction”, “params”: {“functionDeclaration”: “function () {\n if (!global.__minium_onAppRouteDone) {\n wx.onAppRouteDone(function (options) {\n onAppRouteDone(options, Date.now())\n })\n global.__minium_onAppRouteDone = true\n }\n}”, “args”: []}}
DEBUG 2021-10-15 16:15:11,255 connection.py send 180 SEND > {“id”:“911e08cb-ea3f-4f62-9968-a498867484b7”,“method”:“App.callFunction”,“params”:{“functionDeclaration”:“function () {if(!global.minium) global.minium = {};}”,“args”:[]}}
DEBUG 2021-10-15 16:15:11,257 connection.py _on_message 229 RECV < {“id”:“c468c799-c263-44dd-8648-55374be5bee7”,“result”:{}}
WARNI 2021-10-15 16:15:11,258 connection.py _on_message 237 received async msg: c468c799-c263-44dd-8648-55374be5bee7
DEBUG 2021-10-15 16:15:11,258 connection.py _on_message 229 RECV < {“id”:“911e08cb-ea3f-4f62-9968-a498867484b7”,“result”:{}}
DEBUG 2021-10-15 16:15:11,258 connection.py send 180 SEND > {“id”:“af591f2c-79f7-48e7-b164-2a06c06c00c5”,“method”:“App.callWxMethod”,“params”:{“method”:“getLaunchOptionsSync”,“args”:[]}}
DEBUG 2021-10-15 16:15:11,260 connection.py _on_message 229 RECV < {“id”:“af591f2c-79f7-48e7-b164-2a06c06c00c5”,“result”:{“result”:{“path”:“pages/index/index”,“query”:{},“scene”:1001,“referrerInfo”:{},“apiCategory”:“default”}}}
INFO 2021-10-15 16:15:11,260 app.py relaunch 281 ReLaunch: /pages/index/index
DEBUG 2021-10-15 16:15:11,260 connection.py send 180 SEND > {“id”:“831fcc5c-47ac-49c7-bb68-dc6269002daa”,“method”:“App.callWxMethod”,“params”:{“method”:“reLaunch”,“args”:[{“url”:"/pages/index/index"}]}}
DEBUG 2021-10-15 16:15:11,321 connection.py _on_message 229 RECV < {“id”:“831fcc5c-47ac-49c7-bb68-dc6269002daa”,“result”:{“result”:{“errMsg”:“reLaunch:ok”}}}
DEBUG 2021-10-15 16:15:16,322 connection.py send 180 SEND > {“id”:“837431ed-fd24-49c1-a64e-71925d3286d4”,“method”:“App.getCurrentPage”,“params”:{}}
DEBUG 2021-10-15 16:15:16,327 connection.py _on_message 229 RECV < {“id”:“837431ed-fd24-49c1-a64e-71925d3286d4”,“result”:{“pageId”:2,“path”:“pages/index/index”,“query”:{}}}
DEBUG 2021-10-15 16:15:16,327 connection.py send 180 SEND > {“id”:“aadcfc15-db32-4111-8780-897e28f577b5”,“method”:“App.callWxMethod”,“params”:{“method”:“getAccountInfoSync”,“args”:[]}}
DEBUG 2021-10-15 16:15:16,330 connection.py _on_message 229 RECV < {“id”:“aadcfc15-db32-4111-8780-897e28f577b5”,“result”:{“result”:{“miniProgram”:{“appId”:“wx409afe628cb83e37”,“envVersion”:“develop”,“version”:""}}}}
DEBUG 2021-10-15 16:15:16,331 connection.py send 180 SEND > {“id”:“382ee2fb-787d-4b05-a848-ce0d5683ce55”,“method”:“Tool.resetRemoteDebug”,“params”:{}}
DEBUG 2021-10-15 16:15:16,443 connection.py _on_message 229 RECV < {“id”:“382ee2fb-787d-4b05-a848-ce0d5683ce55”,“result”:{}}
INFO 2021-10-15 16:15:18,443 wx_minium.py enable_remote_debug 344 Enable remote debug, for the 1th times
DEBUG 2021-10-15 16:15:18,444 connection.py send 180 SEND > {“id”:“aa2d3201-bd96-45ca-b765-cbae7f5cb630”,“method”:“Tool.enableRemoteDebug”,“params”:{“auto”:true}}
DEBUG 2021-10-15 16:15:23,471 connection.py _on_message 229 RECV < {“id”:“aa2d3201-bd96-45ca-b765-cbae7f5cb630”,“result”:{}}
DEBUG 2021-10-15 16:15:24,684 connection.py _on_message 229 RECV < {“method”:“Tool.onRemoteDebugConnected”,“params”:{}}
ERROR 2021-10-15 16:16:23,472 connection.py wait_for 284 Can’t wait until App.initialized
DEBUG 2021-10-15 16:16:23,474 connection.py send 180 SEND > {“id”:“952a6da1-fcb5-4995-a150-8c2892f72d23”,“method”:“App.exit”,“params”:{}}
DEBUG 2021-10-15 16:16:23,495 connection.py _on_message 229 RECV < {“id”:“952a6da1-fcb5-4995-a150-8c2892f72d23”,“result”:{}}
INFO 2021-10-15 16:16:23,495 wx_minium.py enable_remote_debug 344 Enable remote debug, for the 2th times
DEBUG 2021-10-15 16:16:23,495 connection.py send 180 SEND > {“id”:“92786f10-d65d-4fc5-9692-cebc8e40a020”,“method”:“Tool.enableRemoteDebug”,“params”:{“auto”:true}}
DEBUG 2021-10-15 16:16:25,350 connection.py _on_message 229 RECV < {“id”:“92786f10-d65d-4fc5-9692-cebc8e40a020”,“result”:{}}
DEBUG 2021-10-15 16:16:26,852 connection.py _on_message 229 RECV < {“method”:“Tool.onRemoteDebugConnected”,“params”:{}}
ERROR 2021-10-15 16:17:25,350 connection.py wait_for 284 Can’t wait until App.initialized
DEBUG 2021-10-15 16:17:25,351 connection.py send 180 SEND > {“id”:“5172b3b1-a58f-4df4-9bb1-908e323f151d”,“method”:“App.exit”,“params”:{}}
DEBUG 2021-10-15 16:17:25,356 connection.py _on_message 229 RECV < {“id”:“5172b3b1-a58f-4df4-9bb1-908e323f151d”,“result”:{}}
INFO 2021-10-15 16:17:25,356 wx_minium.py enable_remote_debug 344 Enable remote debug, for the 3th times
DEBUG 2021-10-15 16:17:25,356 connection.py send 180 SEND > {“id”:“a8a41e8c-d07e-477a-9f3c-3805ef693a3b”,“method”:“Tool.enableRemoteDebug”,“params”:{“auto”:true}}
DEBUG 2021-10-15 16:17:27,348 connection.py _on_message 229 RECV < {“id”:“a8a41e8c-d07e-477a-9f3c-3805ef693a3b”,“result”:{}}
DEBUG 2021-10-15 16:17:28,567 connection.py _on_message 229 RECV < {“method”:“Tool.onRemoteDebugConnected”,“params”:{}}
ERROR 2021-10-15 16:18:27,348 connection.py wait_for 284 Can’t wait until App.initialized
ERROR 2021-10-15 16:18:27,349 wx_minium.py enable_remote_debug 368 Wait for APP initialized has been fail three times. Please check your phone’s current foreground APP is WeChat or not, and check miniProgram has been open or not
test setup failed
cls = <class ‘Test_demo.Test_Demo’>
def setUpClass(cls) -> None:
if not getattr(cls, “__is_minitest_suite__”, False):
_miniClassSetUp = getattr(cls, “_miniClassSetUp”, None)
if _miniClassSetUp:
> _miniClassSetUp()
C:\Anaconda3\lib\site-packages\minium\framework\assertbase.py:127:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\Anaconda3\lib\site-packages\minium\framework\minitest.py:611: in _miniClassSetUp
cls.mini = get_minium(cls.CONFIG)
C:\Anaconda3\lib\site-packages\minium\framework\minitest.py:89: in get_minium
g_minium = minium.miniprogram.get_minium_driver(conf=cfg, native=g_native)
C:\Anaconda3\lib\site-packages\minium\miniprogram\__init__.py:28: in get_minium_driver
return APP[application](conf, *args, **kwargs)
C:\Anaconda3\lib\site-packages\minium\miniprogram\wx_minium.py:113: in __init__
path = self.enable_remote_debug(
C:\Anaconda3\lib\site-packages\minium\miniprogram\base_driver\minium_log.py:135: in wrapper
result = func(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <minium.miniprogram.wx_minium.WXMinium object at 0x0000019CB97250A0>
use_push = ‘True’, path = None, connect_timeout = 60
def enable_remote_debug(self, use_push=True, path=None, connect_timeout=180):
self.reset_remote_debug()
time.sleep(2)
if use_push:
retry_times = 3
while retry_times > 0:
try:
self.logger.info(f"Enable remote debug, for the {4 - retry_times}th times")
self.connection.send(
“Tool.enableRemoteDebug”,
params={“auto”: True},
max_timeout=connect_timeout,
)
self.is_remote = True
except Exception as e:
retry_times -= 1
self.logger.error(“enable remote debug fail …”)
self.logger.error(e)
if retry_times == 0:
self.logger.error(
“Enable remote debug has been fail three times. Please check your”
" network or proxy effective or not "
)
raise
continue
else:
retry_times -= 1
rtn = self.connection.wait_for(
method=“App.initialized”, max_timeout=connect_timeout
)
if retry_times == 0 and rtn is False:
self.logger.error(
“Wait for APP initialized has been fail three times. Please check your”
" phone’s current foreground APP is WeChat or not, and check"
" miniProgram has been open or not "
)
> raise MiniLaunchError(“Launch APP Error”)
E minium.framework.exception.MiniLaunchError: Launch APP Error
C:\Anaconda3\lib\site-packages\minium\miniprogram\wx_minium.py:373: MiniLaunchError
=================== 1 warning, 1 error in 223.13s (0:03:43) ===================
Process finished with exit code 1