Skip to main content

Command-line interface for Xray Cloud test management

Project description

xray-cli

Command-line interface for Xray Cloud test management.

A zero-dependency Python CLI that talks to the Xray Cloud API (GraphQL + REST) to manage test executions, tests, runs, results, preconditions, test sets, test plans, and folders — all from your terminal.

Installation

Requires Python 3.8+.

pip install .

This installs the xray command.

Quick Start

  1. Set your Xray API credentials (get them from Xray Cloud → API Keys):
export XRAY_CLIENT_ID="your-client-id"
export XRAY_CLIENT_SECRET="your-client-secret"

Or create a config file (see Configuration below).

  1. Run a command:
xray execution list --limit 5
xray test get XSP-123
xray run list --execution XSP-456 --failed-only

Global Flags

Flag Short Description
--version Print version and exit
--config PATH Path to config file (default: auto-discover .xray-cli.ini)
--json Output in JSON format instead of human-readable text
--verbose -v Enable verbose/debug output
--quiet -q Suppress all non-error output
--timeout SECONDS Request timeout in seconds (default: from config or 30)

Note: Global flags can be placed anywhere in the command, e.g. xray --json execution list or xray execution list --json.

Commands

xray execution — Test Execution Operations

List executions:

xray execution list [--jql JQL] [--limit N] [--start N]

Create an execution:

xray execution create --project XSP --summary "Regression run" [--test XSP-100 --test XSP-101]
Argument Required Description
--project Yes Jira project key
--summary Yes Summary for the new execution
--test No Test issue key to include (repeatable)

xray test — Test Operations

Get a single test:

xray test get XSP-123

List tests:

xray test list [--jql JQL] [--limit N] [--start N]

xray run — Test Run Operations

List runs:

xray run list [--test XSP-123] [--execution XSP-456] [--status PASS] [--failed-only] [--limit N] [--start N]
Argument Description
--test Filter by test issue key (repeatable)
--execution Filter by execution issue key (repeatable)
--status Filter by run status name
--failed-only Show only failed/aborted runs

Update run status:

xray run update-status <run_id> <status>

Status values: PASS, FAIL, TODO, EXECUTING, ABORTED, etc.

Add evidence to a run:

xray run add-evidence <run_id> path/to/screenshot.png

xray results — Import Test Results

Import Xray JSON results:

xray results import xray-json results.json [--project XSP] [--execution XSP-456]

Import JUnit XML results:

xray results import junit results.xml [--project XSP] [--execution XSP-456]

xray precondition — Precondition Operations

xray precondition list [--jql JQL] [--limit N] [--start N]

xray test-set — Test Set Operations

xray test-set list [--jql JQL] [--limit N] [--start N]

xray test-plan — Test Plan Operations

xray test-plan list [--jql JQL] [--limit N] [--start N]

xray folder — Folder Operations

xray folder list --project XSP [--path /MyFolder] [--limit N] [--start N]

Configuration

Config File

Create .xray-cli.ini in your project directory or home directory:

[xray]
client_id = YOUR_CLIENT_ID
client_secret = YOUR_CLIENT_SECRET

[defaults]
project_key = XSP
output = text
timeout_seconds = 30
page_limit = 50

See xray-cli.ini.example for a full annotated template.

You can also specify a config file explicitly:

xray --config /path/to/config.ini execution list

Environment Variables

All settings can be set via environment variables:

Variable Config Key
XRAY_CLIENT_ID client_id
XRAY_CLIENT_SECRET client_secret
XRAY_AUTH_URL auth_url
XRAY_GRAPHQL_URL graphql_url
XRAY_IMPORT_BASE_URL import_base_url
XRAY_PROJECT_KEY project_key
XRAY_OUTPUT output
XRAY_TIMEOUT timeout_seconds
XRAY_PAGE_LIMIT page_limit

Precedence

Settings are resolved in this order (highest wins):

  1. CLI flags (--json, --timeout)
  2. Environment variables (XRAY_*)
  3. Config file (.xray-cli.ini)
  4. Built-in defaults

Output Formats

By default, output is human-readable text. Use --json for machine-readable JSON:

# Human-readable
xray test list --limit 3

# JSON output (pipe to jq, etc.)
xray --json test list --limit 3 | jq '.results[].issue_key'

Exit Codes

Code Meaning
0 Success
2 Usage / validation error
3 Configuration error
4 Authentication error
5 Network / transport error
6 API / resolution error
7 Import error

Running Tests

PYTHONPATH=src python3 -m unittest discover -s tests

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xray_cli-0.1.2.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xray_cli-0.1.2-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file xray_cli-0.1.2.tar.gz.

File metadata

  • Download URL: xray_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for xray_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b49ee21cd60e0b4aded4341ac3763ce40adcc0de418813411ef4eb9592f44428
MD5 b42bcb5256e0146411974a18f2992409
BLAKE2b-256 6a22e754b1de047570cc4095f745d548b997d8096d347328b7e12be497bf8467

See more details on using hashes here.

File details

Details for the file xray_cli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: xray_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for xray_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d0dcca715448a9a08f3e3d7dd91c5050c8c1a7d004b366a4e63c66a1743991ba
MD5 8b592f1174e1b3bc8044f87c345ca6cc
BLAKE2b-256 0f50525a08bf75396e749545bd87bb204cf40666e10cc1416ade0469ce36d919

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page