Xray Integration
TestIntel integrates with Xray for Jira Cloud to sync test cases and results.
Setup
1. Generate API credentials
In Jira, go to Apps → Xray → Settings → API Keys and create a new API key. You'll get a Client ID and Client Secret.
2. Set environment variables
$env:XRAY_CLIENT_ID="your-client-id"
$env:XRAY_CLIENT_SECRET="your-client-secret"
3. Configure config.yaml
xray:
client_id_env_var: XRAY_CLIENT_ID
client_secret_env_var: XRAY_CLIENT_SECRET
project_key: HR
4. Run schema discovery
testintel discover
This scans your Xray instance for test statuses, step statuses, and test types, and writes the mappings to testintel_data/schema.yaml. All Xray operations use these discovered mappings for priority and status translation.
Usage
Xray sync is available via the Web UI Sync bar (Inventory tab) and API endpoints.
Web UI
- Go to the Inventory tab
- The Sync bar appears automatically when Xray is configured
- Use the ⬇ Xray Pull, ⬆ Xray Push, and ⬇ Xray Results buttons
- Push operations show real-time progress via SSE streaming
- Select specific tests with checkboxes before pushing to push only those tests
API
# Pull tests into inventory
curl -X POST http://localhost:8000/sync/xray/pull -H "x-api-key: your-key"
# Push inventory to Xray
curl -X POST http://localhost:8000/sync/xray/push -H "x-api-key: your-key"
# Push specific tests
curl -X POST "http://localhost:8000/sync/xray/push?test_ids=TC-0001,TC-0002" -H "x-api-key: your-key"
# Push JUnit XML results
curl -X POST http://localhost:8000/sync/xray/push-junit -H "x-api-key: your-key" -F "file=@results.xml"
# Pull test results
curl -X POST http://localhost:8000/sync/xray/pull-results -H "x-api-key: your-key"
Schema discovery (CLI)
testintel discover
This is a one-time setup command that scans your Xray instance and writes mappings to testintel_data/schema.yaml.
How it works
- Authentication: Xray Cloud uses OAuth — client ID + secret are exchanged for a bearer token via
https://xray.cloud.getxray.app/api/v2/authenticate - Test cases: Created via GraphQL API. Tests are Jira issues of type "Test" with manual steps
- Results: JUnit XML import uses the REST endpoint. Individual results use GraphQL to create Test Executions
- Test types: Supports Manual (action/result steps), Cucumber (Gherkin definition), Generic (unstructured text), and Exploratory
- Round-trip fidelity: Pulled tests are tagged with
xray-manual,xray-cucumber,xray-generic, orxray-exploratoryso pushes preserve the correct type - Schema-driven: Priority and status mappings come from
testintel discover, not hardcoded values
Tags on pull
When you pull tests from Xray, TestIntel adds tags automatically for traceability and round-trip sync:
| Tag | Source | Purpose |
|---|---|---|
Xray-Import | Always added | Identifies tests imported from Xray |
Xray-Manual | Test type = Manual | Script type — action/result steps |
Xray-Cucumber | Test type = Cucumber | Script type — Gherkin/BDD definition |
Xray-Generic | Test type = Generic | Script type — unstructured text |
Xray-Exploratory | Test type = Exploratory | Script type — exploratory charter |
| *(user labels)* | Xray labels field | Any labels assigned to the test in Xray |
If a pulled test triggers duplicate detection against existing inventory (≥80% name similarity), it also receives Needs Review - Potential Duplicate.
These tags are metadata only — the type field (E2E, Integration, etc.) is determined separately via label/tag scanning configured in config.yaml.
Status sync
Xray does not have a native lifecycle status field on test cases (tests are standard Jira issues). Because of this, TestIntel does not automatically sync status changes back to Xray.
To manage test approval for Xray-sourced tests:
- Use the Staging tab as a review gate — tests promoted from Staging to Inventory are automatically set to "Approved"
- If your team uses a custom Jira field for approval status, this can be configured in a future release
Differences from Zephyr Scale
| Feature | Zephyr Scale | Xray |
|---|---|---|
| API style | REST | GraphQL + REST |
| Auth | JWT bearer token | Client ID/Secret → OAuth token |
| Test identity | Zephyr key (HR-T1) | Jira issue key (HR-123) |
| Steps | Separate API call | Part of test (GraphQL mutation) |
| Results | Test Cycle required | Test Execution issue |
| JUnit import | /automations/executions/junit | /import/execution/junit |