Skip to main content

MCP Server for generating iOS unit tests for Chromium/Edge projects

Project description

iOS Unit Test Generator

智能 MCP 服务器,自动生成、编译、运行和修复 iOS 单元测试。

🚀 快速开始(推荐使用 uvx)

无需拉取代码,直接在 VS Code 中配置即可使用!

方式一:VS Code MCP 配置(推荐)

在 VS Code 设置中添加 MCP 服务器配置:

macOS/Linux - 编辑 ~/.vscode/mcp.json:

{
  "servers": {
    "ios-unittest-generator": {
      "command": "uvx",
      "args": ["ios-unittest-generator"],
      "env": {
        "CHROMIUM_SRC": "/path/to/chromium/src"
      }
    }
  }
}

Windows - 编辑 %APPDATA%\Code\User\mcp.json:

{
  "servers": {
    "ios-unittest-generator": {
      "command": "uvx",
      "args": ["ios-unittest-generator"],
      "env": {
        "CHROMIUM_SRC": "C:\\path\\to\\chromium\\src"
      }
    }
  }
}

方式二:命令行运行

# 直接运行(无需安装)
uvx ios-unittest-generator

# 或者先安装再运行
pip install ios-unittest-generator
ios-unittest-generator

📋 核心功能

  • ✅ 自动分析源文件,识别可测试元素
  • ✅ 生成完整的测试文件(包含 fixture、SetUp、测试用例)
  • ✅ 智能检测测试目标(支持 ios/chrome/*components/*/ios/* 等所有路径)
  • ✅ 自动更新 BUILD.gn 文件(按字母顺序)
  • ✅ 自动编译测试,智能分析编译错误
  • ✅ 自动运行测试,智能分析运行时错误

📖 11 个 MCP 工具

工具 功能
full_test_workflow 完整工作流(分析→生成→增强→编译→运行)
analyze_ios_code_for_testing 分析源文件,提取可测试元素
generate_ios_unittest_file 生成测试文件
check_ios_test_coverage 检查测试覆盖率
verify_test_enhancement_complete 验证测试增强完成(质量门控)
compile_ios_unittest 编译测试(自动错误分析)
run_ios_unittest 运行测试(自动错误分析)
analyze_runtime_errors 分析运行时错误
analyze_compilation_errors 分析编译错误
update_existing_tests 增量更新测试
update_build_file_for_test 自动更新 BUILD 文件

💡 使用示例

# 一键生成完整测试
Use full_test_workflow for ios/chrome/browser/ui/foo.mm

# 单独编译
Use compile_ios_unittest for ios/chrome/browser/ui/foo.mm

# 单独运行
Use run_ios_unittest with filter FooTest.*

🔧 环境变量

变量 描述 示例
CHROMIUM_SRC Chromium 源码根目录 /Users/user/chromium/src

📦 发布到 PyPI

# 构建
python -m build

# 上传到 PyPI
twine upload dist/*

# 上传到 TestPyPI(测试)
twine upload --repository testpypi dist/*

版本: v4.19.0
更新日期: 2026-01-22

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ios_unittest_generator-4.19.0.tar.gz (87.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ios_unittest_generator-4.19.0-py3-none-any.whl (90.4 kB view details)

Uploaded Python 3

File details

Details for the file ios_unittest_generator-4.19.0.tar.gz.

File metadata

  • Download URL: ios_unittest_generator-4.19.0.tar.gz
  • Upload date:
  • Size: 87.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for ios_unittest_generator-4.19.0.tar.gz
Algorithm Hash digest
SHA256 e7c66a28b3dfdf4d123550e21931579cf8b7052a34da969a3c8f53af7e6cf6db
MD5 4e316f3e6c617a23f188619c8343f5ab
BLAKE2b-256 6ea5e59e89629c3be20dc5680e6273e8d52abe34bb987723a891fe036f2d01ea

See more details on using hashes here.

File details

Details for the file ios_unittest_generator-4.19.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ios_unittest_generator-4.19.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82da5b274e1dd336d3116fc79b8ae3c7e8cdbe767c9e856a3c39ac473d8ab1b4
MD5 e3cbd7678fdc0f0038f2265f7298cec1
BLAKE2b-256 1c905f45d01d8053f6bf9a6076775ccafac684dd6bde9941fdc577b343eb1b49

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page