fundakol/pytest-jira-xray

Error while creating new test execution

Closed this issue · 2 comments

Hi,

I'm using version 0.8.9 of pytest-jira-xray with following options:

--jira-xray --cloud --allow-duplicate-ids --client-secret-auth

and I get following error:

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://xray.cloud.getxray.app/api/v2/import/execution
2023-09-08 12:45:01 ERROR xray_publisher.py _send_data: Error message from server: Error creating Test Execution - Issue create failed! - summary: You must specify a summary of the issue.

Not sure if it helps but from a quick debug I can see that pytest-jira-xray tries to send the request with following payload:

{'info': {'finishDate': '2023-09-08T10:59:09+0000', 'startDate': '2023-09-08T10:58:53+0000'}, 'tests': [{'status': 'PASSED', 'testKey': 'ITS-12120'}]}

Any ideas how to fix this?

Summary field was optional, but maybe it was changed. I can fix this by providing some default value if user did not set it.

{
    "info" : {
        "summary" : "Execution of automated tests for release v1.3",
        "description" : "This execution is automatically created when importing execution results from an external source",
        "version" : "v1.3",
        "user" : "admin",
        "revision" : "1.0.42134",
        "startDate" : "2014-08-30T11:47:35+01:00",
        "finishDate" : "2014-08-30T11:53:00+01:00",
        "testPlanKey" : "DEMO-100",
        "testEnvironments": ["iOS", "Android"]
    },
    "tests" : []
}

You can try quick workaround in conftest.py:

def pytest_xray_results(results, session):
    results['info']['summary'] = 'Executed by pytest'

@fundakol whoa, thanks for such quick answer! I can live with the workaround :)