@msalaam/xray-qe-toolkit 1.1.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/.env.example +16 -0
- package/README.md +893 -0
- package/bin/cli.js +137 -0
- package/commands/createExecution.js +46 -0
- package/commands/editJson.js +165 -0
- package/commands/genPipeline.js +42 -0
- package/commands/genPostman.js +70 -0
- package/commands/genTests.js +138 -0
- package/commands/importResults.js +50 -0
- package/commands/init.js +141 -0
- package/commands/pushTests.js +114 -0
- package/lib/config.js +108 -0
- package/lib/index.js +31 -0
- package/lib/logger.js +43 -0
- package/lib/postmanGenerator.js +305 -0
- package/lib/testCaseBuilder.js +202 -0
- package/lib/xrayClient.js +416 -0
- package/package.json +61 -0
- package/schema/tests.schema.json +112 -0
- package/templates/README.template.md +161 -0
- package/templates/azure-pipelines.yml +65 -0
- package/templates/knowledge-README.md +121 -0
- package/templates/tests.json +72 -0
- package/templates/xray-mapping.json +1 -0
- package/ui/editor/editor.js +484 -0
- package/ui/editor/index.html +150 -0
- package/ui/editor/styles.css +550 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Xray QE Toolkit Project
|
|
2
|
+
|
|
3
|
+
> Quality Engineering workflow automation for Xray Cloud integration
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### 1. Configure Credentials
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Copy the template and fill in your credentials
|
|
11
|
+
cp .env.example .env
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Edit `.env` with your Xray Cloud and JIRA credentials:
|
|
15
|
+
|
|
16
|
+
```env
|
|
17
|
+
XRAY_ID=your_xray_client_id
|
|
18
|
+
XRAY_SECRET=your_xray_client_secret
|
|
19
|
+
JIRA_PROJECT_KEY=YOUR_PROJECT
|
|
20
|
+
JIRA_URL=https://your-domain.atlassian.net
|
|
21
|
+
JIRA_API_TOKEN=your_jira_api_token
|
|
22
|
+
JIRA_EMAIL=your.email@company.com
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Important:** Both Xray and JIRA credentials must belong to the same user.
|
|
26
|
+
|
|
27
|
+
### 2. Add Your Documentation
|
|
28
|
+
|
|
29
|
+
Populate the `knowledge/` folder with your API specs and requirements:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
knowledge/
|
|
33
|
+
├── api-specs/ ← OpenAPI/Swagger specs (.yaml, .json)
|
|
34
|
+
├── requirements/ ← Business requirements (.md, .pdf, .docx)
|
|
35
|
+
└── tickets/ ← JIRA exports, Confluence pages
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
See [knowledge/README.md](knowledge/README.md) for details.
|
|
39
|
+
|
|
40
|
+
### 3. Create Test Cases
|
|
41
|
+
|
|
42
|
+
**Option A: Manual (No AI required)**
|
|
43
|
+
```bash
|
|
44
|
+
# Open the visual editor
|
|
45
|
+
npx xqt edit-json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Option B: AI-Assisted (Requires setup)**
|
|
49
|
+
```bash
|
|
50
|
+
# Generate from knowledge sources
|
|
51
|
+
npx xqt gen-tests --ai
|
|
52
|
+
|
|
53
|
+
# Then review in the editor
|
|
54
|
+
npx xqt edit-json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 4. Push to Xray Cloud
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npx xqt push-tests
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 5. Generate Postman Collection
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx xqt gen-postman
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 6. Set Up CI Pipeline
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Generate Azure Pipelines template
|
|
73
|
+
npx xqt gen-pipeline
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Available Commands
|
|
77
|
+
|
|
78
|
+
| Command | Description |
|
|
79
|
+
|---------|-------------|
|
|
80
|
+
| `npx xqt init` | Scaffold new project (already done) |
|
|
81
|
+
| `npx xqt gen-tests` | Generate test cases from knowledge/ |
|
|
82
|
+
| `npx xqt edit-json` | Review/edit tests in browser |
|
|
83
|
+
| `npx xqt push-tests` | Push tests to Xray Cloud |
|
|
84
|
+
| `npx xqt gen-postman` | Generate Postman collection |
|
|
85
|
+
| `npx xqt gen-pipeline` | Generate CI pipeline template |
|
|
86
|
+
| `npx xqt create-execution` | Create Test Execution issue |
|
|
87
|
+
| `npx xqt import-results` | Import test results (CI) |
|
|
88
|
+
|
|
89
|
+
Run any command with `--help` for details:
|
|
90
|
+
```bash
|
|
91
|
+
npx xqt gen-tests --help
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Workflow
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
1. Add docs to knowledge/
|
|
98
|
+
2. Generate tests (AI or manual)
|
|
99
|
+
3. Review in edit-json
|
|
100
|
+
4. Push to Xray
|
|
101
|
+
5. Generate Postman collection
|
|
102
|
+
6. Run in CI (newman + import-results)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Files
|
|
106
|
+
|
|
107
|
+
| File | Purpose |
|
|
108
|
+
|------|---------|
|
|
109
|
+
| `tests.json` | Test definitions (source of truth) |
|
|
110
|
+
| `xray-mapping.json` | Maps test IDs to JIRA keys |
|
|
111
|
+
| `collection.postman.json` | Generated Postman collection |
|
|
112
|
+
| `.env` | Credentials (DO NOT COMMIT) |
|
|
113
|
+
| `.xrayrc` | Project config |
|
|
114
|
+
| `knowledge/` | API specs and requirements |
|
|
115
|
+
|
|
116
|
+
## Multi-Company Test Format
|
|
117
|
+
|
|
118
|
+
If you work across multiple companies or business units, keep a consistent naming pattern:
|
|
119
|
+
|
|
120
|
+
- `test_id`: `COMPANY-AREA-FLOW-###` (e.g., `ACME-BILLING-PAYMENTS-001`)
|
|
121
|
+
- `xray.summary`: prefix with `[COMPANY]` for easy filtering
|
|
122
|
+
- `xray.labels`: add `company:<slug>`, `system:<slug>`, `team:<slug>`
|
|
123
|
+
- `testExecution.summary`: include company + release/sprint
|
|
124
|
+
|
|
125
|
+
For multiple companies, keep separate configs and files (recommended), or swap `.env` and `.xrayrc` before running.
|
|
126
|
+
|
|
127
|
+
## Jira/Xray Board Alignment
|
|
128
|
+
|
|
129
|
+
1. Create a JIRA project per company/team and enable Xray.
|
|
130
|
+
2. Ensure issue types include **Test** and **Test Execution**.
|
|
131
|
+
3. Add fields to screens: Summary, Description, Priority, Labels, Test Steps.
|
|
132
|
+
4. Grant API user permissions to create/edit Test and Test Execution issues.
|
|
133
|
+
5. Create a board with a filter for your project and those issue types.
|
|
134
|
+
6. Use components/labels that match your naming conventions.
|
|
135
|
+
|
|
136
|
+
## Tags
|
|
137
|
+
|
|
138
|
+
Use tags in `edit-json` to organize test suites:
|
|
139
|
+
|
|
140
|
+
- `regression` — Full regression pack
|
|
141
|
+
- `smoke` — Critical path tests only
|
|
142
|
+
- `critical` — Business-critical flows
|
|
143
|
+
- `edge` — Edge cases and error handling
|
|
144
|
+
- `integration` — Multi-system tests
|
|
145
|
+
|
|
146
|
+
## Need Help?
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Show all commands
|
|
150
|
+
npx xqt --help
|
|
151
|
+
|
|
152
|
+
# Show command-specific help
|
|
153
|
+
npx xqt push-tests --help
|
|
154
|
+
|
|
155
|
+
# Enable debug output
|
|
156
|
+
npx xqt push-tests --verbose
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Package Documentation
|
|
160
|
+
|
|
161
|
+
Full documentation: https://www.npmjs.com/package/@msalaam/xray-qe-toolkit
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# ──────────────────────────────────────────────────────────────
|
|
2
|
+
# Azure DevOps Pipeline — Xray QE Regression Runner
|
|
3
|
+
# Generated by @msalaam/xray-qe-toolkit
|
|
4
|
+
# ──────────────────────────────────────────────────────────────
|
|
5
|
+
#
|
|
6
|
+
# This pipeline runs Newman against the generated Postman collection
|
|
7
|
+
# and imports results into Xray Cloud.
|
|
8
|
+
#
|
|
9
|
+
# IMPORTANT: edit-json and QE review gates are NOT part of CI.
|
|
10
|
+
# Those steps must be run locally before committing.
|
|
11
|
+
#
|
|
12
|
+
# Required pipeline variables (set in Azure DevOps UI → Variables):
|
|
13
|
+
# XRAY_ID, XRAY_SECRET, JIRA_PROJECT_KEY, JIRA_URL,
|
|
14
|
+
# JIRA_API_TOKEN, JIRA_EMAIL, TEST_EXEC_KEY
|
|
15
|
+
# ──────────────────────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
trigger:
|
|
18
|
+
branches:
|
|
19
|
+
include:
|
|
20
|
+
- main
|
|
21
|
+
- release/*
|
|
22
|
+
|
|
23
|
+
pool:
|
|
24
|
+
vmImage: "ubuntu-latest"
|
|
25
|
+
|
|
26
|
+
variables:
|
|
27
|
+
NODE_VERSION: "18.x"
|
|
28
|
+
|
|
29
|
+
steps:
|
|
30
|
+
- task: NodeTool@0
|
|
31
|
+
displayName: "Install Node.js $(NODE_VERSION)"
|
|
32
|
+
inputs:
|
|
33
|
+
versionSpec: "$(NODE_VERSION)"
|
|
34
|
+
|
|
35
|
+
- script: |
|
|
36
|
+
npm ci
|
|
37
|
+
displayName: "Install dependencies"
|
|
38
|
+
|
|
39
|
+
- script: |
|
|
40
|
+
npx newman run collection.postman.json \
|
|
41
|
+
--reporters cli,junit \
|
|
42
|
+
--reporter-junit-export results.xml \
|
|
43
|
+
--suppress-exit-code
|
|
44
|
+
displayName: "Run Newman tests"
|
|
45
|
+
|
|
46
|
+
- script: |
|
|
47
|
+
npx xqt import-results \
|
|
48
|
+
--file results.xml \
|
|
49
|
+
--testExecKey $(TEST_EXEC_KEY)
|
|
50
|
+
displayName: "Import results to Xray"
|
|
51
|
+
env:
|
|
52
|
+
XRAY_ID: $(XRAY_ID)
|
|
53
|
+
XRAY_SECRET: $(XRAY_SECRET)
|
|
54
|
+
JIRA_PROJECT_KEY: $(JIRA_PROJECT_KEY)
|
|
55
|
+
JIRA_URL: $(JIRA_URL)
|
|
56
|
+
JIRA_API_TOKEN: $(JIRA_API_TOKEN)
|
|
57
|
+
JIRA_EMAIL: $(JIRA_EMAIL)
|
|
58
|
+
|
|
59
|
+
- task: PublishTestResults@2
|
|
60
|
+
displayName: "Publish JUnit results"
|
|
61
|
+
inputs:
|
|
62
|
+
testResultsFormat: "JUnit"
|
|
63
|
+
testResultsFiles: "results.xml"
|
|
64
|
+
mergeTestResults: true
|
|
65
|
+
failTaskOnFailedTests: true
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Knowledge Base — AI Test Generation Resources
|
|
2
|
+
|
|
3
|
+
This folder contains documentation and specifications used by the AI agent to generate test cases for Xray.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Folder Structure
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
knowledge/
|
|
11
|
+
├── api-specs/ OpenAPI/Swagger specifications (YAML/JSON)
|
|
12
|
+
├── requirements/ Business requirements, acceptance criteria, logic docs
|
|
13
|
+
└── tickets/ Exported JIRA tickets, Confluence pages, user stories
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Supported File Types
|
|
19
|
+
|
|
20
|
+
### `api-specs/`
|
|
21
|
+
- **OpenAPI 3.x / Swagger 2.0** — `.yaml`, `.yml`, `.json`
|
|
22
|
+
- **Postman collections** — `.postman_collection.json`
|
|
23
|
+
- **GraphQL schemas** — `.graphql`, `.gql`
|
|
24
|
+
|
|
25
|
+
Files in this folder are used to generate API test cases with accurate endpoints, methods, request/response schemas, and authentication patterns.
|
|
26
|
+
|
|
27
|
+
### `requirements/`
|
|
28
|
+
- **Markdown** — `.md`
|
|
29
|
+
- **Plain text** — `.txt`
|
|
30
|
+
- **Word documents** — `.docx`
|
|
31
|
+
- **PDFs** — `.pdf`
|
|
32
|
+
|
|
33
|
+
Business logic, acceptance criteria, workflow descriptions, and domain rules. Used to generate test scenarios, edge cases, and validation logic.
|
|
34
|
+
|
|
35
|
+
### `tickets/`
|
|
36
|
+
- **JIRA exports** — `.json`, `.xml`
|
|
37
|
+
- **Confluence HTML exports** — `.html`
|
|
38
|
+
- **User stories** — `.md`, `.txt`
|
|
39
|
+
|
|
40
|
+
Ticket acceptance criteria and linked documentation. Used to ensure test coverage aligns with stories and epics.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## How the AI Agent Uses These Files
|
|
45
|
+
|
|
46
|
+
1. **Test Case Generation** (`npx xqt gen-tests --ai`)
|
|
47
|
+
- Analyzes all files in `knowledge/`
|
|
48
|
+
- Generates structured test cases in `tests.json` format
|
|
49
|
+
- Infers test IDs, priorities, tags, and step-by-step actions
|
|
50
|
+
- Groups related tests by domain/feature
|
|
51
|
+
|
|
52
|
+
2. **Postman Collection Generation** (`npx xqt gen-postman --ai`)
|
|
53
|
+
- Combines `tests.json` with `knowledge/api-specs/`
|
|
54
|
+
- Generates executable Postman requests with:
|
|
55
|
+
- Real endpoints from OpenAPI specs
|
|
56
|
+
- Request bodies matching schemas
|
|
57
|
+
- Assertions based on expected responses
|
|
58
|
+
- Environment variables for base URLs, tokens
|
|
59
|
+
|
|
60
|
+
3. **Continuous Refinement**
|
|
61
|
+
- As you add/update specs and docs, re-run generation commands
|
|
62
|
+
- The toolkit is **idempotent** — existing tests are updated, not duplicated
|
|
63
|
+
- Always review generated tests via `npx xqt edit-json` before pushing to Xray
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Best Practices
|
|
68
|
+
|
|
69
|
+
✅ **DO:**
|
|
70
|
+
- Keep specs up to date with your API implementation
|
|
71
|
+
- Organize files by feature/domain for easier tracking
|
|
72
|
+
- Use descriptive filenames (e.g., `auth-api-v2.yaml`, `payment-flows.md`)
|
|
73
|
+
- Commit this folder to source control (Git)
|
|
74
|
+
|
|
75
|
+
⚠️ **DON'T:**
|
|
76
|
+
- Store credentials or secrets in these files
|
|
77
|
+
- Include massive binary files (>10MB) — extract relevant sections
|
|
78
|
+
- Mix unrelated specs in the same file
|
|
79
|
+
- Forget to update specs when the API changes
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Example Workflow
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# 1. Add an OpenAPI spec
|
|
87
|
+
cp ~/Downloads/api-spec.yaml knowledge/api-specs/users-api.yaml
|
|
88
|
+
|
|
89
|
+
# 2. Add business requirements
|
|
90
|
+
echo "Users must be able to reset passwords via email" > knowledge/requirements/password-reset.md
|
|
91
|
+
|
|
92
|
+
# 3. Generate test cases from knowledge
|
|
93
|
+
npx xqt gen-tests --ai
|
|
94
|
+
|
|
95
|
+
# 4. Review and edit generated tests
|
|
96
|
+
npx xqt edit-json
|
|
97
|
+
|
|
98
|
+
# 5. Push approved tests to Xray
|
|
99
|
+
npx xqt push-tests
|
|
100
|
+
|
|
101
|
+
# 6. Generate Postman collection with AI-enhanced assertions
|
|
102
|
+
npx xqt gen-postman --ai
|
|
103
|
+
|
|
104
|
+
# 7. Run tests in CI
|
|
105
|
+
newman run collection.postman.json
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## V2 Roadmap: UI Testing with Playwright
|
|
111
|
+
|
|
112
|
+
In the next version, this folder will also support:
|
|
113
|
+
- **Page object models** — `.ts` definitions
|
|
114
|
+
- **User journey diagrams** — `.drawio`, `.svg`
|
|
115
|
+
- **Accessibility standards** — WCAG checklists
|
|
116
|
+
|
|
117
|
+
The toolkit will generate Playwright test scripts (`*.spec.ts`) for UI regression packs.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
**Note:** The `--ai` flag requires a connected AI provider (e.g., GitHub Copilot, Azure OpenAI). Without it, commands fall back to schema-driven generation where applicable.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"testExecution": {
|
|
3
|
+
"summary": "Sprint XX - Automated Regression Suite",
|
|
4
|
+
"description": "Automated test execution covering API regression tests. Generate test cases from knowledge/ folder using: npx xray-qe gen-tests --ai"
|
|
5
|
+
},
|
|
6
|
+
"tests": [
|
|
7
|
+
{
|
|
8
|
+
"test_id": "TC-API-GET-001",
|
|
9
|
+
"type": "api",
|
|
10
|
+
"tags": ["regression", "smoke"],
|
|
11
|
+
"xray": {
|
|
12
|
+
"summary": "Verify GET /api/resource returns 200 with valid data",
|
|
13
|
+
"description": "SCAFFOLD: This is an example test. Generate real tests from knowledge/ using 'npx xray-qe gen-tests --ai' or edit manually via 'npx xray-qe edit-json'.",
|
|
14
|
+
"priority": "High",
|
|
15
|
+
"labels": ["API", "GET", "Regression"],
|
|
16
|
+
"steps": [
|
|
17
|
+
{
|
|
18
|
+
"action": "Send GET request to /api/resource/123",
|
|
19
|
+
"data": "Method: GET, Endpoint: /api/resource/123, Headers: Authorization: Bearer {token}",
|
|
20
|
+
"expected_result": "API returns 200 OK with resource object containing id, name, and status fields"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"action": "Validate response schema",
|
|
24
|
+
"data": "Expected schema: { id: number, name: string, status: string }",
|
|
25
|
+
"expected_result": "Response matches expected schema and all required fields are present"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"test_id": "TC-API-POST-001",
|
|
32
|
+
"type": "api",
|
|
33
|
+
"tags": ["regression"],
|
|
34
|
+
"xray": {
|
|
35
|
+
"summary": "VeriSCAFFOLD: Example test demonstrating POST operations. Replace with tests generated from your API specifications
|
|
36
|
+
"description": "Test that a new resource is created successfully via POST with valid payload.",
|
|
37
|
+
"priority": "Medium",
|
|
38
|
+
"labels": ["API", "POST", "CRUD"],
|
|
39
|
+
"steps": [
|
|
40
|
+
{
|
|
41
|
+
"action": "Send POST request with valid payload",
|
|
42
|
+
"data": "Method: POST, Endpoint: /api/resource, Body: {\"name\": \"New Resource\", \"type\": \"demo\"}",
|
|
43
|
+
"expected_result": "API returns 201 Created with resource ID and location header"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"action": "Verify resource was persisted",
|
|
47
|
+
"data": "Method: GET, Endpoint: /api/resource/{newId}",
|
|
48
|
+
"expected_result": "GET returns the newly created resource with matching name and type"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"test_id": "TC-API-ERR-400",
|
|
55
|
+
"type": "api",
|
|
56
|
+
"tags": ["regression", "edge"],
|
|
57
|
+
"xray": {
|
|
58
|
+
"summary": "VeriSCAFFOLD: Example error handling test. Generate comprehensive validation tests from your API specs and requirements
|
|
59
|
+
"description": "Test that the API returns proper error response when invalid data is submitted.",
|
|
60
|
+
"priority": "Medium",
|
|
61
|
+
"labels": ["API", "ErrorHandling", "Validation"],
|
|
62
|
+
"steps": [
|
|
63
|
+
{
|
|
64
|
+
"action": "Send POST request with missing required field",
|
|
65
|
+
"data": "Method: POST, Endpoint: /api/resource, Body: {} (empty)",
|
|
66
|
+
"expected_result": "API returns 400 Bad Request with descriptive error message"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|