Hey everyone,
I’m scratching my head over an issue with Zephyr for Jira. I’m trying to mark an execution for a test I created, but I’m running into a wall.
I thought I could use the StepResultResource/Create New StepResult API function, but it’s not working as expected. For some reason, it’s accessing a completely different test than the one I want.
Does anyone know which API function I should be using to execute test steps on a specific execution? Here’s a snippet of what I’ve tried:
test_data = {
'step_id': '',
'issue_id': '12345',
'execution_id': '6789',
'status': '1'
}
response = requests.post(
f'{api_url}/latest/stepResult',
json=test_data,
verify=cert_path,
auth=(username, password)
)
Any help would be much appreciated. Thanks in advance!
I encountered a similar issue when working with Zephyr for Jira. The solution that worked for me was using the ExecutionResource/Update Execution API. This allows you to update an existing execution, including its step results. You’ll need to provide the execution ID, test ID, and project ID in your request. Here’s a basic structure:
update_data = {
'executionId': '6789',
'testId': 'your_test_id',
'projectId': 'your_project_id',
'status': '1',
'stepResults': [
{
'stepId': 'step_id_1',
'status': '1'
},
# Add more steps as needed
]
}
response = requests.put(
f'{api_url}/latest/execution',
json=update_data,
verify=cert_path,
auth=(username, password)
)
This approach should allow you to update the specific execution you’re targeting. Make sure to replace the placeholder values with your actual data.
hey john, i’ve had similar issues. Have u tried using the ExecutionResource/Create New Execution API instead? it lets u specify the test and create a new execution. Then u can update step results for that execution. Might solve ur problem. lemme know if it helps!
I’ve been using Zephyr for Jira extensively in my projects, and I can tell you that the ExecutionResource/Update Execution API is indeed the way to go. However, there’s a crucial detail that’s often overlooked: you need to ensure you’re using the correct projectId and versionId.
In my experience, many issues arise from mismatched project or version IDs. Double-check these in your Jira instance. Also, make sure your authentication is set up correctly - I once spent hours debugging only to realize my API token had expired.
Another tip: use the ‘fields’ parameter in your API call to specify exactly which fields you want to update. This can significantly improve performance, especially when dealing with large test cases.
Lastly, if you’re still having trouble, try using the Zephyr API explorer in your Jira instance. It’s a great tool for testing API calls and understanding the required parameters.