|
| 1 | +--- |
| 2 | +name: zephyr |
| 3 | +description: Zephyr Scale CLI - manage test resources, run test cycles interactively, and automate test operations |
| 4 | +targets: ["claudecode"] |
| 5 | +claudecode: |
| 6 | + allowed-tools: |
| 7 | + - "Bash" |
| 8 | + - "Read" |
| 9 | + - "Write" |
| 10 | +--- |
| 11 | + |
| 12 | +# Zephyr Scale CLI Operations |
| 13 | + |
| 14 | +The `zephyr` CLI wraps the entire Zephyr Scale REST API. Both users and AI agents can perform the same operations. |
| 15 | + |
| 16 | +## Global Options |
| 17 | + |
| 18 | +Every command accepts: |
| 19 | + |
| 20 | +``` |
| 21 | +-p, --profile <name> Profile name (default: "default") |
| 22 | +-c, --config <path> Custom config file path |
| 23 | +--text Human-readable text output (default: JSON) |
| 24 | +--verbose Detailed logging |
| 25 | +``` |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +## 1. Snapshot Workflow (Recommended for Test Execution) |
| 30 | + |
| 31 | +The snapshot workflow is the primary way to manage test execution. It syncs a test cycle into a local JSON file, which can be sorted, edited, and played back interactively. |
| 32 | + |
| 33 | +### play init - Interactive Setup |
| 34 | + |
| 35 | +Select a test cycle interactively and create a snapshot: |
| 36 | + |
| 37 | +```bash |
| 38 | +zephyr play init |
| 39 | +# 1) PRJ-R1: Sprint 1 Regression |
| 40 | +# 2) PRJ-R2: Sprint 2 Smoke Test |
| 41 | +# Select cycle number: 1 |
| 42 | +# => Snapshot saved to PRJ-R1.json (42 test cases) |
| 43 | +# => Run: zephyr play PRJ-R1.json |
| 44 | +``` |
| 45 | + |
| 46 | +### snapshot sync - Sync from Zephyr |
| 47 | + |
| 48 | +**Initial sync** (test cycle key to new file): |
| 49 | +```bash |
| 50 | +zephyr snapshot sync PRJ-R1 -o PRJ-R1.json |
| 51 | +``` |
| 52 | + |
| 53 | +**Re-sync** (update existing file from Zephyr): |
| 54 | +```bash |
| 55 | +zephyr snapshot sync PRJ-R1.json |
| 56 | +``` |
| 57 | + |
| 58 | +**Reload a single test case** (partial update): |
| 59 | +```bash |
| 60 | +zephyr snapshot sync PRJ-R1.json -t PRJ-T123 |
| 61 | +``` |
| 62 | + |
| 63 | +### snapshot sort - Sort Test Cases |
| 64 | + |
| 65 | +```bash |
| 66 | +zephyr snapshot sort PRJ-R1.json --by folder # by folder path |
| 67 | +zephyr snapshot sort PRJ-R1.json --by key # by test case key |
| 68 | +zephyr snapshot sort PRJ-R1.json --by name # by test case name |
| 69 | +zephyr snapshot sort PRJ-R1.json --by status # by execution status |
| 70 | +zephyr snapshot sort PRJ-R1.json --by created # by creation date |
| 71 | +zephyr snapshot sort PRJ-R1.json --by original # by Zephyr execution order |
| 72 | +``` |
| 73 | + |
| 74 | +### play - Interactive TUI |
| 75 | + |
| 76 | +Launch the interactive test execution interface: |
| 77 | + |
| 78 | +```bash |
| 79 | +zephyr play PRJ-R1.json |
| 80 | +zephyr play PRJ-R1.json --filter unexecuted |
| 81 | +zephyr play PRJ-R1.json --filter "folder=/Authentication" |
| 82 | +zephyr play PRJ-R1.json --filter "status=Fail" |
| 83 | +``` |
| 84 | + |
| 85 | +The TUI allows step-by-step test execution with keyboard navigation. Both human users and AI agents can drive test cycles through this workflow. |
| 86 | + |
| 87 | +### snapshot record - Record Results (CLI) |
| 88 | + |
| 89 | +Record test results without the TUI: |
| 90 | + |
| 91 | +```bash |
| 92 | +# Set overall execution status |
| 93 | +zephyr snapshot record PRJ-R1.json PRJ-T123 --status Pass |
| 94 | + |
| 95 | +# Set status with comment |
| 96 | +zephyr snapshot record PRJ-R1.json PRJ-T123 --status Fail --comment "Button not visible" |
| 97 | + |
| 98 | +# Update a specific step result |
| 99 | +zephyr snapshot record PRJ-R1.json PRJ-T123 --step 0 --status Pass --actual-result "Page loaded" |
| 100 | +``` |
| 101 | + |
| 102 | +--- |
| 103 | + |
| 104 | +## 2. Test Case Management |
| 105 | + |
| 106 | +### Create |
| 107 | + |
| 108 | +```bash |
| 109 | +zephyr testcase create \ |
| 110 | + --name "Login succeeds with valid credentials" \ |
| 111 | + --objective "Verify login flow" \ |
| 112 | + --precondition "Login page is displayed" \ |
| 113 | + --folder-id 123456 \ |
| 114 | + --step "Enter username|Username is entered" \ |
| 115 | + --step "Enter password|Password is entered" \ |
| 116 | + --step "Click login|Dashboard is displayed" |
| 117 | +``` |
| 118 | + |
| 119 | +`--step` format: `"description|expected result"` or `"description|test data|expected result"` |
| 120 | + |
| 121 | +### Get / List |
| 122 | + |
| 123 | +```bash |
| 124 | +zephyr testcase get PRJ-T123 |
| 125 | +zephyr testcase list --folder-id 123456 |
| 126 | +``` |
| 127 | + |
| 128 | +### Update (metadata only, does NOT update steps) |
| 129 | + |
| 130 | +```bash |
| 131 | +zephyr testcase update PRJ-T123 \ |
| 132 | + --name "Updated title" \ |
| 133 | + --objective "Updated objective" \ |
| 134 | + --folder-id 654321 |
| 135 | +``` |
| 136 | + |
| 137 | +--- |
| 138 | + |
| 139 | +## 3. Test Step Management |
| 140 | + |
| 141 | +Use when you need to modify steps after test case creation. |
| 142 | + |
| 143 | +### Create / Replace Steps |
| 144 | + |
| 145 | +```bash |
| 146 | +# Overwrite all steps |
| 147 | +zephyr teststep create PRJ-T123 \ |
| 148 | + --mode OVERWRITE \ |
| 149 | + --inline "Step description" \ |
| 150 | + --expected-result "Expected result" \ |
| 151 | + --test-data "Test data" |
| 152 | + |
| 153 | +# Append new steps |
| 154 | +zephyr teststep create PRJ-T123 \ |
| 155 | + --mode APPEND \ |
| 156 | + --inline "New step" \ |
| 157 | + --expected-result "Expected result" |
| 158 | +``` |
| 159 | + |
| 160 | +### List Steps |
| 161 | + |
| 162 | +```bash |
| 163 | +zephyr teststep list PRJ-T123 |
| 164 | +``` |
| 165 | + |
| 166 | +--- |
| 167 | + |
| 168 | +## 4. Test Cycle Management |
| 169 | + |
| 170 | +### Create / Get / List / Update |
| 171 | + |
| 172 | +```bash |
| 173 | +zephyr testcycle create --name "Sprint 1 Regression" --description "Full regression" |
| 174 | +zephyr testcycle get PRJ-R1 |
| 175 | +zephyr testcycle list |
| 176 | +zephyr testcycle update PRJ-R1 --name "Updated name" |
| 177 | +``` |
| 178 | + |
| 179 | +### Folder Tree (shows test cases grouped by folder) |
| 180 | + |
| 181 | +```bash |
| 182 | +zephyr testcycle tree PRJ-R1 |
| 183 | +``` |
| 184 | + |
| 185 | +--- |
| 186 | + |
| 187 | +## 5. Test Execution Management |
| 188 | + |
| 189 | +### Create (add a test case to a cycle) |
| 190 | + |
| 191 | +```bash |
| 192 | +zephyr testexecution create \ |
| 193 | + --test-case-key PRJ-T123 \ |
| 194 | + --test-cycle-key PRJ-R1 \ |
| 195 | + --status-name "Not Executed" |
| 196 | +``` |
| 197 | + |
| 198 | +### Update |
| 199 | + |
| 200 | +```bash |
| 201 | +# Update single execution |
| 202 | +zephyr testexecution update PRJ-E1 --status-name "Pass" |
| 203 | + |
| 204 | +# Bulk update: all executions in a cycle |
| 205 | +zephyr testexecution update --test-cycle PRJ-R1 --status-name "Pass" |
| 206 | +``` |
| 207 | + |
| 208 | +### Get / List |
| 209 | + |
| 210 | +```bash |
| 211 | +zephyr testexecution get PRJ-E1 |
| 212 | +zephyr testexecution list --test-cycle PRJ-R1 |
| 213 | +``` |
| 214 | + |
| 215 | +--- |
| 216 | + |
| 217 | +## 6. Test Plan Management |
| 218 | + |
| 219 | +```bash |
| 220 | +zephyr testplan create --name "Release v2.0" --objective "Full coverage" |
| 221 | +zephyr testplan get PRJ-P1 |
| 222 | +zephyr testplan list |
| 223 | +``` |
| 224 | + |
| 225 | +--- |
| 226 | + |
| 227 | +## 7. Folder Management |
| 228 | + |
| 229 | +### Create |
| 230 | + |
| 231 | +```bash |
| 232 | +zephyr folder create \ |
| 233 | + --name "Authentication" \ |
| 234 | + --folder-type TEST_CASE \ |
| 235 | + --parent-id 12345 # omit for root folder |
| 236 | +``` |
| 237 | + |
| 238 | +### Get / List / Tree |
| 239 | + |
| 240 | +```bash |
| 241 | +zephyr folder get 12345 |
| 242 | +zephyr folder list --folder-type TEST_CASE |
| 243 | +zephyr folder tree |
| 244 | +``` |
| 245 | + |
| 246 | +--- |
| 247 | + |
| 248 | +## 8. Other Resources |
| 249 | + |
| 250 | +### Environments |
| 251 | + |
| 252 | +```bash |
| 253 | +zephyr environment list |
| 254 | +zephyr environment get 1 |
| 255 | +zephyr environment create --name "Production" |
| 256 | +zephyr environment update 1 --name "Staging" |
| 257 | +``` |
| 258 | + |
| 259 | +### Statuses |
| 260 | + |
| 261 | +```bash |
| 262 | +zephyr status list |
| 263 | +zephyr status list --status-type TEST_EXECUTION |
| 264 | +zephyr status get 1 |
| 265 | +zephyr status create --name "In Review" --type TEST_CASE |
| 266 | +``` |
| 267 | + |
| 268 | +### Priorities |
| 269 | + |
| 270 | +```bash |
| 271 | +zephyr priority list |
| 272 | +zephyr priority get 1 |
| 273 | +zephyr priority create --name "Critical" |
| 274 | +``` |
| 275 | + |
| 276 | +### Projects |
| 277 | + |
| 278 | +```bash |
| 279 | +zephyr project list |
| 280 | +zephyr project get PRJ |
| 281 | +``` |
| 282 | + |
| 283 | +### Issue Links (Jira integration) |
| 284 | + |
| 285 | +```bash |
| 286 | +zephyr issuelink testcases JIRA-123 |
| 287 | +zephyr issuelink testcycles JIRA-123 |
| 288 | +zephyr issuelink testplans JIRA-123 |
| 289 | +zephyr issuelink executions JIRA-123 |
| 290 | +``` |
| 291 | + |
| 292 | +### Open in Browser |
| 293 | + |
| 294 | +```bash |
| 295 | +zephyr open PRJ-T123 # test case |
| 296 | +zephyr open PRJ-R1 # test cycle |
| 297 | +zephyr open PRJ-P1 # test plan |
| 298 | +``` |
| 299 | + |
| 300 | +--- |
| 301 | + |
| 302 | +## Typical AI Agent Workflow |
| 303 | + |
| 304 | +1. **Setup**: `zephyr play init` or `zephyr snapshot sync PRJ-R1 -o PRJ-R1.json` |
| 305 | +2. **Sort**: `zephyr snapshot sort PRJ-R1.json --by folder` |
| 306 | +3. **Review**: Read `PRJ-R1.json` to understand test cases and steps |
| 307 | +4. **Execute**: `zephyr snapshot record PRJ-R1.json PRJ-T123 --status Pass` |
| 308 | +5. **Re-sync**: `zephyr snapshot sync PRJ-R1.json` to pull latest from Zephyr |
| 309 | + |
| 310 | +## Notes |
| 311 | + |
| 312 | +- All commands output JSON by default. Add `--text` for human-readable output. |
| 313 | +- Use `jq` for filtering: `zephyr testcase list | jq '.[].key'` |
| 314 | +- Project key is read from the profile config; no need to pass `--project-key` for most commands. |
| 315 | +- The snapshot JSON file is the source of truth during a test execution session. Always re-sync before starting. |
0 commit comments