I’m working with Jira’s Xray plugin to handle manual testing and need to build custom reports similar to Xray’s built-in “Test Runs Report”. Here’s my current structure:
Test plan exists: PROJECT-100
Test execution linked to plan: EXEC-200
Both plan and execution contain test case: CASE-300
When I run the CASE-300 test, it creates a test run instance. I can access the overall status for both the test plan (PROJECT-100) and test execution (EXEC-200) since I have their keys.
I found this in the Atlassian Python API docs:
# Get status for specific test run
xray.get_test_run_status(100)
I’m confused about the parameter. The function takes a number like ‘100’, but I expected it would need something like the execution key and test key combination, or maybe the actual test run identifier. How do I find what number to pass to this function to get the status of my specific test run?
This happens because Xray assigns sequential database IDs to test runs internally. When I hit this same issue, I found that browsing to your test execution in Jira and checking the network tab shows you the actual API calls. You’ll see requests returning JSON with the testRunId values you need. If your Xray version has GraphQL, you can also query the test execution and include test runs in the response. The numeric ID you’re after is just a simple integer like 12345 - nothing like your issue keys. Once you’ve mapped these internal IDs to your test cases, cache them for later status checks since they don’t change during that execution cycle.
That parameter is the internal test run ID, not the Jira issue key. When Xray creates a test run during execution, it assigns a unique numeric ID that’s separate from your CASE-300 or EXEC-200 keys. You’ll need to grab the test runs for your execution first - try xray.get_test_runs(execution_key) or query the execution details. The response includes an array of test run objects with the numeric IDs you need. I hit the same confusion building custom reports. The flow is: get execution details → pull test run IDs from response → use those with get_test_run_status(). The test run ID shows up in fields like id or testRunId depending on which endpoint you’re using. Check your execution query response first - those numeric IDs are in there with the test case keys.
Yeah, it’s confusing! When you run tests in Xray, each test gets its own internal database ID that’s separate from the Jira issue key. I just hit the REST API directly: /rest/raven/1.0/api/testexec/{execution-key}/testrun to grab all test runs with their numeric IDs. Then use that number in your Python method.