Hello,
I have a problem with importing a report.json into an existing Test Execution using Xray.
At the moment, my report.json
looks like this:
{
"testExecutionKey": "VENT-2006",
"tests": [
{
"comment": "...",
"status": "PASS",
"testKey": "VENT-1786",
"evidences": []
},
{
"comment": "...",
"status": "PASS",
"testKey": "VENT-1787",
"evidences": []
},
{
"comment": "...",
"status": "PASS",
"testKey": "VENT-1788",
"evidences": []
},
{
"comment": "...",
"status": "PASS",
"testKey": "VENT-1789",
"evidences": []
}
]
}
The VENT-2006
Test Execution already exists in Jira, is in status "TODO", and currently has no tests linked.
When I run my Jenkins pipeline, I get an empty response from Xray:
▶ Starting Xray Import for Test Execution: VENT-2006
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 1645 0 2 100 1643 17 14116 --:--:-- --:--:-- --:--:-- 14181
Response from Xray:
{}
This is really frustrating.
My script looks like this: (this is only one code-block of my pipeline script)
stage('Xray Import') {
steps {
withCredentials([usernamePassword(
credentialsId: 'jira-jenkins-cred',
usernameVariable: 'JIRA_USER',
passwordVariable: 'JIRA_PASS'
)]) {
script {
echo "▶ Starting Xray Import for Test Execution: ${params.testExecutionID}"
def response = sh(
script: """#!/bin/bash
curl -k -u "$JIRA_USER:$JIRA_PASS" \\
-H "Content-Type: application/json" \\
-X POST \\
--data @$REPORT_JSON_PATH \\
"${JIRA_HOST}/rest/raven/1.0/import/execution?testExecKey=${params.testExecutionID}"
""",
returnStdout: true
).trim()
echo "Response from Xray:"
echo "${response}"
}
}
}
}
Now, interestingly:
If I remove the "testExecutionKey"
line from the report.json, it looks like this:
{
"tests": [
{ "comment": "...", "status": "PASS", "testKey": "VENT-1786", "evidences": [] },
{ "comment": "...", "status": "PASS", "testKey": "VENT-1787", "evidences": [] },
{ "comment": "...", "status": "PASS", "testKey": "VENT-1788", "evidences": [] },
{ "comment": "...", "status": "PASS", "testKey": "VENT-1789", "evidences": [] }
]
}
Then the import succeeds, but Xray automatically creates a new Test Execution, which I don't want.
Example of the successful response when no testExecutionKey
is in the JSON:
(in Addition VENT-2091 is a new Test Execution in Jira which is created automatically)
Response from Xray:
{
"testExecIssue": {
"id": "2545615",
"key": "VENT-2091",
...
},
"testIssues": {
"success": [
{ "id": "2529579", "key": "VENT-1786", ... },
{ "id": "2529580", "key": "VENT-1787", ... },
{ "id": "2529581", "key": "VENT-1788", ... },
{ "id": "2529582", "key": "VENT-1789", ... }
]
},
"infoMessages": []
}
Question:
How can I import tests into an already existing Test Execution (e.g., VENT-2006
) without Xray creating a new Test Execution?
Expectation:
The tests should be imported into the given Test Execution.
No new Test Execution should be created.
Notes:
I have edit rights on the Test Execution in Jira
The existing Test Execution that I have created and wished that the report.json in to be imported, has status "TODO".
Hello SuperRico,
Welcome to Community! It is worth to get contact xray support team from their portal to diagnose the problem.
You can raise a request from here : https://marketplace.atlassian.com/apps/1211769/xray-test-management-for-jira?hosting=cloud&tab=support
Have a wonderful day!
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.