Forum Discussion

cmunoz's avatar
cmunoz
Frequent Visitor
2 years ago

Error trying to upload results from pytest to Zephyr Scale

Hi.

 

We are following these steps: https://github.com/SmartBear/zephyr-scale-pytest-example

 

We have downloaded the project and generated the sample xml file "junitxml_report.xml" (see attachments) with the command: pytest --junitxml=output/junitxml_report.xml

 

We have got a new access token from our jira/Zephyr project.

 

On Postman, in the tab “Authorization” we have selected “Bearer token” and introduced our token. In the tab “Params”, we have created 2 parameters: projectKey = PZUT; autoCreateTestCases = true. In the tab “Body” we have selected “form-data“ and createdy 2 new entries: file and testCycle. For “file“ we have selected from Postman the sample XML file we have generated above. For “testCycle” we have introduced this value:

 

{
"name": "Full regression",
"description": "Any additional description can be added here.",
"jiraProjectVersion": 10000,
"folderId": 10001,
"customFields": {
"Build Number": 20,
"Release Date": "2020-01-01",
"Pre-Condition(s)": "User should have logged in.",
"Implemented": false,
"Categories": "A,B",
"Tester": "JIRAUSER10000"
}
}

 

(we have sent the query with and without the field “testCycle”, but the result was the same).

 

So, the resuling URL in postman was (POST): https://api.zephyrscale.smartbear.com/v2/automations/executions/junit?projectKey=PZUT&autoCreateTestCases=true

 

When we sent the request with Postman, new test cases are created in our Zephyr, but they are empty, no testcycles are created, and Postman gets the following response:

 

{
"errorCode": 400,
"message": "Test Case Key DEV-T40 is missing",
"status": "Bad Request"
}


The created (but empty) test cases in Zephyr are the following:

 

Key: PZUT-T1; Name: tests.test_parametrized.test_parametrized
Key: PZUT-T2; Name: tests.test_sample.TestClass.test_method
Key: PZUT-T3; Name: tests.test_sample.test_method_1_without_class
Key: PZUT-T4; Name: tests.test_sample_with_unittest.TestStringMethods.test_isupper_DEV_124
Key: PZUT-T5; Name: tests.test_sample_with_unittest.TestStringMethods.test_split_DEV_125
Key: PZUT-T6; Name: tests.test_sample_with_unittest.TestStringMethods.test_upper_DEV_123

 

We have searched for "DEV-T40" in the code and we found the file "...\tests\test_ignored.py", which contains:

import pytest

@pytest.mark.skip(reason='no way of currently testing this')
class TestIgnoredClass:

    def test_method1_DEV_T40(self):
        assert 1 == 1

    def test_method3_DEV_T41(self):
        assert 5 == 4

 

But we really don't know why the postman request is failing. We have also tried from curl, but we get the same error:

 

C:\SQS\Kerma\zephyr-scale-pytest-example-main>curl -H "Authorization: Bearer %TOKEN%" -F "file=@C:\SQS\Kerma\zephyr-scale-pytest-example-main\output\junitxml_report.xml;type=application/xml" "https://api.zephyrscale.smartbear.com/v2/automations/executions/junit?projectKey=PZUT&autoCreateTestCases=false"
{"errorCode":400,"message":"Test Case Key DEV-T40 is missing","status":"Bad Request"}
C:\SQS\Kerma\zephyr-scale-pytest-example-main>

 

Could you help us to solve the 400 errorcode "Test Case Key DEV-T40 is missing"?

 

Thank you!

No RepliesBe the first to reply