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

  1. Go to the Inventory tab
  1. The Sync bar appears automatically when Xray is configured
  1. Use the ⬇ Xray Pull, ⬆ Xray Push, and ⬇ Xray Results buttons
  1. Push operations show real-time progress via SSE streaming
  1. 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

Tags on pull

When you pull tests from Xray, TestIntel adds tags automatically for traceability and round-trip sync:

TagSourcePurpose
Xray-ImportAlways addedIdentifies tests imported from Xray
Xray-ManualTest type = ManualScript type — action/result steps
Xray-CucumberTest type = CucumberScript type — Gherkin/BDD definition
Xray-GenericTest type = GenericScript type — unstructured text
Xray-ExploratoryTest type = ExploratoryScript type — exploratory charter
*(user labels)*Xray labels fieldAny 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:

Differences from Zephyr Scale

FeatureZephyr ScaleXray
API styleRESTGraphQL + REST
AuthJWT bearer tokenClient ID/Secret → OAuth token
Test identityZephyr key (HR-T1)Jira issue key (HR-123)
StepsSeparate API callPart of test (GraphQL mutation)
ResultsTest Cycle requiredTest Execution issue
JUnit import/automations/executions/junit/import/execution/junit