Forum Discussion

vinipieroni10's avatar
vinipieroni10
New Contributor
3 years ago
Solved

ERROR UPLOAD XML FILE - PYTEST - ZEPHYR SCALE

Hello guys,

I am using pytest and have generated an xml file to import into zephyr. I tried to upload it manually and tried with the REST API, but with no success both ways. 

 

Code that made me generate the xml file (I got this code from Smartbear - Configuring pytest to output JUnit XML results file): 

pytest --junitxml=output/junitxml_report.xml

 

Error manually: The uploaded file cannot be interpreted. Your content is invalid. Please try again by uploading a valid file.

 

My code with API Rest:

def test_upload(self):
url = 'https://api.zephyrscale.smartbear.com/v2/automations/executions/junit?projectKey="BST"&autoCreateTestCases=true'
headers = {'Authorization': 'Bearer ' + 'eyJ0e...CONTINUE'}
fhir = open('junitxml_report.xml', 'rb')
response = requests.post(url, headers=headers, files={"archive":(fhir)})
RESPONSE: {'errorCode': 400, 'message': 'createJUnitExecutions.projectKey: must match "([A-Z][A-Z_0-9]+)"', 'status': 'Bad Request'}
 
What can I do? 
 
Thanks in advance.
 
 
 
 
 
  • Hi vinipieroni10 ,

     

    well the error message you posted seems to indicate, that you have some character(s) in your project key, which should not be there. It should only contain capital letters or digits and nothing else. Maybe it's as simple as some lower case letters which can not be interpreted.

     

    Cheers

    Josh

1 Reply

  • josh42's avatar
    josh42
    Community Hero

    Hi vinipieroni10 ,

     

    well the error message you posted seems to indicate, that you have some character(s) in your project key, which should not be there. It should only contain capital letters or digits and nothing else. Maybe it's as simple as some lower case letters which can not be interpreted.

     

    Cheers

    Josh