# Robot Framework 接入 Server酱：自动化测试结果推送到微信（2026 教程）

> 通过 robotframework-apprise 库将 Robot Framework 自动化测试结果推送到微信，使用 schan:// 协议一行配置搞定通知。

- 网页版：https://sct.ftqq.com/docs/integrations/robot-framework/
- 更新日期：2026-07-17

# Robot Framework + Server酱：自动化测试结果推送到微信

> 效果：Robot Framework 测试跑完后，自动把结果推送到微信

## 前置条件

- 获取 SendKey：登录 sct.ftqq.com，在「SendKey」页面复制（[30 秒获取教程](https://sct.ftqq.com/docs/getting-started/sendkey/)）
- 已安装 Robot Framework 运行环境

## 配置步骤

1. 安装依赖库：

```bash
pip install robotframework-apprise
```

2. 命令行自测验证连通性（可选）：

```bash
pip install apprise && apprise -t "测试标题" -b "测试正文" "schan://你的SENDKEY"
```

3. 在测试用例中引入库并调用。`schan://` 是 Apprise 中 Server酱的专用协议，对接 Server酱Turbo，SCT 开头的 SendKey 直接可用。在测试用例里 `Import Library` 导入库后，将 target 填写为 `schan://你的SENDKEY`，然后调用其发送关键字即可（具体关键字名称以 robotframework-apprise 官方文档为准）。

如需推送到企业微信、钉钉或飞书群，请参考[通道配置](https://sct.ftqq.com/docs/getting-started/channels/)。

## 常见问题

**额度怎么计算？**

免费用户每天可发送 5 条，每分钟上限 50 条；订阅会员目前特价最低 3 元/月，一天最多可发 1000 条（[价格详情](https://sct.ftqq.com/subscribe)）。

**消息没收到怎么办？**

先确认命令行自测能否成功，并检查 target 中的 SendKey 是否正确。`schan://` 协议对接 Server酱Turbo，SCT 开头的 SendKey 直接可用。更多排查步骤见[常见问题与排查](https://sct.ftqq.com/docs/getting-started/faq/)。

**频率受限怎么处理？**

单个 SendKey 每分钟请求上限为 50。如测试用例并发量大，建议在脚本中合并通知内容，避免短时间内高频请求触发限制。

## 相关集成

- [/integrations/python/](https://sct.ftqq.com/docs/integrations/python/) —— Python 脚本推送
- [/integrations/uptime-kuma/](https://sct.ftqq.com/docs/integrations/uptime-kuma/) —— Uptime Kuma 宕机告警
- [/integrations/qinglong/](https://sct.ftqq.com/docs/integrations/qinglong/) —— 青龙面板任务通知


## 懒人方案：把这段话复制给你的 AI 助手

把下面这段文字原样粘贴给 Claude Code、Cursor 或任何 AI 编程助手，它就会替你完成 Server酱 的接入：

```text
请帮我把 Server酱 微信通知接入到我当前的项目/工具中：
1. API：POST https://sctapi.ftqq.com/{SendKey}.send，参数 title（必填，不能含换行）、desp（正文，支持 Markdown，可选）；成功时返回 JSON 的 code 为 0。
2. 如果我的 SendKey 以 sctp 开头，则改用 https://{uid}.push.ft07.com/send/{SendKey}.send，uid 是 SendKey 中 sctp 与 t 之间的数字。
3. SendKey 从环境变量 SERVERCHAN_SENDKEY 读取；如果没有，提醒我到 https://sct.ftqq.com 免费获取（每天 5 条额度）。
4. 安全要求：不要把 SendKey 硬编码进代码、不要打印到日志、不要提交到 git。
5. 频率约定：任务结束发 1 条结果摘要即可，批量任务合并成一条，不要每步都推。
请根据我当前的项目和场景直接写好代码/配置并验证。
```

