@msalaam/xray-qe-toolkit 1.4.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +157 -71
- package/bin/cli.js +38 -25
- package/commands/createExecution.js +1 -0
- package/commands/createPlan.js +23 -34
- package/commands/importResults.js +2 -0
- package/commands/init.js +2 -0
- package/commands/pushTests.js +65 -7
- package/lib/config.js +7 -0
- package/lib/jsonFile.js +12 -0
- package/lib/playwrightConverter.js +68 -45
- package/lib/testCaseBuilder.js +374 -90
- package/lib/xrayClient.js +168 -11
- package/package.json +2 -1
- package/schema/tests.schema.json +126 -7
- package/templates/README.template.md +80 -23
- package/templates/tests.json +5295 -47
- package/commands/genTests.js +0 -138
- package/templates/SPEC-DRIVEN-APPROACH.md +0 -372
package/README.md
CHANGED
|
@@ -55,17 +55,17 @@ openapi.yaml + business-rules.yaml
|
|
|
55
55
|
↓ (AI agent generates tests.json)
|
|
56
56
|
tests.json — structured test definitions
|
|
57
57
|
↓
|
|
58
|
-
xqt validate
|
|
58
|
+
xqt validate ← schema check
|
|
59
59
|
↓
|
|
60
|
-
xqt push
|
|
60
|
+
xqt push ← creates/updates Tests + Test Sets in Xray
|
|
61
61
|
↓
|
|
62
62
|
xray-mapping.json ← auto-populated with Jira issue keys
|
|
63
63
|
↓
|
|
64
64
|
Playwright API tests ← created by Copilot (reads tests.json + xray-mapping.json)
|
|
65
65
|
↓
|
|
66
|
-
Sprint starts
|
|
66
|
+
Sprint starts ← xqt plan → link Test Sets to Test Plan
|
|
67
67
|
↓
|
|
68
|
-
CI runs tests
|
|
68
|
+
CI runs tests ← xqt import → Test Execution in Xray
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
**Key design decisions:**
|
|
@@ -118,18 +118,18 @@ cp .env.example .env
|
|
|
118
118
|
|
|
119
119
|
# 5. Validate and push to Xray
|
|
120
120
|
npx xqt validate
|
|
121
|
-
npx xqt push
|
|
121
|
+
npx xqt push
|
|
122
122
|
# → Tests + Test Sets created in Jira
|
|
123
123
|
# → xray-mapping.json populated with issue keys
|
|
124
124
|
|
|
125
125
|
# 6. Create Playwright tests (done by Copilot skill — reads tests.json + xray-mapping.json)
|
|
126
126
|
|
|
127
127
|
# 7. When entering a sprint, create a Test Plan and link Test Sets
|
|
128
|
-
npx xqt
|
|
128
|
+
npx xqt plan --summary "Sprint 12 — My Service Regression"
|
|
129
129
|
|
|
130
130
|
# 8. Run tests and import results
|
|
131
131
|
npx playwright test
|
|
132
|
-
npx xqt import
|
|
132
|
+
npx xqt import --file test-results/results.json --env IOP-QA
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
---
|
|
@@ -167,13 +167,14 @@ npx xqt edit --port 3000
|
|
|
167
167
|
|
|
168
168
|
---
|
|
169
169
|
|
|
170
|
-
### `xqt
|
|
170
|
+
### `xqt plan`
|
|
171
171
|
|
|
172
172
|
Create a new Xray Test Plan in JIRA. Automatically saves the key to `.xrayrc` and `tests.json`.
|
|
173
|
+
`create-plan` is accepted as a legacy alias.
|
|
173
174
|
|
|
174
175
|
```bash
|
|
175
|
-
npx xqt
|
|
176
|
-
npx xqt
|
|
176
|
+
npx xqt plan --summary "My Service v2 Regression"
|
|
177
|
+
npx xqt plan --summary "Sprint 12 Smoke Tests" --version "2024.12"
|
|
177
178
|
```
|
|
178
179
|
|
|
179
180
|
| Flag | Description |
|
|
@@ -184,35 +185,43 @@ npx xqt create-plan --summary "Sprint 12 Smoke Tests" --version "2024.12"
|
|
|
184
185
|
|
|
185
186
|
---
|
|
186
187
|
|
|
187
|
-
### `xqt push
|
|
188
|
+
### `xqt push`
|
|
188
189
|
|
|
189
190
|
Create or update tests in Xray Cloud, then sync Test Plan membership and the Xray folder structure.
|
|
191
|
+
Optionally create a Test Execution linked to the plan in a single command.
|
|
192
|
+
`push-tests` is accepted as a legacy alias.
|
|
190
193
|
|
|
191
194
|
```bash
|
|
192
|
-
npx xqt push
|
|
193
|
-
npx xqt push
|
|
195
|
+
npx xqt push
|
|
196
|
+
npx xqt push --plan APIEE-1234
|
|
197
|
+
npx xqt push --plan APIEE-1234 --create-execution --execution-env IOP-QA
|
|
194
198
|
```
|
|
195
199
|
|
|
196
200
|
| Flag | Description |
|
|
197
201
|
|---|---|
|
|
198
202
|
| `--plan <key>` | Test Plan key (overrides `.xrayrc testPlanKey`) |
|
|
203
|
+
| `--create-execution` | Create a Test Execution linked to the Test Plan after pushing |
|
|
204
|
+
| `--execution-env <label>` | Environment label for the created execution (e.g. `IOP-QA`) |
|
|
205
|
+
| `--execution-summary <text>` | Custom summary for the created execution |
|
|
199
206
|
|
|
200
207
|
**Behaviour:**
|
|
201
208
|
- Tests in `xray-mapping.json` → **updated** in Xray
|
|
202
209
|
- Tests not in mapping → **created** in Xray, mapping entry added
|
|
203
210
|
- Tests with `"skip": true` → excluded entirely
|
|
204
|
-
-
|
|
211
|
+
- **Test Sets auto-created** from the `testSet` field and tests added to them (see below)
|
|
205
212
|
- Xray folder structure synced from `folder` fields
|
|
213
|
+
- With `--create-execution`, a new Test Execution is created and linked to the Test Plan
|
|
206
214
|
|
|
207
215
|
---
|
|
208
216
|
|
|
209
|
-
### `xqt pull
|
|
217
|
+
### `xqt pull`
|
|
210
218
|
|
|
211
219
|
Pull test definitions from Xray Cloud and merge them into `tests.json`. Useful for onboarding to an existing Xray project.
|
|
220
|
+
`pull-tests` is accepted as a legacy alias.
|
|
212
221
|
|
|
213
222
|
```bash
|
|
214
|
-
npx xqt pull
|
|
215
|
-
npx xqt pull
|
|
223
|
+
npx xqt pull --plan APIEE-1234
|
|
224
|
+
npx xqt pull --project APIEE --limit 200
|
|
216
225
|
```
|
|
217
226
|
|
|
218
227
|
| Flag | Description |
|
|
@@ -223,20 +232,21 @@ npx xqt pull-tests --project APIEE --limit 200
|
|
|
223
232
|
|
|
224
233
|
---
|
|
225
234
|
|
|
226
|
-
### `xqt
|
|
235
|
+
### `xqt exec`
|
|
227
236
|
|
|
228
237
|
Pre-create a Test Execution with a specific set of tests before running them.
|
|
229
|
-
Use `--quiet` to capture the key in CI for use with `import
|
|
238
|
+
Use `--quiet` to capture the key in CI for use with `import --exec`.
|
|
239
|
+
`create-execution` is accepted as a legacy alias.
|
|
230
240
|
|
|
231
241
|
```bash
|
|
232
242
|
# Standard output
|
|
233
|
-
npx xqt
|
|
243
|
+
npx xqt exec --env IOP-QA
|
|
234
244
|
|
|
235
245
|
# CI mode — prints ONLY the key
|
|
236
|
-
EXEC_KEY=$(npx xqt
|
|
246
|
+
EXEC_KEY=$(npx xqt exec --env IOP-QA --quiet)
|
|
237
247
|
|
|
238
248
|
# Specific test selection
|
|
239
|
-
npx xqt
|
|
249
|
+
npx xqt exec --env IOP-QA --plan APIEE-1234 --tests TC-001,TC-002
|
|
240
250
|
```
|
|
241
251
|
|
|
242
252
|
| Flag | Description |
|
|
@@ -245,15 +255,17 @@ npx xqt create-execution --env IOP-QA --plan APIEE-1234 --tests TC-001,TC-002
|
|
|
245
255
|
| `--plan <key>` | Test Plan to link to (overrides `.xrayrc`) |
|
|
246
256
|
| `--tests <ids>` | Comma-separated testIds or JIRA keys (default: all mapped) |
|
|
247
257
|
| `--summary <text>` | Custom execution title |
|
|
258
|
+
| `--fix-version <ver>` | JIRA Fix Version to stamp on the execution (e.g. `2.5.0`) |
|
|
248
259
|
| `--quiet` | Print only the execution key |
|
|
249
260
|
|
|
250
|
-
> `import
|
|
261
|
+
> `xqt import` creates an execution automatically — this command is only needed when pre-selecting a specific subset of tests.
|
|
251
262
|
|
|
252
263
|
---
|
|
253
264
|
|
|
254
|
-
### `xqt import
|
|
265
|
+
### `xqt import`
|
|
255
266
|
|
|
256
267
|
Import test execution results into Xray Cloud.
|
|
268
|
+
`import-results` is accepted as a legacy alias.
|
|
257
269
|
|
|
258
270
|
- **Without `--exec`** — creates a **new** Test Execution linked to the Test Plan
|
|
259
271
|
- **With `--exec`** — imports results INTO a pre-created execution
|
|
@@ -262,20 +274,20 @@ Supported: Playwright JSON (`.json`) and JUnit XML (`.xml`).
|
|
|
262
274
|
|
|
263
275
|
```bash
|
|
264
276
|
# Auto-create execution (standard CI)
|
|
265
|
-
npx xqt import
|
|
277
|
+
npx xqt import --file test-results/results.json --env IOP-QA
|
|
266
278
|
|
|
267
279
|
# Import into a pre-created execution
|
|
268
|
-
npx xqt import
|
|
280
|
+
npx xqt import --file test-results/results.json --exec APIEE-9876
|
|
269
281
|
|
|
270
282
|
# JUnit XML
|
|
271
|
-
npx xqt import
|
|
283
|
+
npx xqt import --file test-results/results.xml --env IOP-PROD
|
|
272
284
|
|
|
273
|
-
# Full options
|
|
274
|
-
npx xqt import
|
|
285
|
+
# Full options — with Fix Version and git SHA
|
|
286
|
+
npx xqt import \
|
|
275
287
|
--file test-results/results.json \
|
|
276
288
|
--env IOP-QA \
|
|
277
289
|
--plan APIEE-1234 \
|
|
278
|
-
--version "
|
|
290
|
+
--fix-version "2.5.0" \
|
|
279
291
|
--revision "a1b2c3d4"
|
|
280
292
|
```
|
|
281
293
|
|
|
@@ -284,19 +296,21 @@ npx xqt import-results \
|
|
|
284
296
|
| `--file <path>` | Path to results file **(required)** |
|
|
285
297
|
| `--env <label>` | Environment label (default: `defaultEnvironment` from `.xrayrc`) |
|
|
286
298
|
| `--plan <key>` | Test Plan key (overrides `.xrayrc`; used when no `--exec`) |
|
|
287
|
-
| `--exec <key>` | Import INTO an existing execution (from `
|
|
288
|
-
| `--version <ver>` | Fix
|
|
299
|
+
| `--exec <key>` | Import INTO an existing execution (from `xqt exec`) |
|
|
300
|
+
| `--fix-version <ver>` | JIRA Fix Version name to stamp on the execution (e.g. `2.5.0`) |
|
|
301
|
+
| `--version <ver>` | Xray version label (free-form, separate from Fix Version) |
|
|
289
302
|
| `--revision <rev>` | Build number or git SHA |
|
|
290
303
|
| `--summary <text>` | Custom execution summary |
|
|
291
304
|
|
|
292
305
|
---
|
|
293
306
|
|
|
294
|
-
### `xqt sync
|
|
307
|
+
### `xqt sync`
|
|
295
308
|
|
|
296
309
|
Sync the Xray Test Repository folder structure from `folder` fields in `tests.json` without touching test content.
|
|
310
|
+
`sync-folders` is accepted as a legacy alias.
|
|
297
311
|
|
|
298
312
|
```bash
|
|
299
|
-
npx xqt sync
|
|
313
|
+
npx xqt sync
|
|
300
314
|
```
|
|
301
315
|
|
|
302
316
|
---
|
|
@@ -327,13 +341,14 @@ npx xqt validate --file path/to/tests.json
|
|
|
327
341
|
|
|
328
342
|
---
|
|
329
343
|
|
|
330
|
-
### `xqt
|
|
344
|
+
### `xqt pipeline`
|
|
331
345
|
|
|
332
346
|
Generate an Azure Pipelines YAML template for the current project.
|
|
347
|
+
`gen-pipeline` is accepted as a legacy alias.
|
|
333
348
|
|
|
334
349
|
```bash
|
|
335
|
-
npx xqt
|
|
336
|
-
npx xqt
|
|
350
|
+
npx xqt pipeline
|
|
351
|
+
npx xqt pipeline --output .azure/ci.yml
|
|
337
352
|
```
|
|
338
353
|
|
|
339
354
|
---
|
|
@@ -381,23 +396,53 @@ JIRA_EMAIL=your.email@company.com
|
|
|
381
396
|
|
|
382
397
|
```json
|
|
383
398
|
{
|
|
384
|
-
"testsPath":
|
|
385
|
-
"mappingPath":
|
|
386
|
-
"testPlanKey":
|
|
387
|
-
"defaultEnvironment":
|
|
388
|
-
"environments":
|
|
389
|
-
"folderRoot":
|
|
390
|
-
"xrayRegion":
|
|
399
|
+
"testsPath": "tests.json",
|
|
400
|
+
"mappingPath": "xray-mapping.json",
|
|
401
|
+
"testPlanKey": "APIEE-1234",
|
|
402
|
+
"defaultEnvironment": "IOP-DEV",
|
|
403
|
+
"environments": ["IOP-DEV", "IOP-QA", "IOP-PROD"],
|
|
404
|
+
"folderRoot": "/MyService",
|
|
405
|
+
"xrayRegion": "us",
|
|
406
|
+
"bulkImportThreshold": 50,
|
|
407
|
+
"statusMapping": {
|
|
408
|
+
"interrupted": "ABORTED",
|
|
409
|
+
"skipped": "TODO"
|
|
410
|
+
}
|
|
391
411
|
}
|
|
392
412
|
```
|
|
393
413
|
|
|
394
414
|
| Field | Description |
|
|
395
415
|
|---|---|
|
|
396
|
-
| `testPlanKey` | Default Test Plan key for push
|
|
416
|
+
| `testPlanKey` | Default Test Plan key for `push` and `import` |
|
|
397
417
|
| `defaultEnvironment` | Fallback environment when `--env` is not provided |
|
|
398
418
|
| `environments` | Allowed environment labels |
|
|
399
419
|
| `folderRoot` | Base folder path in Xray Test Repository |
|
|
400
|
-
| `xrayRegion` | `us` (default) or `
|
|
420
|
+
| `xrayRegion` | `us` (default), `eu`, or `au` |
|
|
421
|
+
| `bulkImportThreshold` | Min new-test count to use the Xray bulk REST API (default: `50`) — faster for large suites |
|
|
422
|
+
| `statusMapping` | Override default Playwright → Xray status mapping (see below) |
|
|
423
|
+
|
|
424
|
+
#### Playwright status mapping
|
|
425
|
+
|
|
426
|
+
By default the converter maps:
|
|
427
|
+
|
|
428
|
+
| Playwright status | Xray status |
|
|
429
|
+
|---|---|
|
|
430
|
+
| `passed` | `PASSED` |
|
|
431
|
+
| `failed` | `FAILED` |
|
|
432
|
+
| `timedOut` | `FAILED` |
|
|
433
|
+
| `interrupted` | `ABORTED` |
|
|
434
|
+
| `skipped` | `TODO` |
|
|
435
|
+
|
|
436
|
+
Override any value in `.xrayrc`:
|
|
437
|
+
|
|
438
|
+
```json
|
|
439
|
+
{
|
|
440
|
+
"statusMapping": {
|
|
441
|
+
"skipped": "TODO",
|
|
442
|
+
"interrupted": "FAILED"
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
```
|
|
401
446
|
|
|
402
447
|
---
|
|
403
448
|
|
|
@@ -419,6 +464,7 @@ JIRA_EMAIL=your.email@company.com
|
|
|
419
464
|
"tags": ["smoke", "regression"],
|
|
420
465
|
"folder": "/MyService/HealthCheck/Validation",
|
|
421
466
|
"testSet": "Health Check",
|
|
467
|
+
"preconditions": ["APIEE-50"],
|
|
422
468
|
"requirementKeys": [],
|
|
423
469
|
"xray": {
|
|
424
470
|
"summary": "Service returns 200 OK when healthy",
|
|
@@ -440,9 +486,10 @@ JIRA_EMAIL=your.email@company.com
|
|
|
440
486
|
| `test_id` | string | Yes | Stable local ID — maps to the Xray key in `xray-mapping.json` |
|
|
441
487
|
| `type` | string | — | `api` / `ui` / `e2e` (informational) |
|
|
442
488
|
| `skip` | boolean | — | `true` to exclude from `push-tests` |
|
|
443
|
-
| `tags` | string[] | — | QE tags for categorisation and filtering |
|
|
489
|
+
| `tags` | string[] | — | QE tags for categorisation and filtering. Allowed: `regression`, `smoke`, `edge`, `critical`, `integration`, `e2e`, `security`, `performance`, `contract`, `functional`, `negative`, `positive`, `boundary`, `acceptance`, `sanity`, `data-driven`, `exploratory`, `accessibility` |
|
|
444
490
|
| `folder` | string | — | Xray repository folder path — must start with `/` |
|
|
445
|
-
| `testSet` | string | — | Test Set name in Jira —
|
|
491
|
+
| `testSet` | string **or** string[] | — | Test Set name(s) in Jira — a single string or an array to assign the test to multiple Test Sets |
|
|
492
|
+
| `preconditions` | string[] | — | JIRA keys of Xray Precondition issues to link to this test (e.g. `["APIEE-50"]`) |
|
|
446
493
|
| `requirementKeys` | string[] | — | JIRA keys this test covers (creates traceability links) |
|
|
447
494
|
| `xray.summary` | string | Yes | Test case title (JIRA issue summary) |
|
|
448
495
|
| `xray.description` | string | — | Detailed description |
|
|
@@ -457,27 +504,53 @@ JIRA_EMAIL=your.email@company.com
|
|
|
457
504
|
|
|
458
505
|
### Test Sets (persistent groupings)
|
|
459
506
|
|
|
460
|
-
Tests live in **Test Sets** in Jira. Each Test Set groups related tests
|
|
507
|
+
Tests live in **Test Sets** in Jira. Each Test Set groups related tests by feature or area — they persist across every sprint.
|
|
461
508
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
509
|
+
Set the `testSet` field on each test in `tests.json` — use a string or an array of strings to assign the test to multiple sets:
|
|
510
|
+
|
|
511
|
+
```json
|
|
512
|
+
{ "test_id": "TC-001", "testSet": "Client Lookup", ... }
|
|
513
|
+
{ "test_id": "TC-002", "testSet": "Client Lookup", ... }
|
|
514
|
+
{ "test_id": "TC-003", "testSet": ["Health Check", "Smoke"], ... }
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
When you run `xqt push`:
|
|
518
|
+
1. Tests are created/updated in Xray
|
|
519
|
+
2. For each unique `testSet` value, the Test Set JIRA issue is **created automatically** if it doesn't exist yet (safe to run on a fresh clone — existing sets are found by name, not duplicated)
|
|
520
|
+
3. Tests are added to their Test Set (idempotent — Xray ignores tests already in the set)
|
|
521
|
+
4. Test Set → JIRA key mappings (e.g. `"Client Lookup" → APIEE-99`) are stored in `xray-mapping.json` under `_testSets`
|
|
522
|
+
|
|
523
|
+
```json
|
|
524
|
+
// xray-mapping.json (auto-managed)
|
|
525
|
+
{
|
|
526
|
+
"_testSets": {
|
|
527
|
+
"Client Lookup": { "key": "APIEE-99", "id": "123456" },
|
|
528
|
+
"Health Check": { "key": "APIEE-100", "id": "123457" }
|
|
529
|
+
},
|
|
530
|
+
"TC-001": { "key": "APIEE-200", "id": "234001" },
|
|
531
|
+
...
|
|
532
|
+
}
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
Test Sets are **not deleted** when tests are removed from `tests.json`. They persist in Jira as a record of all tests that have ever existed for that feature.
|
|
465
536
|
|
|
466
537
|
### Test Plans (per-sprint)
|
|
467
538
|
|
|
468
539
|
A Test Plan scopes testing work for a specific sprint or release.
|
|
469
540
|
|
|
470
|
-
- Create with `xqt
|
|
471
|
-
- Link relevant Test Sets to the Test Plan in Jira
|
|
541
|
+
- Create with `xqt plan --summary "Sprint 12 — My Service"`
|
|
542
|
+
- Link relevant Test Sets to the Test Plan in Jira (manual step in Jira UI)
|
|
472
543
|
- Key stored in `.xrayrc` (`testPlanKey`)
|
|
473
|
-
- `import
|
|
544
|
+
- `xqt import` links executions to the active plan
|
|
545
|
+
|
|
546
|
+
`xqt push` performs a **bi-directional sync** with the Test Plan: new tests are added **and** tests removed from `tests.json` are removed from the plan. Use `--plan <key>` to override the key.
|
|
474
547
|
|
|
475
548
|
### Test Executions (ephemeral per run)
|
|
476
549
|
|
|
477
550
|
A Test Execution represents a single CI run.
|
|
478
551
|
|
|
479
|
-
- **Auto-created** by `xqt import
|
|
480
|
-
- **Pre-created** by `xqt
|
|
552
|
+
- **Auto-created** by `xqt import` — one new execution per run
|
|
553
|
+
- **Pre-created** by `xqt exec` for controlled test selection
|
|
481
554
|
- Tagged with environment labels (`IOP-DEV`, `IOP-QA`, `IOP-PROD`)
|
|
482
555
|
- Linked to the Test Plan automatically
|
|
483
556
|
|
|
@@ -489,18 +562,25 @@ A Test Execution represents a single CI run.
|
|
|
489
562
|
| **Test Plan** | Per-sprint | Scopes testing for a sprint — links Test Sets |
|
|
490
563
|
| **Test Execution** | Per-CI-run | Records pass/fail for one run |
|
|
491
564
|
|
|
492
|
-
###
|
|
565
|
+
### Three execution modes
|
|
493
566
|
|
|
494
567
|
**Mode A — Auto (standard CI):**
|
|
495
568
|
```bash
|
|
496
|
-
npx xqt import
|
|
569
|
+
npx xqt import --file results.json --env IOP-QA
|
|
497
570
|
```
|
|
498
571
|
|
|
499
572
|
**Mode B — Pre-create (controlled test selection):**
|
|
500
573
|
```bash
|
|
501
|
-
EXEC_KEY=$(npx xqt
|
|
574
|
+
EXEC_KEY=$(npx xqt exec --env IOP-QA --plan APIEE-1234 --quiet)
|
|
502
575
|
npx playwright test
|
|
503
|
-
npx xqt import
|
|
576
|
+
npx xqt import --file results.json --exec $EXEC_KEY
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
**Mode C — Push & execute (single command):**
|
|
580
|
+
```bash
|
|
581
|
+
npx xqt push --plan APIEE-1234 --create-execution --execution-env IOP-QA
|
|
582
|
+
npx playwright test
|
|
583
|
+
npx xqt import --file results.json --env IOP-QA
|
|
504
584
|
```
|
|
505
585
|
|
|
506
586
|
---
|
|
@@ -538,7 +618,7 @@ reporter: [
|
|
|
538
618
|
|
|
539
619
|
### Test steps → Xray step results
|
|
540
620
|
|
|
541
|
-
Steps created with `test.step()` are mapped to Xray step results automatically
|
|
621
|
+
Steps created with `test.step()` are mapped to Xray step results automatically. Screenshots captured on a **failing step** are attached directly to that step's evidence in Xray — giving per-step failure screenshots in the Xray UI. Traces and other attachments are attached at the test level.
|
|
542
622
|
|
|
543
623
|
```typescript
|
|
544
624
|
test('Create and retrieve user', async ({ request }) => {
|
|
@@ -571,7 +651,7 @@ Tests are organised in the Xray Test Repository using the `folder` field in `tes
|
|
|
571
651
|
|
|
572
652
|
- Paths must start with `/`
|
|
573
653
|
- `folderRoot` in `.xrayrc` sets the base path
|
|
574
|
-
- Folders are created automatically by `push
|
|
654
|
+
- Folders are created automatically by `xqt push` and `xqt sync`
|
|
575
655
|
|
|
576
656
|
---
|
|
577
657
|
|
|
@@ -579,7 +659,7 @@ Tests are organised in the Xray Test Repository using the `folder` field in `tes
|
|
|
579
659
|
|
|
580
660
|
### Azure DevOps pipeline
|
|
581
661
|
|
|
582
|
-
Generate a template: `npx xqt
|
|
662
|
+
Generate a template: `npx xqt pipeline`
|
|
583
663
|
|
|
584
664
|
```yaml
|
|
585
665
|
- script: npx xqt validate
|
|
@@ -590,9 +670,11 @@ Generate a template: `npx xqt gen-pipeline`
|
|
|
590
670
|
continueOnError: true
|
|
591
671
|
|
|
592
672
|
- script: |
|
|
593
|
-
npx xqt import
|
|
673
|
+
npx xqt import \
|
|
594
674
|
--file test-results/results.json \
|
|
595
|
-
--env $(XQT_ENV)
|
|
675
|
+
--env $(XQT_ENV) \
|
|
676
|
+
--fix-version $(BUILD_BUILDNUMBER) \
|
|
677
|
+
--revision $(Build.SourceVersion)
|
|
596
678
|
displayName: Import results to Xray
|
|
597
679
|
env:
|
|
598
680
|
XRAY_ID: $(XRAY_ID)
|
|
@@ -614,12 +696,13 @@ Generate a template: `npx xqt gen-pipeline`
|
|
|
614
696
|
| `JIRA_API_TOKEN` | JIRA API token |
|
|
615
697
|
| `JIRA_EMAIL` | JIRA user email |
|
|
616
698
|
| `XQT_ENV` | Environment label (`IOP-DEV` / `IOP-QA` / `IOP-PROD`) |
|
|
699
|
+
| `XQT_BULK_THRESHOLD` | Override bulk-import threshold (default: `50`) |
|
|
617
700
|
|
|
618
701
|
### Pre-create execution in pipeline (Mode B)
|
|
619
702
|
|
|
620
703
|
```yaml
|
|
621
704
|
- script: |
|
|
622
|
-
EXEC_KEY=$(npx xqt
|
|
705
|
+
EXEC_KEY=$(npx xqt exec --env $(XQT_ENV) --quiet)
|
|
623
706
|
echo "##vso[task.setvariable variable=EXEC_KEY]$EXEC_KEY"
|
|
624
707
|
displayName: Pre-create Test Execution
|
|
625
708
|
|
|
@@ -627,7 +710,7 @@ Generate a template: `npx xqt gen-pipeline`
|
|
|
627
710
|
continueOnError: true
|
|
628
711
|
|
|
629
712
|
- script: |
|
|
630
|
-
npx xqt import
|
|
713
|
+
npx xqt import --file test-results/results.json --exec $(EXEC_KEY)
|
|
631
714
|
displayName: Import results into pre-created execution
|
|
632
715
|
```
|
|
633
716
|
|
|
@@ -657,13 +740,13 @@ const { key } = await createTestExecution(cfg, token, {
|
|
|
657
740
|
});
|
|
658
741
|
```
|
|
659
742
|
|
|
660
|
-
Key exports: `authenticate`, `createIssue`, `updateIssue`, `getIssue`, `getTest`, `getTests`, `getTestPlan`, `createTestPlan`, `addTestsToTestPlan`, `addTestsToTestExecution`, `createTestExecution`, `importResultsMultipart`, `importTestsBulk`, `syncTestPlan`, `syncFolders`, `buildAndPush`, `loadMapping`, `saveMapping`, `loadConfig`, `validateConfig`.
|
|
743
|
+
Key exports: `authenticate`, `createIssue`, `updateIssue`, `getIssue`, `getTest`, `getTests`, `getTestPlan`, `createTestPlan`, `addTestsToTestPlan`, `removeTestsFromTestPlan`, `addTestsToTestExecution`, `createTestExecution`, `importResultsMultipart`, `importTestsBulk`, `waitForImportJob`, `searchIssues`, `getTestSets`, `addPreconditionsToTest`, `syncTestPlan`, `syncFolders`, `buildAndPush`, `loadMapping`, `saveMapping`, `loadConfig`, `validateConfig`.
|
|
661
744
|
|
|
662
745
|
---
|
|
663
746
|
|
|
664
747
|
## xray-mapping.json
|
|
665
748
|
|
|
666
|
-
Auto-managed by `push
|
|
749
|
+
Auto-managed by `xqt push`. Maps local `test_id` → JIRA issue key and numeric Xray ID.
|
|
667
750
|
|
|
668
751
|
```json
|
|
669
752
|
{
|
|
@@ -696,7 +779,7 @@ Ensure `.env` exists and is populated.
|
|
|
696
779
|
**Test not found in mapping after push**
|
|
697
780
|
```bash
|
|
698
781
|
npx xqt status
|
|
699
|
-
npx xqt push
|
|
782
|
+
npx xqt push --verbose
|
|
700
783
|
```
|
|
701
784
|
|
|
702
785
|
**Import results — 0 tests matched**
|
|
@@ -708,6 +791,9 @@ test.info().annotations.push({ type: 'xray', description: 'APIEE-1234' });
|
|
|
708
791
|
**Validate fails in CI**
|
|
709
792
|
Fix schema errors before pushing. Common causes: missing `testId`, invalid `priority`, malformed `folder` path (must start with `/`).
|
|
710
793
|
|
|
794
|
+
**Old command names still work**
|
|
795
|
+
All previous multi-word commands (`push-tests`, `pull-tests`, `create-plan`, `create-execution`, `import-results`, `sync-folders`, `gen-pipeline`, `mcp-server`) remain valid as aliases.
|
|
796
|
+
|
|
711
797
|
**EU region**
|
|
712
798
|
Set `XRAY_REGION=eu` in `.env` or `"xrayRegion": "eu"` in `.xrayrc`.
|
|
713
799
|
|
package/bin/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @msalaam/xray-qe-toolkit — CLI Entry Point
|
|
@@ -7,18 +7,18 @@
|
|
|
7
7
|
* npx xqt <command> [options]
|
|
8
8
|
*
|
|
9
9
|
* Commands:
|
|
10
|
-
* init
|
|
11
|
-
* edit
|
|
12
|
-
* push
|
|
13
|
-
* pull
|
|
14
|
-
*
|
|
15
|
-
* import
|
|
16
|
-
*
|
|
17
|
-
* sync
|
|
18
|
-
* status
|
|
19
|
-
* validate
|
|
20
|
-
*
|
|
21
|
-
* mcp
|
|
10
|
+
* init Scaffold project structure (tests/, playwright.config.ts, tests.json, .xrayrc)
|
|
11
|
+
* edit Launch browser-based editor for tests.json
|
|
12
|
+
* push Push/update tests in Xray Cloud + sync Test Plan + sync folders
|
|
13
|
+
* pull Pull test definitions from Xray Cloud into tests.json
|
|
14
|
+
* exec Create a new Test Execution with a specific set of tests
|
|
15
|
+
* import Import test results (JUnit XML or Playwright JSON) — new execution per run
|
|
16
|
+
* plan Create a new Xray Test Plan in JIRA
|
|
17
|
+
* sync Sync Xray repository folder structure from tests.json folder fields
|
|
18
|
+
* status Show local + remote project status summary
|
|
19
|
+
* validate Validate tests.json against its schema
|
|
20
|
+
* pipeline Generate Azure Pipelines YAML
|
|
21
|
+
* mcp Start the MCP server for GitHub Copilot agent-mode integration
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { Command } from "commander";
|
|
@@ -61,18 +61,23 @@ program
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
program
|
|
64
|
-
.command("push
|
|
64
|
+
.command("push")
|
|
65
|
+
.alias("push-tests")
|
|
65
66
|
.description(
|
|
66
67
|
"Create/update tests in Xray Cloud, sync to Test Plan, sync folder structure"
|
|
67
68
|
)
|
|
68
69
|
.option("--plan <key>", "Test Plan key (overrides .xrayrc testPlanKey)")
|
|
70
|
+
.option("--create-execution", "Create a Test Execution linked to the Test Plan after pushing")
|
|
71
|
+
.option("--execution-env <label>", "Environment label for created execution (e.g. IOP-QA)")
|
|
72
|
+
.option("--execution-summary <text>", "Custom summary for created execution")
|
|
69
73
|
.action(async (opts, cmd) => {
|
|
70
74
|
const mod = await import("../commands/pushTests.js");
|
|
71
75
|
await mod.default({ ...opts, ...cmd.optsWithGlobals() });
|
|
72
76
|
});
|
|
73
77
|
|
|
74
78
|
program
|
|
75
|
-
.command("pull
|
|
79
|
+
.command("pull")
|
|
80
|
+
.alias("pull-tests")
|
|
76
81
|
.description("Pull test definitions from Xray Cloud into tests.json")
|
|
77
82
|
.option("--plan <key>", "Fetch tests from a specific Test Plan")
|
|
78
83
|
.option("--project <key>", "Fetch all tests in a JIRA project")
|
|
@@ -83,17 +88,19 @@ program
|
|
|
83
88
|
});
|
|
84
89
|
|
|
85
90
|
program
|
|
86
|
-
.command("
|
|
91
|
+
.command("exec")
|
|
92
|
+
.alias("create-execution")
|
|
87
93
|
.description(
|
|
88
94
|
"Create a new Test Execution with a specific set of tests. " +
|
|
89
95
|
"Use --quiet to print only the execution key for CI variable capture: " +
|
|
90
|
-
"EXEC_KEY=$(xqt
|
|
96
|
+
"EXEC_KEY=$(xqt exec --env IOP-QA --quiet)"
|
|
91
97
|
)
|
|
92
98
|
.option("--env <environment>", "Environment label (e.g. IOP-QA, IOP-PROD)")
|
|
93
99
|
.option("--plan <key>", "Test Plan key to link the execution to (overrides .xrayrc)")
|
|
94
100
|
.option("--tests <ids>", "Comma-separated testIds or JIRA keys to include (default: all mapped tests)")
|
|
95
101
|
.option("--summary <text>", "Custom Test Execution summary")
|
|
96
102
|
.option("--description <text>", "Custom description")
|
|
103
|
+
.option("--fix-version <version>", "JIRA Fix Version to stamp on the execution (e.g. '2.5.0')")
|
|
97
104
|
.option("--quiet", "Print ONLY the execution key (for CI variable capture)")
|
|
98
105
|
.action(async (opts, cmd) => {
|
|
99
106
|
const mod = await import("../commands/createExecution.js");
|
|
@@ -101,16 +108,18 @@ program
|
|
|
101
108
|
});
|
|
102
109
|
|
|
103
110
|
program
|
|
104
|
-
.command("import
|
|
111
|
+
.command("import")
|
|
112
|
+
.alias("import-results")
|
|
105
113
|
.description(
|
|
106
114
|
"Import test results into Xray Cloud — creates a NEW Test Execution per run (JUnit XML or Playwright JSON)"
|
|
107
115
|
)
|
|
108
116
|
.requiredOption("--file <path>", "Path to results file (.json for Playwright, .xml for JUnit)")
|
|
109
117
|
.option("--env <environment>", "Test environment label (e.g. IOP-DEV, IOP-QA, IOP-PROD)")
|
|
110
118
|
.option("--plan <key>", "Test Plan key to associate execution with (overrides .xrayrc)")
|
|
111
|
-
.option("--exec <key>", "Import INTO an existing Test Execution key (from
|
|
119
|
+
.option("--exec <key>", "Import INTO an existing Test Execution key (from xqt exec)")
|
|
112
120
|
.option("--version <version>", "Fix version / release version")
|
|
113
|
-
.option("--revision <revision>", "Revision / build number")
|
|
121
|
+
.option("--revision <revision>", "Revision / build number (e.g. git SHA)")
|
|
122
|
+
.option("--fix-version <version>", "JIRA Fix Version name to stamp on the Test Execution (e.g. '2.5.0')")
|
|
114
123
|
.option("--summary <text>", "Custom Test Execution summary")
|
|
115
124
|
.option("--description <text>", "Custom Test Execution description")
|
|
116
125
|
.action(async (opts, cmd) => {
|
|
@@ -119,7 +128,8 @@ program
|
|
|
119
128
|
});
|
|
120
129
|
|
|
121
130
|
program
|
|
122
|
-
.command("
|
|
131
|
+
.command("plan")
|
|
132
|
+
.alias("create-plan")
|
|
123
133
|
.description("Create a new Test Plan in JIRA and save its key to .xrayrc and tests.json")
|
|
124
134
|
.requiredOption("--summary <text>", "Test Plan summary / title")
|
|
125
135
|
.option("--version <version>", "Fix version to associate with the plan")
|
|
@@ -130,7 +140,8 @@ program
|
|
|
130
140
|
});
|
|
131
141
|
|
|
132
142
|
program
|
|
133
|
-
.command("sync
|
|
143
|
+
.command("sync")
|
|
144
|
+
.alias("sync-folders")
|
|
134
145
|
.description("Sync Xray repository folder structure from the folder field in tests.json")
|
|
135
146
|
.action(async (opts, cmd) => {
|
|
136
147
|
const mod = await import("../commands/syncFolders.js");
|
|
@@ -157,7 +168,8 @@ program
|
|
|
157
168
|
});
|
|
158
169
|
|
|
159
170
|
program
|
|
160
|
-
.command("
|
|
171
|
+
.command("pipeline")
|
|
172
|
+
.alias("gen-pipeline")
|
|
161
173
|
.description("Generate an Azure Pipelines YAML template")
|
|
162
174
|
.option("--output <path>", "Output file path", "azure-pipelines.yml")
|
|
163
175
|
.action(async (opts, cmd) => {
|
|
@@ -166,7 +178,8 @@ program
|
|
|
166
178
|
});
|
|
167
179
|
|
|
168
180
|
program
|
|
169
|
-
.command("mcp
|
|
181
|
+
.command("mcp")
|
|
182
|
+
.alias("mcp-server")
|
|
170
183
|
.description(
|
|
171
184
|
"Start the MCP server for GitHub Copilot agent-mode integration. " +
|
|
172
185
|
"Runs in stdio mode by default (for VS Code), or HTTP mode with --port."
|
|
@@ -182,4 +195,4 @@ program
|
|
|
182
195
|
program.parseAsync(process.argv).catch((err) => {
|
|
183
196
|
console.error(`\n${err.message}\n`);
|
|
184
197
|
process.exit(1);
|
|
185
|
-
});
|
|
198
|
+
});
|