Skip to main content

SAP QA Agent — UI automation engine + MCP Server packaging for SAP GUI

Project description

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

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

sap_qa_agent-0.2.2.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

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

sap_qa_agent-0.2.2-py3-none-any.whl (269.7 kB view details)

Uploaded Python 3

File details

Details for the file sap_qa_agent-0.2.2.tar.gz.

File metadata

  • Download URL: sap_qa_agent-0.2.2.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for sap_qa_agent-0.2.2.tar.gz
Algorithm Hash digest
SHA256 5b9cd4e1577172fdbe1226094dae07edd4ff11609f79a162cca45fbb95d84487
MD5 c05eda077aa7024a2abf55915109b8b5
BLAKE2b-256 1c355c0e8aa0e95734d622e65dd5b8887c2db694536523c2116dee5b6188a900

See more details on using hashes here.

File details

Details for the file sap_qa_agent-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: sap_qa_agent-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 269.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for sap_qa_agent-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b7d0fef7f4ce558f76e8c8962b36c9670b9576609603a4e3e86bcb0d6a3265e4
MD5 4cf3dd059b86d4dc5b10b6d456a79e61
BLAKE2b-256 8617fed7860ed894dded2c6db4f6078e55ffb937e41fde734f8cb6fc97264ee5

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