How can I update test results using API to a specific cycle phase? (Pytest)
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can I update test results using API to a specific cycle phase? (Pytest)
Hello,
New to Zephyr here. I have a test cycle and phases already created through the web UI. Each phase has test cases added to them. How can I use the API to post results to update the test status for the testcases in the phases?
The tests I am running are automated through Pytest running on many different test machines, I am looking for a way to POST or PUT many test results at once either by providing a payload that Zephyr can read in. Assuming Pytest knows the testcase id.
I do see the API endpoint /execution/bulk to Execute cases in bulk but not sure where to get the parameters to pass in, or how to format the body.
What is `scheduleids` ? There are also an `ids` in the JSON body as well in the example.
Any help would be great!
Thanks!
- Labels:
-
Academy
-
InsideZephyrEnterprise
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @gqdabien ,
You can create Junit XML reports using this method: https://docs.pytest.org/en/latest/how-to/output.html#creating-junitxml-format-files
Then use Zephyr test executions - upload JUnit XML API https://support.smartbear.com/zephyr-scale-cloud/api-docs/#tag/Automations/operation/createJUnitExec...
I created a py script that uploads multiple XML files to Zephyr, after editing them in such a way that when the test cases are automatically created (if they don't exist) their name will include just the test method name, without the full package and class names, making it more readable in Zephyr.
Just change the script locally to point to the right xml files folder.
The script can be found here: https://gist.github.com/yyahav/c5f7791bd3bb9ec9148ebbdf9aeb5914/raw/57547823a565b45cf7a137e5531cabb0...
You will need to create an API token so you can use it. Create one here: https://support.smartbear.com/zephyr-scale-cloud/docs/rest-api/generating-api-access-tokens.html The token should be passed as a '--token <tokenId>' to the script.
