The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how to create test execution id on xray ? Getting 400 Client Error

verifone Testautomation
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 15, 2024

Hi i am using below code , but i get 

 

import requests
import json

# Replace these variables with your actual values

xray_api_url = 'https://jira.company.com/rest/raven/1.0/import/execution'
api_token = 'xyz'
project_key = 'testkey'
test_plan_key = 'TP-1' # Replace with your test plan key

# Define test execution data
test_execution_data = {
'testPlanKey': test_plan_key,
'projectId': project_key,
'summary': 'Automated Test Execution',
'description': 'Test execution created via API',
'assignee': 'your_username', # Replace with assignee username
'testEnvironments': ['Production', 'Staging']
}

# Headers with authorization
headers = {
'Authorization': 'Bearer {}'.format(api_token),
'Content-Type': 'application/json'
}

try:
# Make POST request to create test execution
response = requests.post(xray_api_url, headers=headers, data=json.dumps(test_execution_data))
response.raise_for_status() # Raise exception for HTTP errors (4xx or 5xx)

# Print the response or handle it based on your application logic
print("Test execution ID created successfully:", response.json()['key'])

except requests.exceptions.HTTPError as e:
print(f"Error creating test execution ID: {e}")

except Exception as e:
print(f"Unexpected error: {e}")






 

 

 

Error creating test execution ID: 400 Client Error: for url: https://jira.company.com/rest/raven/1.0/import/execution

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Nicolas Grossi
Banned
July 15, 2024

@verifone Testautomation Welcome! You might contact xray Support.

 

Nicolas

verifone Testautomation
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 15, 2024

ok thanks

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events