Skip to main content

SAP QA Agent

PyPI version Python 3.12+

基于 AI 驱动的 SAP GUI 自动化测试引擎,支持测试用例解析、智能执行、AI 自愈和操作录制。

快速开始

# 安装
pip install sap-qa-agent

# 启动 MCP Server(配合 Claude Desktop / Kiro / Cursor 使用)
uvx --from sap-qa-agent sap-qa-mcp

核心功能

  • 测试用例解析 — 支持 Excel (.xlsx) 和 Markdown 格式
  • SAP GUI 自动化 — 基于 COM Scripting API 驱动 SAP 操作
  • AI 自愈 — 执行失败时自动分析并修复(基于智谱 GLM)
  • 知识库复用 — 积累脚本模板,加速后续执行
  • 操作录制 — 记录手动操作转化为可复用步骤

作为 MCP Server 被使用

SAP QA Agent 可作为 MCP (Model Context Protocol) Server,被 Claude Desktop、Kiro、Cursor 等 AI Agent 直接调用。

pip install sap-qa-agent
uvx --from sap-qa-agent sap-qa-mcp

Claude Desktop 配置

编辑 %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "sap-qa-agent": {
      "command": "sap-qa-mcp",
      "args": ["--log-level", "INFO"],
      "env": {
        "GLM_API_KEY": "<your-glm-api-key>"
      }
    }
  }
}

Kiro 配置

在项目根目录创建 .kiro/settings/mcp.json:

{
  "mcpServers": {
    "sap-qa-agent": {
      "command": "sap-qa-mcp",
      "env": {
        "GLM_API_KEY": "<your-glm-api-key>"
      },
      "autoApprove": ["parse_test_case", "list_skills", "sap_session_status"]
    }
  }
}

Cursor 配置

编辑 .cursor/mcp.json:

{
  "mcpServers": {
    "sap-qa-agent": {
      "command": "sap-qa-mcp",
      "env": {
        "GLM_API_KEY": "<your-glm-api-key>"
      }
    }
  }
}

GLM API Key 获取:访问 智谱 AI 开放平台 注册并创建 API Key。

项目结构

ui_test_python/
├── app/                    # 应用代码
│   ├── main.py             # FastAPI 入口
│   ├── mcp_server/         # MCP Server 实现
│   ├── core/               # 核心引擎(解析、执行、自愈)
│   ├── sap/                # SAP GUI 封装
│   ├── ai/                 # GLM AI 客户端
│   └── data/               # 数据模型与知识库
├── mcp_skills/             # MCP Skills 包
├── knowledge_base/         # 脚本模板知识库
├── tests/                  # 测试套件
├── examples/mcp/           # MCP 配置示例
├── docs/                   # 文档
│   └── mcp-integration.md  # MCP 接入指南
└── pyproject.toml          # 项目配置

可用的 MCP Skills

SAP QA Agent 提供 5 个预置 Skills:

Skill ID 功能
sap-parse-and-execute 解析并执行 SAP 测试用例
sap-session-bootstrap SAP 会话连接引导
sap-self-healing-playbook AI 自愈故障排查手册
sap-knowledge-base-reuse 复用知识库模板执行测试
sap-recording-to-testcase 将录制操作转换为测试用例

可用的 MCP Tools

  • parse_test_case - 解析测试用例文件
  • sap_connect - 连接 SAP GUI
  • sap_disconnect - 断开 SAP GUI 连接
  • sap_session_status - 检查 SAP 会话状态
  • execute_test_case - 执行测试用例
  • get_task_status - 获取任务状态
  • list_tasks - 列出任务
  • stop_task - 停止任务
  • capture_screen - 截取屏幕
  • list_skills - 列出 Skills
  • get_skill - 获取 Skill 详情
  • list_templates - 列出模板
  • get_template - 获取模板详情
  • start_recording - 开始录制
  • stop_recording - 停止录制
  • atomic.* - 原子化操作工具

环境要求

  • Python 3.12+
  • Windows 10/11
  • SAP GUI(已启用 Scripting)

使用方式

通过 PyPI 安装

pip install sap-qa-agent

通过 uvx 直接运行(无需安装)

uvx --from sap-qa-agent sap-qa-mcp

本地开发安装

pip install -e .

许可证

Private

版本历史

  • 0.2.2 (2026-05-10) - 内联 MCP 接入指南到 README,修复 PyPI 描述显示
  • 0.2.0 (2026-05-09) - 移除 sap-qa-backend,只保留 MCP Server
  • 0.1.1 (2026-05-09) - 修复描述为 "for SAP GUI"
  • 0.1.0 (2026-05-09) - 初始版本发布到 PyPI

Metadata

Release files for sap-qa-agent 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sap-qa-agent 0.2.2
File Size Uploaded Provenance Actions
sap_qa_agent-0.2.2.tar.gz 1.6 MB Without provenance Details for sap_qa_agent-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sap-qa-agent 0.2.2
File Interpreter ABI Platform Actions
sap_qa_agent-0.2.2-py3-none-any.whl Python 3 none any Details for sap_qa_agent-0.2.2-py3-none-any.whl

Total release size: 1.9 MB

Release files / sap_qa_agent-0.2.2.tar.gz

Download URL sap_qa_agent-0.2.2.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
5b9cd4e1577172fdbe1226094dae07edd4ff11609f79a162cca45fbb95d84487
BLAKE2b-256 checksum
How to use checksums
1c355c0e8aa0e95734d622e65dd5b8887c2db694536523c2116dee5b6188a900
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / sap_qa_agent-0.2.2-py3-none-any.whl

Download URL sap_qa_agent-0.2.2-py3-none-any.whl
Size 269.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b7d0fef7f4ce558f76e8c8962b36c9670b9576609603a4e3e86bcb0d6a3265e4
BLAKE2b-256 checksum
How to use checksums
8617fed7860ed894dded2c6db4f6078e55ffb937e41fde734f8cb6fc97264ee5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for sap-qa-agent 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page