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
ok thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.