Testrail
Interact with the TestRail Test Management API. Use when fetching test plans, test runs, test cases, submitting test results, or attaching screenshots and logs to test evidence. Supports the full execution lifecycle from locating tests to recording step-by-step outcomes.From its SKILL.md
npx -y skills add nmoinvaz/speedy-gonzales --skill testrailAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
9.0 KB, ~2.3k tokens by cl100k_base, as published. Nobody here has run it
TestRail Test Management
Authentication
Env vars (required by all scripts):
TESTRAIL_URL=https://[account].testrail.io
[email protected]
TESTRAIL_PASSWORD=<api_key>
Credentials stored in 1Password: "TestRail" in SSN - QA vault.
Install: pip3 install testrail-api
Object Hierarchy
Project (e.g. Solsta = ID 2)
└── Suite (test case library)
└── Section (folder within a suite)
└── Case (reusable test case template with steps)
└── Milestone (release/sprint marker)
└── Plan (groups multiple runs together)
└── Entry (one per suite in the plan)
└── Run (test execution instance)
└── Test (live instance of a Case — auto-created)
└── Result (outcome you submit)
└── Attachment (screenshot, log)
Key relationships:
- A Case becomes a Test when included in a Run
- You submit Results to a Test (multiple results = history)
- Runs inside a Plan are in
entries[].runs[]— NOT returned byget_runs - Attachments are uploaded separately after submitting a result
Status IDs: 1=Passed, 2=Blocked, 3=Untested, 4=Retest, 5=Failed
Scripts
All scripts in skills/testrail/scripts/. Run with python3 skills/testrail/scripts/<script>.py.
Browsing & Discovery
| Script | Purpose | Key Flags |
|---|---|---|
get_projects.py | List all projects | --names-only, --active-only |
get_suites.py | List suites in a project | --project-id, --names-only |
get_sections.py | List sections/folders | --project-id, --suite-id, --tree |
get_cases.py | List test cases | --project-id, --section-id, --with-steps, --limit |
get_milestones.py | List milestones | --project-id, --id, --active-only |
get_plan.py | Find plans by name/ID or list all | --id, --project-id, --name, --list, --active-only |
get_runs.py | Get runs inside a plan | --plan-id, --names-only |
get_tests.py | Get test instances in a run | --run-id, --status, --names-only |
get_steps.py | Get steps for a case or test | --case-id, --test-id, --json |
Submitting Results
| Script | Purpose | Key Flags |
|---|---|---|
add_result.py | Submit a result with optional step outcomes | --run-id, --case-id, --status, --comment, --elapsed, --step-results-file |
add_attachment.py | Attach a file to a result or run | --result-id, --run-id, --file |
submit_test.py | Submit result with step outcomes | --run-id, --case-id, --status, --comment, --elapsed, --step-results-file |
All scripts support --json for raw JSON output. Run any script with --help for full options.
Common Workflows
Find and explore a test plan
# List plans for Solsta
python3 skills/testrail/scripts/get_plan.py --project-id 2 --list --active-only
# Get full plan detail (entries + runs)
python3 skills/testrail/scripts/get_plan.py --id 15
# List runs in the plan
python3 skills/testrail/scripts/get_runs.py --plan-id 15 --names-only
# List tests in a run
python3 skills/testrail/scripts/get_tests.py --run-id 201 --names-only
Execute a test case
# 1. Get the steps
python3 skills/testrail/scripts/get_steps.py --case-id 39
# 2. Execute steps (manual or automation)
# 3. Attach screenshots to the run as you go
python3 skills/testrail/scripts/add_attachment.py --run-id 201 --file /tmp/step1.png
# → attachment_id=55 (use this in step results JSON)
# 4. Submit result with inline screenshot refs in step actuals
python3 skills/testrail/scripts/submit_test.py \
--run-id 201 --case-id 39 --status passed \
--comment "All steps verified" --elapsed "2m 15s" \
--step-results-file /tmp/step_results.json
Submit with per-step inline screenshots (preferred)
Screenshots render inline in TestRail's step results view. This requires a 3-step process because attachment IDs are only known after upload.
⚠️ CRITICAL: HTML Formatting Rules for Step Results
TestRail step results (custom_step_results) require specific HTML formatting to render properly:
- Wrap text in
<p>tags — This triggersmarkdown_editor_id: 1which enables HTML rendering. Without<p>tags, all HTML is escaped and shows as raw text. - Use
<blockquote>for expected results — Renders with a colored left border, visually distinct. - Use
<img>tags for inline images — Place after the<p>block:<img src="index.php?/attachments/get/<id>" /> - Do NOT use markdown —
syntax does NOT render in step results. - All three fields support HTML —
content,expected, andactualall render HTML when<p>tags are present.
Step results JSON format
[
{
"content": "<p>Navigate to login page</p>",
"expected": "<blockquote>Login page loads with username and password fields</blockquote>",
"actual": "<p>Page loaded correctly. Username and password fields visible.</p><img src=\"index.php?/attachments/get/55\" />",
"status_id": 1
},
{
"content": "<p>Click Submit</p>",
"expected": "<blockquote>Dialog appears confirming login</blockquote>",
"actual": "<p>Nothing happened. No dialog appeared.</p><img src=\"index.php?/attachments/get/56\" />",
"status_id": 5
}
]
Field breakdown:
content→ Shown under Step heading. Wrap in<p>tags.expected→ Shown under Expected Result heading. Wrap in<blockquote>for visual distinction.actual→ Shown under Actual Result heading. Wrap observation in<p>, append<img>for screenshot.status_id→ 1=Passed, 5=Failed, 2=Blocked, 4=Retest.
Inline screenshots workflow (single result, no duplicates)
# During testing: attach each screenshot to the RUN as you capture it
python3 skills/testrail/scripts/add_attachment.py --run-id 16 --file screenshots/step1.png
# → attachment_id=55
python3 skills/testrail/scripts/add_attachment.py --run-id 16 --file screenshots/step2.png
# → attachment_id=56
# After testing: submit result with HTML img refs baked into step actuals
# In your step results JSON, use <img> tags (NOT markdown):
# "actual": "<p>Step passed.</p><img src=\"index.php?/attachments/get/55\" />"
python3 skills/testrail/scripts/submit_test.py \
--run-id 16 --case-id 78 --status passed \
--comment "All steps verified" --elapsed "4m 00s" \
--step-results-file /tmp/steps_with_images.json
# → One result, inline screenshots, no duplicates
Key insight: Attaching to the run (--run-id) doesn't require a result ID,
so you get attachment IDs first, bake them into the step results, and submit once.
This avoids the duplicate result problem caused by TestRail having no "update result" API.
Browse the test case library
# Section tree
python3 skills/testrail/scripts/get_sections.py --project-id 2 --tree
# Cases in a section
python3 skills/testrail/scripts/get_cases.py --project-id 2 --section-id 31 --with-steps
# All cases (careful — could be large)
python3 skills/testrail/scripts/get_cases.py --project-id 2 --names-only
Gotchas
- Runs in plans are hidden.
get_runs(standalone) won't return them. Useget_plan→entries[].runs[]or theget_runs.py --plan-idscript. - No "start test" API. Just fetch steps, execute, then submit a result. Use
status_id: 4(Retest) as an "in progress" marker if needed. - Attachments are separate. Submit result first, get
result_id, then attach files. Or usesubmit_test.pywhich does both. - Step results field name is
custom_step_results(notstep_results). - Single-suite projects (like Solsta) don't need
--suite-idfor most queries. - No "update result" API. You can only add new results, never modify existing ones. To avoid duplicates when adding inline screenshots, attach to the run first (
add_attachment.py --run-id), then bake the attachment IDs into step results before submitting. - Inline image syntax: Use
<img src="index.php?/attachments/get/<attachment_id>" />— NOT markdown. The attachment must exist on the same run/test. Attachment IDs are global within a project. - HTML rendering requires
<p>tags. If you submit step results without<p>tags wrapping the text, TestRail escapes all HTML (shows raw<img>as text). Always wrap text content in<p>tags to triggermarkdown_editor_id: 1. - Use
<blockquote>for expected results. Renders with a colored left border for visual distinction from the actual result.
What ships with it: 12 files
28.7 KB alongside SKILL.md, 12 of them executable
scripts/
- add_attachment.pyruns2.3 KB
- add_result.pyruns3.4 KB
- get_cases.pyruns3.1 KB
- get_milestones.pyruns2.4 KB
- get_plan.pyruns3.2 KB
- get_projects.pyruns1.4 KB
- get_runs.pyruns1.9 KB
- get_sections.pyruns2.0 KB
- get_steps.pyruns2.7 KB
- get_suites.pyruns1.2 KB
- get_tests.pyruns1.8 KB
- submit_test.pyruns3.2 KB
Gives 0 of the 12 instructions most test skills give in ~2.3k tokens
Counted across 1,201 of the 2,096 authors here whose files we hold, read 2026-09-06
- Write a failing test before writing codein 43 of 1201, across 36 files
- Run the full test suitein 36 of 1201, across 35 files
- Test only one variable per experimentin 34 of 1201, across 17 files
- Read product marketing context before asking questionsin 34 of 1201, across 14 files
- Mock external dependenciesin 34 of 1201, across 30 files
- Define primary, secondary, and guardrail metricsin 33 of 1201, across 16 files
- Pre-determine sample size before startingin 31 of 1201, across 14 files
- Test behavior rather than implementationin 31 of 1201, across 29 files
- Formulate a hypothesis before designing a testin 30 of 1201, across 13 files
- Document every test hypothesis, variant, and resultin 29 of 1201, across 11 files
- Use descriptive test function namesin 25 of 1201, across 21 files
- Commit to the methodology without stopping earlyin 24 of 1201, across 8 files
Said here and by no other author read
- Set TESTRAIL_URL, TESTRAIL_EMAIL, and TESTRAIL_PASSWORD environment variables
- Use python3 to run scripts in the skills/testrail/scripts directory
- Use --help flag to view full script options
- Wrap step result text in <p> tags for HTML rendering
- Use <blockquote> tags for expected results
- Use <img src="index.php?/attachments/get/<id>" /> for inline images
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.