1

I'm using Zepyhr Scale Server and I would like to upload to Zephyr the results of my automation testsuite made with pytest. I've tried this POST request:

post(url="https://{my-jira-host}/rest/atm/1.0/automation/execution/{projectKey}", auth=({my_username}, {my_password}), files={"file":open("test_results.zip","rb")})

but it doesn't work because the response is "errorMessages":["Invalid Custom Format JSON file"]}.

I'm uploading a zip file containing one xml file generated with

pytest --junitxml=output/junitxml_report.xml as it's explained here https://support.smartbear.com/zephyr-scale-cloud/docs/test-automation/pytest-integration.html

I've tried to make the same request with an API client (Postman) and the error is "Invalid ZIP file", even if I fail the authentication with a wrong username or even if I upload the xml file only.

Maybe someone does the same thing and could help me? I'm a newbie :) thanks!

fede1911
  • 11
  • 2
  • IMO that's a link for zephyr scale cloud while you are working with zephyr scale server https://support.smartbear.com/zephyr-scale-server/docs/test-automation/integrations/annotations-with-other-ci-tools-running-locally.html I also get "invalid ZIP file" with NUnit 2 format. so no helpful pointer for now. Its confusing, also posted in the smartbear forum https://community.smartbear.com/t5/Zephyr-Scale-formerly-TM4J/zephyr-scale-server-integrations-with-nunit-Does-it-accept/td-p/221404 – vijiboy Aug 27 '21 at 13:15

1 Answers1

0

I found the API documentation lacking, but I managed to enumerate many endpoints.

I've bundled them in a nodejs lib, it won't be of use for your Python script, but the endpoints will be the same... Maybe they can help you on your way.

https://www.npmjs.com/package/@dbouckaert/zephyr-scale-reporter

Example: get all testcases for a project

/**
 * This function will get all testcases for a certain project and add them to variables.testCasesArray
 * @returns {void}
 */
export const getAllTestcases = async (): Promise<void> => {
  await request(variables.url)
    .get(`/rest/tests/1.0/project/${variables.projectId}/testcases`)
    .auth(variables.username, variables.password)
    .expect(200)
    .then((res) => {
      variables.testCasesArray = res.body.testCases;
    });
};