WeChat Mini Program Automation Testing Framework Minium - Summary of Frequently Asked Questions

This article mainly summarizes the common problems you encounter when using the Minium automation framework . It mainly includes common problems in installing Minium, and problems and solutions that are often encountered in the process of using Minium, including initialization and running use cases.

1. Install Minium

1.1 minitestcommand

command not fund: minitest

Solution:
This is because the directory installed by the minitest command is not pathin , and minitest -vcommands such as cannot be used

PS: Take the Mac operating system as an example, add
the installation directory to the environment variable/Library/Frameworks/Python.framework/Versions/3.8/binpath

insert image description here

2. An error is reported during the initialization phase

2.1 The port is occupied

Error: Port 9420 is in use (code 10)

Solution: close the project, kill the port process, re-execute, or use another port number

2.2 Connection timeout problem

Local debugging, Exception: receive from remote timeout, id: f933c71e-bc2b-41b7-b286-29c65dd0d4d8when an error occurs in the console

Solution: There are many reasons that may cause the connection timeout. You can check the following two aspects first:

2.2.1 Remote occupation of ide channel

Generally, it is because the channel of ide is occupied by remote debugging, please check whether ide is open. It is recommended to close the tool and execute it again to prevent the port from being occupied. or network environment and other reasons

For example, debug windows (including those that were not closed last time)

insert image description here

2.2.2 The version of the debugging basic library (common library) is too low

Encountering such a similar error report during the start-up phase is most likely caused by the version of the debugging basic library (public library) being too low. You can go to 开发者工具项目窗口右上角 -> 详情 -> 本地设置 -> 调试基础库select the latest version of the debug base library (public library)

insert image description here

2.3 There are _miniClassSetUpcalls

Solution: Make sure that the base library selected on the developer tools is up to date:开发者工具项目窗口右上角 -> 详情 -> 本地设置 -> 调试基础库

2.4 Real machine debugging problems

2.4.1 When debugging on the real machine, check whether the compilation is successful

For example: message: Error: provider:wxfaxxxxxx, version:latest, The logged-in user is not the developer of the applet

insert image description here

Solution: You need to solve the compilation failure problem yourself according to the error message

2.4.2 Real machine debugging version problem

Solution: 真机调试2.0 It will be supported in v1.2.8the version . The mobile phone needs to cooperate with 2.25.1the basic library of the above version to take effect. Those who do not meet the above two conditions need to switch back to真机调试1.0

insert image description here

2.4.3 Minium initiates remote debugging, but the phone does not start the applet normally/white screen

solution:

  • You can try to manually switch to and 二维码真机调试then switch自动真机调试
  • If it still doesn't work, please confirm that 远程调试the function is normal

3. Runtime use case error

3.1 Element positioning failed

minium.framework.exception.MiniElementNotFoundError: element[/view[1]/view[3]/iconfont/view] not found

Solution: The reason why the element cannot be found is generally the difference in the page structure or the change of the source code attribute after compilation

Reasons can be analyzed in the following ways:

  • Get the inner_wxml of the locatable element on the current page, the child element wxml of the element (not including itself), and compare the difference with the local wxml
  • Get the outer_wxml of the locatable element on the current page, the wxml of the element itself (only including itself), and compare the differences with the local wxml

Example:
element positioning xpath, the element is not found, by obtaining the sub-element wxml (inner_wxml) of the upper element, compare the wxml difference

insert image description here

3.2 Why the menu bar page jump at the bottom of the applet fails

For example, the following error message
minium.framework.exception.MiniAppError: can not redirectTo a tabbar page

Solution: This page is a tabbar page, you need to call switch_tab() to jump Note : Add "/" in front of the page url

3.3 The applet page cannot be found

For example, the following error message
minium.framework.exception.MiniAppError: "pages/testnative/testnative/pages/testnative/testnative" is not fund

Solution: Generally, it is because a relative path is used when jumping to the page, and the bottom layer of Minium will do the processing, splicing the specified path behind the path of the parent node of the current page

self.app.redirect_to("pages/testnative/testnative")

If it is a full path, you need to add "/" in front of the page url , which is an absolute path

PS: page path rules

  • /page/tabBar/API/index: absolute path, the front is /
  • tabBar/API/index: relative path, which will be spliced ​​after the path of the parent node of the current page

3.4 How to customize log information

Solution: The Minium framework provides the Logger class, and developers can customize log information at each level

self.logger.info("")
self.logger.debug("")
self.logger.warn("")
...

insert image description here

4. Other

4.1 The local debugging test report is not updated

Solution: There is a problem that the newly executed test results are not updated.
Due to the cache problem of the local browser, the Chrome browser opens the console F12, clicks 设置, and 偏好设置ticks 网络in .停用缓存(在开发者工具已打开时)

insert image description here

need help

Guess you like

Origin blog.csdn.net/WXMiniTest/article/details/128225357