mcpField
T
testing-assistant

testing-assistant

github.com/robthepcguy测试与质量20656 次安装3 天前更新
代码仓库

关于 testing-assistant

面向 Claude Patent Creator 的测试与验证 Skill,涵盖自动化测试、通过 Claude Code 手动检查,以及测试编写和性能评估。

主要功能

  1. 01运行安装与组件测试
  2. 02通过 Claude Code 验证 MCP 工具
  3. 03创建单元与回归测试
  4. 04评估搜索和分析速度

适用场景

  1. 01代码变更后检查项目
  2. 02排查测试失败和性能问题
  3. 03验证专利搜索与分析工具

MCP 相关

该 Skill 指导通过 Claude Code 手动测试 MCP 工具,并检查工具是否可用。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/robthepcguy/claude-patent-creator --skill testing-assistant

安装后在 Claude Code 中输入/testing-assistant确认已加载。

详细介绍

测试助手技能

用于测试和验证 Claude Patent Creator 的专家系统。

致 Claude: 测试脚本位于 scripts/ 目录中。

  • 直接运行相应的测试
  • 从项目根目录运行
  • 测试需要已激活的 venv
  • 仅在测试失败时运行诊断

适用场景

运行测试套件、验证新功能、在更改后进行测试、调试故障、创建测试、设置 CI/CD、性能测试、端到端验证和回归测试。

测试金字塔

         /\
        /  \       E2E (Manual + Automated)
       /----\
      / API  \     Integration Tests
     /--------\
    /  Unit   \    Unit Tests
   /----------\

策略: 更多单元测试(快速、隔离),较少集成测试(中等速度),最少端到端测试(较慢)。

测试套件概览

scripts/
+-- test_install.py          # Complete installation validation
+-- test_gpu.py              # GPU detection and CUDA
+-- test_bigquery.py         # BigQuery connection
+-- test_analyzers.py        # Claims, spec, formalities
+-- test_embedding_speed.py  # Performance benchmarks
+-- test_checkpoint.py       # Index checkpoint system

快速测试:

python scripts/test_install.py

通过 Claude 手动测试

通过 Claude Code 界面测试 MCP 工具。

快速测试示例
1. MPEP Search: "Search MPEP for claim definiteness requirements"
2. Patent Search: "Search for patents about neural networks filed in 2024"
3. Claims Review: "Review these claims: [paste test claims]"
4. Full Review: "/full-review" (with test application)
5. Diagrams: "Create a flowchart for this process: [describe]"
验证清单
[OK] MPEP search returns relevant results
[OK] BigQuery search finds patents
[OK] Claims analyzer identifies issues
[OK] Specification analyzer checks support
[OK] Formalities checker validates format
[OK] Diagrams generate successfully
[OK] Full review workflow completes
[OK] All MCP tools accessible
[OK] Error messages clear and helpful
[OK] Performance acceptable (<2s most ops)

创建新测试

快速入门
# Unit test template
def test_basic_functionality():
    from mcp_server.your_module import YourClass
    instance = YourClass()
    result = instance.method("test input")
    assert result is not None
    print("[OK] test_basic_functionality passed")

测试类别:

  1. 基本功能
  2. 边缘情况
  3. 性能
  4. 错误处理

性能测试

快速基准测试
from mcp_server.mpep_search import MPEPIndex
import time

index = MPEPIndex()
index.build_index()
index.search("test", top_k=5)  # Warm up

start = time.time()
result = index.search("claim definiteness", top_k=5)
duration = time.time() - start
print(f"Search took: {duration:.3f}s")
性能阈值
操作阈值备注
MPEP 搜索(首次)<3s模型加载
MPEP 搜索(后续)<500ms已缓存的模型
BigQuery 搜索<2s取决于网络
权利要求分析<3s20 条权利要求
说明书分析<10s10 页
图表生成<1sSVG 输出

测试故障排查

问题解决方案
导入错误激活 venv,运行 pip install -r requirements.txt
GPU 测试失败检查 nvidia-smi,重新安装 PyTorch,或跳过
BigQuery 失败重新认证:gcloud auth application-default login
找不到索引重建:patent-creator rebuild-index
速度太慢检查 GPU 使用情况;首次运行较慢;检查系统负载

最佳实践

  1. 每次更改后都进行测试
  2. 自动化测试
  3. 遵循测试金字塔(更多单元测试,更少端到端测试)
  4. 快速测试(套件用时 <5 min)
  5. 隔离测试(无依赖)
  6. 明确的断言
  7. 编写测试文档
  8. 对测试进行版本控制
  9. 定期运行(每周)
  10. 监控性能

快速参考

运行所有测试
python scripts/test_install.py
python scripts/test_gpu.py
python scripts/test_bigquery.py
python scripts/test_analyzers.py
python scripts/test_embedding_speed.py
回归测试
python scripts/test_install.py || exit 1
python scripts/test_bigquery.py || exit 1
python scripts/test_analyzers.py || exit 1
echo "[OK] All regression tests passed!"
手动检查清单
□ Ask Claude to search MPEP
□ Ask Claude to search patents
□ Ask Claude to review claims
□ Run /full-review command
□ Generate a diagram
□ Verify all tools work
□ Check performance (<2s)

评论

支持 Markdown