无需构建,直接访问官方文档(https://minitest.weixin.qq.com/#/)
如果新手通过本地解压再执行,遇到以下问题
请直接使用以下命令,即可一次性成功安装
pip3 install https://minitest.weixin.qq.com/minium/Python/dist/minium-latest.zip
安装微信开发者工具(我本机使用的版本是 1.06.2205312),并打开安全模式: 设置 -> 安全设置 -> 服务端口: 打开
在工具栏菜单中点击设置,选择项目设置,切换到 “本地设置”,将调试基础库选择大于 2.7.3 的库;
开启微信工具安全设置中的 CLI/HTTP (提供了命令行和 HTTP 两种调用方式) 调用功能。
开启被测试项目的自动化端口号
"path/to/cli" auto --project "path/to/project" --auto-port 9420
"C:/Program Files (x86)/Tencent/微信web开发者工具/cli" auto --project "C:/WeChatProjects/miniprogram-1" --auto-port 9420
{
"project_path": "C:\\WeChatProjects\\miniprogram-1",
"dev_tool_path": "C:\\Program Files (x86)\\Tencent\\微信web开发者工具\\cli.bat",
"debug_mode": "debug",
"test_port": 9420,
"platform": "ide",
"app": "wx",
"assert_capture": true,
"request_timeout":60,
"remote_connect_timeout": 300,
"auto_relaunch": true
}
{
"project_path": "C:\\WeChatProjects\\xxx_chinamobile-pmc_migration2\\unpackage\\dist\\build\\mp-weixin",
"dev_tool_path": "C:\\Program Files (x86)\\Tencent\\微信web开发者工具\\cli.bat",
"debug_mode": "debug",
"test_port": 9420,
"platform": "Android",
"app": "wx",
"enable_app_log": true,
"device_desire": {
"serial": "d310bf55"
},
"assert_capture": true,
"request_timeout":60,
"remote_connect_timeout": 300,
"auto_relaunch": true
}
{
"pkg_list": [
{
"case_list": [
"test_*"
],
"pkg": "testcase.*_test"
}
]
}
# !/usr/bin/python
# -*- coding: utf-8 -*-
"""
@File : first_test.py
@Create Time: 2022-06-01 16:17
@Description:
"""
import minium
class FirstTest(minium.MiniTest):
def test_get_system_info(self):
sys_info = self.mini.get_system_info()
print("FirstTest: ", sys_info)
self.assertIn("SDKVersion", sys_info)
if __name__ == "__main__":
import unittest
loaded_suite = unittest.TestLoader().loadTestsFromTestCase(FirstTest)
result = unittest.TextTestRunner().run(loaded_suite)
print(result)
# !/usr/bin/python
# -*- coding: utf-8 -*-
"""
@File : run.py
@Create Time: 2022-06-01 17:21
@Description:
"""
import os
# 运行执行class文件中的指定用例
cmd0 = "minitest -m testcase.first_test --case test_get_system_info -c config.json -g"
# 运行执行testcase文件中的指定用例
cmd1 = "minitest -m testcase.first_test -c config.json -g"
# 按照suite配置执行用例
cmd2 = "minitest -s suite.json -c config.json -g"
os.system(cmd0)
测试结果存储在 outputs 下,运行命令
python -m http.server 12345 -d outputs
然后在浏览器上访问 http://localhost:12345 即可查看报告
https://blog.csdn.net/jiangjunsss/article/details/120228371
https://blog.csdn.net/baguenaudier/article/details/124478687
https://blog.csdn.net/weixin_49546967/article/details/119858529
https://minitest.weixin.qq.com/#/minium/Python/readme
https://developers.weixin.qq.com/community/develop/article/doc/0000cae3a58748ed7f2c8975351413