@msalaam/xray-qe-toolkit 1.4.0 → 1.4.1

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.
@@ -1,169 +1,570 @@
1
- # XQT-GUIDE — Xray QE Toolkit
2
-
3
- > Quality Engineering workflow automation for Xray Cloud integration
4
- >
5
- > This file was created by `npx xqt init`. It is intentionally named `XQT-GUIDE.md`
6
- > so it never overwrites your project's own `README.md`.
7
-
8
- ## Quick Start
9
-
10
- ### 1. Configure Credentials
11
-
12
- ```bash
13
- # Copy the template and fill in your credentials
14
- cp .env.example .env
15
- ```
16
-
17
- Edit `.env` with your Xray Cloud and JIRA credentials:
18
-
19
- ```env
20
- XRAY_ID=your_xray_client_id
21
- XRAY_SECRET=your_xray_client_secret
22
- JIRA_PROJECT_KEY=YOUR_PROJECT
23
- JIRA_URL=https://your-domain.atlassian.net
24
- JIRA_API_TOKEN=your_jira_api_token
25
- JIRA_EMAIL=your.email@company.com
26
- ```
27
-
28
- **Important:** Both Xray and JIRA credentials must belong to the same user.
29
-
30
- ### 2. Add Your Documentation
31
-
32
- Populate the `knowledge/` folder with your API specs and requirements:
33
-
34
- ```
35
- knowledge/
36
- ├── api-specs/ ← OpenAPI/Swagger specs (.yaml, .json)
37
- ├── requirements/ Business requirements (.md, .pdf, .docx)
38
- └── tickets/ JIRA exports, Confluence pages
39
- ```
40
-
41
- See [knowledge/README.md](knowledge/README.md) for details.
42
-
43
- ### 3. Create Test Cases
44
-
45
- **Option A: Manual (No AI required)**
46
- ```bash
47
- # Open the visual editor
48
- npx xqt edit-json
49
- ```
50
-
51
- **Option B: AI-Assisted (Requires setup)**
52
- ```bash
53
- # Generate from knowledge sources
54
- npx xqt gen-tests --ai
55
-
56
- # Then review in the editor
57
- npx xqt edit-json
58
- ```
59
-
60
- ### 4. Push to Xray Cloud
61
-
62
- ```bash
63
- npx xqt push-tests
64
- ```
65
-
66
- ### 5. Set Up CI Pipeline
67
-
68
- ```bash
69
- # Generate Azure Pipelines template
70
- npx xqt gen-pipeline
71
- ```
72
-
73
- ## Available Commands
74
-
75
- | Command | Description |
76
- |---------|-------------|
77
- | `npx xqt init` | Scaffold new project (already done) |
78
- | `npx xqt gen-tests` | Generate test cases from knowledge/ |
79
- | `npx xqt edit-json` | Review/edit tests in browser |
80
- | `npx xqt push-tests` | Push tests to Xray Cloud |
81
- | `npx xqt gen-pipeline` | Generate CI pipeline template |
82
- | `npx xqt create-execution` | Create Test Execution issue |
83
- | `npx xqt import-results` | Import Playwright JSON results (CI) |
84
- | `npx xqt compare-openapi` | Diff live spec vs QA snapshot — fails on breaking changes |
85
- | `npx xqt update-snapshot` | Promote current spec as new QA baseline (manual only) |
86
-
87
- Run any command with `--help` for details:
88
- ```bash
89
- npx xqt gen-tests --help
90
- ```
91
-
92
- ## Workflow
93
-
94
- ```
95
- 1. Add docs to knowledge/
96
- 2. Generate tests (AI or manual)
97
- 3. Review in edit-json
98
- 4. Push to Xray
99
- 5. Generate CI pipeline: npx xqt gen-pipeline
100
- 6. Run Playwright tests in CI
101
- 7. Import results: npx xqt import-results --file playwright-results.json
102
-
103
- Contract Enforcement (from your test repo pipeline):
104
- 8. Checkout API repo in pipeline
105
- 9. npx xqt compare-openapi --current api-repo/openapi.yaml --snapshot openapi.snapshot.yaml
106
- Fail pipeline on breaking changes
107
-
108
- When a contract change is approved:
109
- 10. npx xqt update-snapshot --current api-repo/openapi.yaml --snapshot openapi.snapshot.yaml
110
- → Commit updated snapshot + raise PR to establish new baseline
111
- ```
112
-
113
- ## Files
114
-
115
- | File | Purpose |
116
- |------|---------|
117
- | `tests.json` | Test definitions (source of truth) |
118
- | `xray-mapping.json` | Maps test IDs to JIRA keys |
119
- | `playwright-results.json` | Playwright JSON report (CI output) |
120
- | `.env` | Credentials (DO NOT COMMIT) |
121
- | `.xrayrc` | Project config |
122
- | `knowledge/` | API specs and requirements |
123
-
124
- ## Multi-Company Test Format
125
-
126
- If you work across multiple companies or business units, keep a consistent naming pattern:
127
-
128
- - `test_id`: `COMPANY-AREA-FLOW-###` (e.g., `ACME-BILLING-PAYMENTS-001`)
129
- - `xray.summary`: prefix with `[COMPANY]` for easy filtering
130
- - `xray.labels`: add `company:<slug>`, `system:<slug>`, `team:<slug>`
131
- - `testExecution.summary`: include company + release/sprint
132
-
133
- For multiple companies, keep separate configs and files (recommended), or swap `.env` and `.xrayrc` before running.
134
-
135
- ## Jira/Xray Board Alignment
136
-
137
- 1. Create a JIRA project per company/team and enable Xray.
138
- 2. Ensure issue types include **Test** and **Test Execution**.
139
- 3. Add fields to screens: Summary, Description, Priority, Labels, Test Steps.
140
- 4. Grant API user permissions to create/edit Test and Test Execution issues.
141
- 5. Create a board with a filter for your project and those issue types.
142
- 6. Use components/labels that match your naming conventions.
143
-
144
- ## Tags
145
-
146
- Use tags in `edit-json` to organize test suites:
147
-
148
- - `regression` — Full regression pack
149
- - `smoke` — Critical path tests only
150
- - `critical` — Business-critical flows
151
- - `edge` — Edge cases and error handling
152
- - `integration` — Multi-system tests
153
-
154
- ## Need Help?
155
-
156
- ```bash
157
- # Show all commands
158
- npx xqt --help
159
-
160
- # Show command-specific help
161
- npx xqt push-tests --help
162
-
163
- # Enable debug output
164
- npx xqt push-tests --verbose
165
- ```
166
-
167
- ## Package Documentation
168
-
169
- Full documentation: https://www.npmjs.com/package/@msalaam/xray-qe-toolkit
1
+ # XQT-GUIDE — Xray QE Toolkit Reference
2
+
3
+ > **@msalaam/xray-qe-toolkit** — Quality Engineering workflow automation for Xray Cloud.
4
+ >
5
+ > This file was created by `npx xqt init`. It is intentionally saved as `XQT-GUIDE.md`
6
+ > so it never replaces your project's own `README.md`.
7
+
8
+ ---
9
+
10
+ ## Table of Contents
11
+
12
+ 1. [Architecture Overview](#1-architecture-overview)
13
+ 2. [Setup & Credentials](#2-setup--credentials)
14
+ 3. [Project Structure](#3-project-structure)
15
+ 4. [tests.json Reference](#4-testsjson-reference)
16
+ 5. [Command Reference](#5-command-reference)
17
+ 6. [Test Plans & Executions](#6-test-plans--executions)
18
+ 7. [Playwright Integration](#7-playwright-integration)
19
+ 8. [Folder Structure in Xray](#8-folder-structure-in-xray)
20
+ 9. [Business Rules](#9-business-rules)
21
+ 10. [CI/CD Integration](#10-cicd-integration)
22
+ 11. [xray-mapping.json](#11-xray-mappingjson)
23
+ 12. [Configuration (.xrayrc)](#12-configuration-xrayrc)
24
+
25
+ > **This file covers the xqt toolkit commands and Xray configuration.**
26
+ > For the full QE process — spec-driven workflow, greenfield/brownfield steps, AI agent
27
+ > integration, and architecture patterns — see **[SPEC-DRIVEN-APPROACH.md](SPEC-DRIVEN-APPROACH.md)**.
28
+
29
+ ---
30
+
31
+ ## 1. Architecture Overview
32
+
33
+ ```
34
+ tests.json ← Source of truth for test case definitions
35
+ xray-mapping.json ← Maps local test_id → JIRA/Xray issue key + numeric ID
36
+ resources/ ← OpenAPI spec + business rules (inputs for tests.json generation)
37
+ tests/ Playwright spec files + helpers
38
+ SPEC-DRIVEN-APPROACH.mdFull QE process and workflow
39
+ ```
40
+
41
+ **End-to-end flow:**
42
+
43
+ ```
44
+ openapi.yaml + business-rules.yaml
45
+ (AI agent generates tests.json)
46
+ xqt validate → xqt push-tests (creates Tests + Test Sets in Xray)
47
+
48
+ xray-mapping.json populated with Jira issue keys
49
+
50
+ Copilot creates Playwright tests (reads tests.json + xray-mapping.json)
51
+
52
+ Sprint starts → xqt create-plan → link Test Sets
53
+
54
+ CI: playwright test → xqt import-results → Test Execution in Xray
55
+ ```
56
+
57
+ **Key design decisions:**
58
+ - **Test Sets are persistent** — tests live in Test Sets grouped by feature
59
+ - **Test Plans are per-sprint** — create one per sprint, link relevant Test Sets
60
+ - **Test Executions are ephemeral** — every CI run creates a fresh execution
61
+ - **Environments are labels** — `IOP-DEV`, `IOP-QA`, `IOP-PROD` tag each execution
62
+ - **tests.json is the source of truth** — never edit test metadata directly in JIRA
63
+ - **Playwright tests come after push** — created only once xray-mapping.json has real Jira keys
64
+
65
+ ---
66
+
67
+ ## 2. Setup & Credentials
68
+
69
+ ### Install
70
+
71
+ ```bash
72
+ npm install --save-dev @msalaam/xray-qe-toolkit
73
+ # or globally
74
+ npm install -g @msalaam/xray-qe-toolkit
75
+ ```
76
+
77
+ ### Initialize a new project
78
+
79
+ ```bash
80
+ npx xqt init
81
+ ```
82
+
83
+ ### Configure `.env`
84
+
85
+ ```bash
86
+ cp .env.example .env
87
+ ```
88
+
89
+ ```env
90
+ # ── Xray Cloud ─────────────────────────────────────────────────
91
+ XRAY_ID=your_xray_cloud_client_id
92
+ XRAY_SECRET=your_xray_cloud_client_secret
93
+
94
+ # ── JIRA ───────────────────────────────────────────────────────
95
+ JIRA_PROJECT_KEY=APIEE
96
+ JIRA_URL=https://your-org.atlassian.net
97
+ JIRA_API_TOKEN=your_jira_api_token
98
+ JIRA_EMAIL=your.email@company.com
99
+ ```
100
+
101
+ > **Important:** The JIRA credentials must belong to a user with permission to
102
+ > create and edit Xray tests in the target project.
103
+
104
+ ### Get Xray API credentials
105
+
106
+ 1. Go to [https://id.atlassian.com/manage-profile/security/api-tokens](https://id.atlassian.com/manage-profile/security/api-tokens)
107
+ 2. In your JIRA instance, go to **Apps → Xray → API Keys**
108
+ 3. Create a new Client ID / Client Secret pair
109
+
110
+ ---
111
+
112
+ ## 3. Project Structure
113
+
114
+ After running `npx xqt init`:
115
+
116
+ ```
117
+ {{SERVICE_NAME}}/
118
+ ├── resources/
119
+ │ ├── openapi.yaml ← OpenAPI spec (replace with your actual spec)
120
+ │ └── business-rules.yaml ← Business rules (scenarios tests.json)
121
+
122
+ ├── tests/
123
+ │ ├── models/ ← Data models, request/response fixtures
124
+ │ ├── resources/ ← Shared helpers, utilities, constants
125
+ │ ├── services/ ← Service-level setup/teardown
126
+ │ └── specs/ ← Playwright spec files (.spec.ts)
127
+
128
+ ├── playwright.config.ts ← Reporters: JSON + JUnit + HTML
129
+ ├── tests.json ← Test definitions (push to Xray with xqt push-tests)
130
+ ├── xray-mapping.json ← Auto-managed: localId Xray key
131
+ ├── .xrayrc ← Project config (testPlanKey, environments…)
132
+ ├── .env.example ← Credential template (commit this)
133
+ ├── .env ← Your credentials (DO NOT commit)
134
+ └── XQT-GUIDE.md ← This file
135
+ ```
136
+
137
+ ---
138
+
139
+ ## 4. tests.json Reference
140
+
141
+ ```json
142
+ {
143
+ "testPlan": {
144
+ "key": "APIEE-1234",
145
+ "summary": "Sprint 12 — {{SERVICE_NAME}} API Regression"
146
+ },
147
+ "tests": [
148
+ {
149
+ "test_id": "TC-MYSVC-BR-001",
150
+ "type": "api",
151
+ "skip": false,
152
+ "tags": ["smoke", "regression"],
153
+ "folder": "/{{SERVICE_NAME}}/HealthCheck/Validation",
154
+ "testSet": "Health Check",
155
+ "requirementKeys": [],
156
+ "xray": {
157
+ "summary": "Service returns 200 OK when healthy",
158
+ "description": "Given Service is running, when GET /health is called, then Response is 200",
159
+ "testType": "Generic",
160
+ "definition": "Automated Playwright API test: GET /health — Service returns 200 OK",
161
+ "priority": "High",
162
+ "labels": ["smoke", "regression"]
163
+ }
164
+ }
165
+ ]
166
+ }
167
+ ```
168
+
169
+ ### Field Reference
170
+
171
+ | Field | Type | Required | Description |
172
+ |---|---|---|---|
173
+ | `test_id` | string | Yes | Stable local identifier — maps to Xray key in xray-mapping.json |
174
+ | `type` | string | — | `api` / `ui` / `e2e` (informational) |
175
+ | `skip` | boolean | — | `true` to exclude from push-tests |
176
+ | `tags` | string[] | — | QE tags for categorisation and filtering |
177
+ | `folder` | string | — | Xray repository folder path — must start with `/` |
178
+ | `testSet` | string | — | Test Set name in Jira — groups tests by feature |
179
+ | `requirementKeys` | string[] | — | JIRA issue keys this test covers (creates coverage links) |
180
+ | `xray.summary` | string | Yes | Test case title (JIRA issue summary) |
181
+ | `xray.description` | string | — | Detailed description |
182
+ | `xray.testType` | string | — | `Generic` (default for automated) / `Manual` / `Cucumber` |
183
+ | `xray.definition` | string | — | Generic test definition field in Xray |
184
+ | `xray.priority` | string | — | `Highest` / `High` / `Medium` / `Low` / `Lowest` |
185
+ | `xray.labels` | string[] | — | JIRA labels on the test issue |
186
+
187
+ ### testPlan block
188
+
189
+ | Field | Description |
190
+ |---|---|
191
+ | `testPlan.key` | Xray Test Plan issue key — populated by `xqt create-plan` |
192
+ | `testPlan.summary` | Human-readable description (not synced to Xray, local only) |
193
+
194
+ ---
195
+
196
+ ## 5. Command Reference
197
+
198
+ ### `xqt init`
199
+
200
+ Scaffold a new QA project in the current directory. Idempotent — never overwrites existing files.
201
+
202
+ ```bash
203
+ npx xqt init
204
+ npx xqt init --verbose
205
+ ```
206
+
207
+ ### `xqt create-plan`
208
+
209
+ Create a new Xray Test Plan in JIRA. Automatically updates `.xrayrc` and `tests.json`.
210
+
211
+ ```bash
212
+ npx xqt create-plan --summary "{{SERVICE_NAME}} v2 Regression"
213
+ npx xqt create-plan --summary "Sprint 12 Smoke Tests" --version "2024.12"
214
+ ```
215
+
216
+ ### `xqt push-tests`
217
+
218
+ Create or update tests in Xray Cloud, then sync the Test Plan membership and folder structure.
219
+
220
+ ```bash
221
+ npx xqt push-tests
222
+ npx xqt push-tests --plan APIEE-1234 # override plan key
223
+ npx xqt push-tests --verbose
224
+ ```
225
+
226
+ ### `xqt pull-tests`
227
+
228
+ Fetch test definitions from Xray and merge them into `tests.json`.
229
+
230
+ ```bash
231
+ npx xqt pull-tests --plan APIEE-1234
232
+ npx xqt pull-tests --project APIEE --limit 200
233
+ ```
234
+
235
+ ### `xqt import-results`
236
+
237
+ Import test execution results into Xray. Creates a **new** Test Execution each time.
238
+
239
+ ```bash
240
+ npx xqt import-results --file test-results/results.json --env IOP-QA
241
+ npx xqt import-results --file test-results/results.xml --env IOP-PROD
242
+ npx xqt import-results --file test-results/results.json --env IOP-DEV \
243
+ --plan APIEE-1234 --version "2024.12" --revision "a1b2c3d"
244
+ ```
245
+
246
+ **Options:**
247
+
248
+ | Flag | Description |
249
+ |---|---|
250
+ | `--file <path>` | Path to results file (`.json` = Playwright, `.xml` = JUnit) |
251
+ | `--env <label>` | Environment label: `IOP-DEV`, `IOP-QA`, `IOP-PROD` |
252
+ | `--plan <key>` | Test Plan key (overrides `.xrayrc`) |
253
+ | `--version <ver>` | Fix version / release label |
254
+ | `--revision <sha>` | Build number or git SHA |
255
+ | `--summary <text>` | Custom execution summary |
256
+
257
+ ### `xqt sync-folders`
258
+
259
+ Sync the Xray repository folder structure from `folder` fields in tests.json.
260
+
261
+ ```bash
262
+ npx xqt sync-folders
263
+ ```
264
+
265
+ ### `xqt status`
266
+
267
+ Show local and remote project status.
268
+
269
+ ```bash
270
+ npx xqt status
271
+ npx xqt status --plan APIEE-1234
272
+ ```
273
+
274
+ ### `xqt validate`
275
+
276
+ Validate `tests.json` against its schema.
277
+ Exit code 1 on errors — suitable for CI quality gates.
278
+
279
+ ```bash
280
+ npx xqt validate
281
+ npx xqt validate --file path/to/tests.json
282
+ ```
283
+
284
+ ### `xqt edit`
285
+
286
+ Launch a browser-based visual editor for `tests.json`.
287
+
288
+ ```bash
289
+ npx xqt edit
290
+ ```
291
+
292
+ ### `xqt gen-pipeline`
293
+
294
+ Generate an Azure Pipelines YAML template.
295
+
296
+ ```bash
297
+ npx xqt gen-pipeline
298
+ npx xqt gen-pipeline --output .azure/ci.yml
299
+ ```
300
+
301
+ ---
302
+
303
+ ## 6. Test Sets, Plans & Executions
304
+
305
+ ### Test Sets (persistent groupings)
306
+
307
+ Tests live in **Test Sets** in Jira, grouped by feature (matching the feature name in `business-rules.yaml`).
308
+
309
+ - Created automatically by `push-tests` from the `testSet` field in `tests.json`
310
+ - Persistent across sprints — they represent what tests exist
311
+ - Link Test Sets to Test Plans when entering a sprint
312
+
313
+ ### Test Plans (per-sprint)
314
+
315
+ A Test Plan scopes testing for a specific sprint or release.
316
+
317
+ - Create per sprint: `npx xqt create-plan --summary "Sprint 12 — {{SERVICE_NAME}}"`
318
+ - Link relevant Test Sets to the Test Plan in Jira
319
+ - The key is stored in `.xrayrc` (`testPlanKey`)
320
+ - `import-results` links executions to the active plan
321
+
322
+ ### Test Executions (ephemeral)
323
+
324
+ A Test Execution represents one CI run.
325
+ - Created automatically by `xqt import-results`
326
+ - Tagged with the environment (`IOP-DEV`, `IOP-QA`, `IOP-PROD`)
327
+ - Linked to the Test Plan
328
+
329
+ ### Summary
330
+
331
+ | Concept | Lifecycle | Purpose |
332
+ |---------|-----------|--------|
333
+ | **Test Set** | Permanent | Groups tests by feature |
334
+ | **Test Plan** | Per-sprint | Scopes testing for a sprint |
335
+ | **Test Execution** | Per-CI-run | Records pass/fail for one run |
336
+
337
+ ### Environment labels
338
+
339
+ Set the default environment and allowed values in `.xrayrc`:
340
+
341
+ ```json
342
+ {
343
+ "defaultEnvironment": "IOP-QA",
344
+ "environments": ["IOP-DEV", "IOP-QA", "IOP-PROD"]
345
+ }
346
+ ```
347
+
348
+ Override per run with `--env`:
349
+
350
+ ```bash
351
+ npx xqt import-results --file results.json --env IOP-PROD
352
+ ```
353
+
354
+ ---
355
+
356
+ ## 7. Playwright Integration
357
+
358
+ ### Annotate tests with Xray keys
359
+
360
+ ```typescript
361
+ import { test, expect } from '@playwright/test';
362
+
363
+ test('GET /users returns 200', async ({ request }) => {
364
+ // Link this Playwright test to an Xray test case
365
+ test.info().annotations.push({ type: 'xray', description: 'APIEE-1234' });
366
+
367
+ const response = await request.get('/users');
368
+ expect(response.status()).toBe(200);
369
+ });
370
+ ```
371
+
372
+ Alternatively, include the key in the test title:
373
+
374
+ ```typescript
375
+ test('[APIEE-1234] GET /users returns 200', async ({ request }) => { ... });
376
+ ```
377
+
378
+ ### playwright.config.ts reporters
379
+
380
+ The generated `playwright.config.ts` configures three reporters:
381
+
382
+ - **JSON** → `test-results/results.json` (consumed by `xqt import-results`)
383
+ - **JUnit** → `test-results/results.xml` (also consumed by `xqt import-results --file *.xml`)
384
+ - **HTML** → `playwright-report/` (CI artifact)
385
+
386
+ ### Import results
387
+
388
+ ```bash
389
+ # After running: npx playwright test
390
+ npx xqt import-results --file test-results/results.json --env IOP-QA
391
+ ```
392
+
393
+ ### Test steps in Xray
394
+
395
+ Steps defined with `test.step()` are automatically mapped to Xray step results:
396
+
397
+ ```typescript
398
+ test('Create and retrieve user', async ({ request }) => {
399
+ test.info().annotations.push({ type: 'xray', description: 'APIEE-2001' });
400
+
401
+ await test.step('Create user via POST /users', async () => {
402
+ const r = await request.post('/users', { data: { name: 'Alice' } });
403
+ expect(r.status()).toBe(201);
404
+ });
405
+
406
+ await test.step('Retrieve user via GET /users/:id', async () => {
407
+ const r = await request.get('/users/1');
408
+ expect(r.status()).toBe(200);
409
+ });
410
+ });
411
+ ```
412
+
413
+ ---
414
+
415
+ ## 8. Folder Structure in Xray
416
+
417
+ Organise tests in the Xray Test Repository using the `folder` field.
418
+
419
+ ```json
420
+ {
421
+ "test_id": "TC-MYSVC-BR-001",
422
+ "folder": "/{{SERVICE_NAME}}/HealthCheck/Validation"
423
+ }
424
+ ```
425
+
426
+ - Paths must start with `/`
427
+ - The `folderRoot` in `.xrayrc` is used as the base (default: `/{{SERVICE_NAME}}`)
428
+ - Folders are created automatically by `push-tests` and `sync-folders`
429
+ - Run `xqt sync-folders` to update folders without pushing test changes
430
+
431
+ ---
432
+
433
+ ## 9. Business Rules
434
+
435
+ Business rules live in `resources/business-rules.yaml` and describe the
436
+ service's expected behaviour. They are the input (alongside `openapi.yaml`) for generating `tests.json`.
437
+
438
+ ```yaml
439
+ service: "{{SERVICE_NAME}}"
440
+ version: "1.0"
441
+
442
+ features:
443
+ - name: "User Management"
444
+ endpoints:
445
+ - GET /api/v1/users
446
+ - POST /api/v1/users
447
+ rules:
448
+ - id: "BR-001"
449
+ description: "Valid user creation returns 201"
450
+ given: "Authenticated user with create permission"
451
+ when: "POST /api/v1/users with valid body"
452
+ then: "Response is 201 with user id"
453
+ category: "business-logic"
454
+ priority: "High"
455
+ tags: [regression, smoke]
456
+ ```
457
+
458
+ - Each feature name becomes a **Test Set** in Jira
459
+ - Each rule maps 1:1 to a `tests.json` entry and a Playwright test
460
+ - See **[SPEC-DRIVEN-APPROACH.md](SPEC-DRIVEN-APPROACH.md)** for full generation rules
461
+
462
+ Validate the rules file with:
463
+
464
+ ```bash
465
+ npx xqt validate --schema business-rules
466
+ ```
467
+
468
+ ---
469
+
470
+ ## 10. CI/CD Integration
471
+
472
+ ### Azure DevOps
473
+
474
+ `npx xqt init` scaffolds a ready-to-use `azure-pipelines.yml` with two stages:
475
+
476
+ - **Stage 1 `CodeQuality`** — ESLint + TypeScript type check
477
+ - **Stage 2 `QA_Regression`** — Playwright tests → `xqt import-results` → artifact publish
478
+
479
+ Key import step (runs even on test failure):
480
+
481
+ ```yaml
482
+ - script: |
483
+ REVISION=$(echo "$(Build.SourceVersion)" | cut -c1-8)
484
+ npx xqt import-results \
485
+ --file test-results/results.json \
486
+ --version "$(Build.BuildNumber)" \
487
+ --revision "$REVISION"
488
+ condition: succeededOrFailed()
489
+ env:
490
+ XRAY_ID: $(xray_client_id)
491
+ XRAY_SECRET: $(xray_client_secret)
492
+ JIRA_PROJECT_KEY: $(JIRA_PROJECT_KEY)
493
+ JIRA_URL: $(JIRA_URL)
494
+ JIRA_API_TOKEN: $(JIRA_API_TOKEN)
495
+ JIRA_EMAIL: $(JIRA_EMAIL)
496
+ XRAY_GRAPHQL_URL: $(XRAY_GRAPHQL_URL_US)
497
+ XRAY_REST_URL: $(XRAY_REST_URL)
498
+ ```
499
+
500
+ ### Required ADO variable groups
501
+
502
+ Create these in **ADO Library → Variable groups** before running the pipeline:
503
+
504
+ | Group | Variable | Description |
505
+ |---|---|---|
506
+ | `xray-qa-shared` *(shared — one-time)* | `xray_client_id` | Xray Cloud Client ID |
507
+ | | `xray_client_secret` | Xray Cloud Client Secret |
508
+ | | `JIRA_PROJECT_KEY` | JIRA project key |
509
+ | | `JIRA_URL` | JIRA instance URL |
510
+ | | `JIRA_API_TOKEN` | JIRA API token |
511
+ | | `JIRA_EMAIL` | JIRA user email |
512
+ | | `XRAY_GRAPHQL_URL_US` | Xray GraphQL endpoint |
513
+ | | `XRAY_REST_URL` | Xray REST endpoint |
514
+ | `{{SERVICE_NAME}}-qa` *(per-repo)* | `base_url` | API base URL for this service |
515
+ | | `gravitee_api_key` | Gateway API key |
516
+
517
+ ---
518
+
519
+ ## 11. xray-mapping.json
520
+
521
+ Auto-managed by `push-tests` — do not edit manually.
522
+
523
+ ```json
524
+ {
525
+ "TC-MYSVC-BR-001": {
526
+ "key": "APIEE-1234",
527
+ "id": "8765432"
528
+ }
529
+ }
530
+ ```
531
+
532
+ - `key` — JIRA issue key (e.g. `APIEE-1234`)
533
+ - `id` — Xray numeric issue ID (used for GraphQL operations)
534
+ - Entries are created by `push-tests` and updated on every push
535
+ - **Commit this file** — the whole team must share the same mapping
536
+ - Used by Copilot skill to generate Playwright tests with real Jira keys
537
+
538
+ ---
539
+
540
+ ## 12. Configuration (.xrayrc)
541
+
542
+ `.xrayrc` (JSON) at the project root configures xqt behaviour per-project.
543
+
544
+ ```json
545
+ {
546
+ "testsPath": "tests.json",
547
+ "mappingPath": "xray-mapping.json",
548
+ "resourcesPath": "resources",
549
+ "playwrightDir": "tests",
550
+ "testPlanKey": "APIEE-1234",
551
+ "defaultEnvironment": "IOP-DEV",
552
+ "environments": ["IOP-DEV", "IOP-QA", "IOP-PROD"],
553
+ "folderRoot": "/{{SERVICE_NAME}}",
554
+ "xrayRegion": "us"
555
+ }
556
+ ```
557
+
558
+ ### xrayRegion values
559
+
560
+ | Value | GraphQL endpoint |
561
+ |---|---|
562
+ | `us` (default) | `https://xray.cloud.getxray.app/` |
563
+ | `eu` | `https://eu.xray.cloud.getxray.app/` |
564
+ | `au` | `https://au.xray.cloud.getxray.app/` |
565
+
566
+ You can also set `XRAY_REGION=eu` in `.env`.
567
+
568
+ ---
569
+
570
+ *Generated by @msalaam/xray-qe-toolkit — See [npm package](https://www.npmjs.com/package/@msalaam/xray-qe-toolkit) for updates.*