TestRail Integration
Sync tests with TestRail.
How to use it
Claude Code
- Run the line below. It pulls the whole folder into
~/.claude/skills/testrail, including the files SKILL.md points to. - Describe your job in plain words. Claude Code follows the skill from there.
npx degit alirezarezvani/claude-skills/engineering-team/playwright-pro/skills/testrail#main ~/.claude/skills/testrailFor one project only, change the path to .claude/skills/testrail. This skill also uses test-results.json — copying SKILL.md alone won't be enough. See the folder on GitHub.
Claude (web or desktop app)
- On this page open ⋯ → Download .md.
- Save it as SKILL.md in a folder, zip the folder, then Customize → Skills → + → Create skill → Upload a skill.
- Pick the file and Save. Claude shows the name and description and runs a security scan.
- Check the skill is switched on.
- Start a new chat and describe your job in plain words. The AI follows the skill from there.
ChatGPT or another app
- ChatGPT: make a Project and paste it into Instructions.
- Neither? Paste it at the top of a new chat — it works for that chat.
Not working?
- Check which app you pasted it into — the steps above name the right one.
- Some skills need the paid tier of Claude or ChatGPT.
Paste into Claude, ChatGPT or Cursor.
Source of TestRail Integration
Show the full text138 lines
| name | description |
|---|---|
| testrail | >- Sync tests with TestRail. Use when user mentions "testrail", "test management", test cases", "test run", "sync test cases", "push results to testrail", or "import from testrail". |
TestRail Integration
Bidirectional sync between Playwright tests and TestRail test management.
Prerequisites
Environment variables must be set:
TESTRAIL_URL— e.g.,https://your-instance.testrail.ioTESTRAIL_USER— your emailTESTRAIL_API_KEY— API key from TestRail
If not set, inform the user how to configure them and stop.
The TestRail MCP server is not auto-registered (issue #978).
pw-testrailwas removed from the plugin's.mcp.jsonbecause it failed to connect for every user (the plugin ships nonode_modules). Thetestrail_*MCP tools used below, and the/pw:testrailcommand, will fail with "tool not found" until it is enabled manually — see the Integrations section of the plugin'sCLAUDE.md(cd integrations/testrail-mcp && npm install, then register the server in your own user/project MCP config). Setting the env vars alone is not sufficient.
Capabilities
1. Import Test Cases → Generate Playwright Tests
/pw:testrail import --project <id> --suite <id>
Steps:
- Call
testrail_get_casesMCP tool to fetch test cases - For each test case:
- Read title, preconditions, steps, expected results
- Map to a Playwright test using appropriate template
- Include TestRail case ID as test annotation:
test.info().annotations.push({ type: 'testrail', description: 'C12345' })
- Generate test files grouped by section
- Report: X cases imported, Y tests generated
2. Push Test Results → TestRail
/pw:testrail push --run <id>
Steps:
- Run Playwright tests with JSON reporter:
npx playwright test --reporter=json > test-results.json - Parse results: map each test to its TestRail case ID (from annotations)
- Call
testrail_add_resultMCP tool for each test:- Pass → status_id: 1
- Fail → status_id: 5, include error message
- Skip → status_id: 2
- Report: X results pushed, Y passed, Z failed
3. Create Test Run
/pw:testrail run --project <id> --name "Sprint 42 Regression"
Steps:
- Call
testrail_add_runMCP tool - Include all test case IDs found in Playwright test annotations
- Return run ID for result pushing
4. Sync Status
/pw:testrail status --project <id>
Steps:
- Fetch test cases from TestRail
- Scan local Playwright tests for TestRail annotations
- Report coverage:
TestRail cases: 150 Playwright tests with TestRail IDs: 120 Unlinked TestRail cases: 30 Playwright tests without TestRail IDs: 15
5. Update Test Cases in TestRail
/pw:testrail update --case <id>
Steps:
- Read the Playwright test for this case ID
- Extract steps and expected results from test code
- Call
testrail_update_caseMCP tool to update steps
MCP Tools Used
| Tool | When |
|---|---|
testrail_get_projects |
List available projects |
testrail_get_suites |
List suites in project |
testrail_get_cases |
Read test cases |
testrail_add_case |
Create new test case |
testrail_update_case |
Update existing case |
testrail_add_run |
Create test run |
testrail_add_result |
Push individual result |
testrail_get_results |
Read historical results |
Test Annotation Format
All Playwright tests linked to TestRail include:
test('should login successfully', async ({ page }) => {
test.info().annotations.push({
type: 'testrail',
description: 'C12345',
});
// ... test code
});
This annotation is the bridge between Playwright and TestRail.
Output
- Operation summary with counts
- Any errors or unmatched cases
- Link to TestRail run/results
| 1 | |
| 2 | name "testrail" |
| 3 | description >- |
| 4 | Sync tests with TestRail. Use when user mentions "testrail", "test management", |
| 5 | "test cases", "test run", "sync test cases", "push results to testrail", |
| 6 | or "import from testrail". |
| 7 | |
| 8 | |
| 9 | # TestRail Integration |
| 10 | |
| 11 | Bidirectional sync between Playwright tests and TestRail test management. |
| 12 | |
| 13 | ## Prerequisites |
| 14 | |
| 15 | Environment variables must be set: |
| 16 | `TESTRAIL_URL` — e.g., `https://your-instance.testrail.io` |
| 17 | `TESTRAIL_USER` — your email |
| 18 | `TESTRAIL_API_KEY` — API key from TestRail |
| 19 | |
| 20 | If not set, inform the user how to configure them and stop. |
| 21 | |
| 22 | > **The TestRail MCP server is not auto-registered (issue #978).** `pw-testrail` |
| 23 | > was removed from the plugin's `.mcp.json` because it failed to connect for every |
| 24 | > user (the plugin ships no `node_modules`). The `testrail_*` MCP tools used below, |
| 25 | > and the `/pw:testrail` command, will fail with "tool not found" until it is |
| 26 | > enabled manually — see the **Integrations** section of the plugin's `CLAUDE.md` |
| 27 | > (`cd integrations/testrail-mcp && npm install`, then register the server in your |
| 28 | > own user/project MCP config). Setting the env vars alone is not sufficient. |
| 29 | |
| 30 | ## Capabilities |
| 31 | |
| 32 | ### 1. Import Test Cases → Generate Playwright Tests |
| 33 | |
| 34 | |
| 35 | /pw:testrail import --project <id> --suite <id> |
| 36 | |
| 37 | |
| 38 | Steps: |
| 39 | Call `testrail_get_cases` MCP tool to fetch test cases |
| 40 | For each test case: |
| 41 | Read title, preconditions, steps, expected results |
| 42 | Map to a Playwright test using appropriate template |
| 43 | Include TestRail case ID as test annotation: `test.info().annotations.push({ type: 'testrail', description: 'C12345' })` |
| 44 | Generate test files grouped by section |
| 45 | Report: X cases imported, Y tests generated |
| 46 | |
| 47 | ### 2. Push Test Results → TestRail |
| 48 | |
| 49 | |
| 50 | /pw:testrail push --run <id> |
| 51 | |
| 52 | |
| 53 | Steps: |
| 54 | Run Playwright tests with JSON reporter: |
| 55 | |
| 56 | npx playwright test --reporter=json > test-results.json |
| 57 | |
| 58 | Parse results: map each test to its TestRail case ID (from annotations) |
| 59 | Call `testrail_add_result` MCP tool for each test: |
| 60 | Pass → status_id: 1 |
| 61 | Fail → status_id: 5, include error message |
| 62 | Skip → status_id: 2 |
| 63 | Report: X results pushed, Y passed, Z failed |
| 64 | |
| 65 | ### 3. Create Test Run |
| 66 | |
| 67 | |
| 68 | /pw:testrail run --project <id> --name "Sprint 42 Regression" |
| 69 | |
| 70 | |
| 71 | Steps: |
| 72 | Call `testrail_add_run` MCP tool |
| 73 | Include all test case IDs found in Playwright test annotations |
| 74 | Return run ID for result pushing |
| 75 | |
| 76 | ### 4. Sync Status |
| 77 | |
| 78 | |
| 79 | /pw:testrail status --project <id> |
| 80 | |
| 81 | |
| 82 | Steps: |
| 83 | Fetch test cases from TestRail |
| 84 | Scan local Playwright tests for TestRail annotations |
| 85 | Report coverage: |
| 86 | |
| 87 | TestRail cases: 150 |
| 88 | Playwright tests with TestRail IDs: 120 |
| 89 | Unlinked TestRail cases: 30 |
| 90 | Playwright tests without TestRail IDs: 15 |
| 91 | |
| 92 | |
| 93 | ### 5. Update Test Cases in TestRail |
| 94 | |
| 95 | |
| 96 | /pw:testrail update --case <id> |
| 97 | |
| 98 | |
| 99 | Steps: |
| 100 | Read the Playwright test for this case ID |
| 101 | Extract steps and expected results from test code |
| 102 | Call `testrail_update_case` MCP tool to update steps |
| 103 | |
| 104 | ## MCP Tools Used |
| 105 | |
| 106 | | Tool | When | |
| 107 | |---|---| |
| 108 | | `testrail_get_projects` | List available projects | |
| 109 | | `testrail_get_suites` | List suites in project | |
| 110 | | `testrail_get_cases` | Read test cases | |
| 111 | | `testrail_add_case` | Create new test case | |
| 112 | | `testrail_update_case` | Update existing case | |
| 113 | | `testrail_add_run` | Create test run | |
| 114 | | `testrail_add_result` | Push individual result | |
| 115 | | `testrail_get_results` | Read historical results | |
| 116 | |
| 117 | ## Test Annotation Format |
| 118 | |
| 119 | All Playwright tests linked to TestRail include: |
| 120 | |
| 121 | |
| 122 | test('should login successfully', async ({ page }) => { |
| 123 | test.info().annotations.push({ |
| 124 | type: 'testrail', |
| 125 | description: 'C12345', |
| 126 | }); |
| 127 | // ... test code |
| 128 | }); |
| 129 | |
| 130 | |
| 131 | This annotation is the bridge between Playwright and TestRail. |
| 132 | |
| 133 | ## Output |
| 134 | |
| 135 | Operation summary with counts |
| 136 | Any errors or unmatched cases |
| 137 | Link to TestRail run/results |
| 138 |
Discussion
Browse more free Claude skills.