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.1.tar.gz (32.2 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.1-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xray_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 32.2 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.1.tar.gz
Algorithm Hash digest
SHA256 c65558b2c8c95ba99c258a71c94cf6f06bb71dc6f2651f5c219c613e9aec55e8
MD5 70b8defaf00a944964baa2361136428a
BLAKE2b-256 71048c47704ce389825460238dd8c30312d2d0f267aec7a415387d6eb436bbd2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xray_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 28.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 704fabd1106089dc6d9e674e02a639d2af1714c922929123412dfd0f9ac3ab36
MD5 744e9a24eecf6aae246e169e9bdcc43a
BLAKE2b-256 053f06e09018ad04f8cf2edfa20eba5555cc1f5ded1bd5e9de219e8f184b3146

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