Get Test Runs Status via Atlassian Python API in Jira Xray

121 Views Asked by At

I use the Xray plugin for Jira to manage manual tests. In doing so, I have to create regular reports that are structured in a similar way to the "Test Runs Report" provided by Xray. My setup looks like this:

  1. I have a test plan: PLAN-1
  2. Assigned to the test plan is a Test Execution: EXC-2
  3. The test plan and test execution include a test case: TC-3

When executing the TC-3 test case, a test run is now generated: https://jira-url.com/secure/XrayExecuteTest!default.jspa?testExecIssueKey=EXC-2&testIssueKey=TC-3

How can I determine the execution status of the test run?

I can also determine the overall execution status of the test plan and the test execution because I know their keys (PLAN-1 and EXC-2).

I've already read the Atlassian Python API documentation . It says about the status of the test run:

# Retrieve the status for the given test run
xray.get_test_run_status(100)

But I don't understand this command. Instead of a '100', I would have expected testExecIssueKey=EXC-2&testIssueKey=TC-3 or the ID of the test run.

1

There are 1 best solutions below

0
Sérgio On

Test Runs (TRs) in Xray have an internal id; for the end user, usually the user will know the TR by the pair of Test and Test Execution issue keys. That client lib you're using uses the Test Run id to call the endpoint /rest/raven/1.0/api/testrun/{id}/ as described in Xray documentation. There's a similar endpoint but where you can get the TR based on the related issue keys of the Test and Test Execution, as shown in the following curl example.

curl -H "Content-Type: application/json" -X GET -u admin:admin http://yourserver/rest/raven/1.0/api/testrun?testExecIssueKey=TEST-123&testIssueKey=TEST-321

Coming back to the client library you're using, it doesn't seem to support this endpoint though, by looking at the current implementation.