使用说明
TestRail MCP服务器
将TestRail与任何模型上下文协议(MCP)编排器无缝集成。该服务器提供了强大的工具,让您可以管理测试用例、项目、套件、运行和结果,所有这些都可以直接从您的AI工作流或测试自动化管道中管理。
无论您是同步Playwright测试结果,从Swagger日志中自动创建测试用例,还是使用智能测试推理驱动对话,此服务器都能保持您的TestRail数据连接并感知上下文。
可用工具
TestRail MCP服务器提供以下工具:
| 类别 | 工具 |
|---|---|
| 项目 | getProjects, getProject |
| 套房 | getSuites, getSuite, addSuite, updateSuite |
| 病例 | getCase, getCases, addCase, updateCase, deleteCase, getCaseTypes, getCaseFields, copyToSection, moveToSection, getCaseHistory, updateCases |
| 章节 | getSection, getSections, addSection, moveSection, updateSection, deleteSection |
| 跑 | getRuns, getRun, addRun, updateRun |
| 测试 | getTests, getTest |
| 结果 | getResults, getResultsForCase, getResultsForRun, addResultForCase, addResultsForCases |
| 计划 | getPlans |
| 里程碑 | getMilestones |
| 共享步骤 | getSharedSteps |
用法
您可以通过以下设置连接此MCP服务器。此方法使用 npx 自动下载并运行最新版本的软件包,无需本地安装。
// Example configuration using npx
{
"mcpServers": {
"testrail": {
"command": "npx",
"args": ["@dineshselvaraj/mcp-testrail"],
"env": {
"TESTRAIL_URL": "https://your-instance.testrail.io", // Replace with your TestRail URL
"TESTRAIL_USERNAME": "your-email@example.com", // Replace with your TestRail username
"TESTRAIL_API_KEY": "YOUR_API_KEY" // Replace with your TestRail API key
}
}
}
}
故障排除
spawn node ENOENT错误:确保Node.js已正确安装并位于PATH中。- 连接问题:验证服务器是否正在运行,以及MCP客户端中的URL是否配置正确。
- 身份验证问题:在中检查您的TestRail API凭据
.env文件。 - SSE连接错误:如果你看到
SSE error: TypeError: fetch failed: connect ECONNREFUSED,请确保服务器正在指定端口上运行。 - 你的谈话太长了:请使用
limit和offset测试用例参数
贡献
欢迎投稿!请随时提交拉取请求。
