fundakol / pytest-jira-xray

Plugin for pytest to upload test results to JIRA XRAY
Apache License 2.0
26 stars 18 forks source link

Support of parameterized test #96

Open NitroTamagotschi opened 11 months ago

NitroTamagotschi commented 11 months ago

It would be nice if parameterized tests would be supported as well. So that tests which got executed in multiple iterations with different parameters as documented here. An example you'll find below under key iterations

    "id": 10603,
    "status": "EXECUTING",
    "color": "#F1E069",
    "testKey": "ID-59",
    "testExecKey": "ID-60",
    "assignee": "User1",
    "executedBy": "User1",
    "startedOn": "2023-11-16T08:00:21+01:00",
    "startedOnIso": "2023-11-16T08:00:21+01:00",
    "defects": [],
    "evidences": [],
    "testEnvironments": [],
    "fixVersions": [],
    "customFields": [],
    "iterations": [
        {
            "id": 3,
            "status": "PASS",
            "color": "#95C160",
            "parameters": [
                {
                    "name": "Param1",
                    "value": "1"
                },
                {
                    "name": "Param2",
                    "value": "A"
                }
            ]
        },
        {
            "id": 4,
            "status": "TODO",
            "color": "#A2A6AE",
            "parameters": [
                {
                    "name": "Param1",
                    "value": "2"
                },
                {
                    "name": "Param2",
                    "value": "B"
                }
            ]
        }
    ]
}
fundakol commented 11 months ago

JSON format used to import Test results does not have iterations field. https://docs.getxray.app/display/XRAY/v2.0#/Import/post-import-execution

NitroTamagotschi commented 9 months ago

Yes you're right. Its only supported for manual tests until today image

akyekth commented 7 months ago

Hi i can able to import results to jira by using below pytest hook. test_input.json has test_key: "JIRA-1" my tests created through parameterized /pytest_generate_tests hook

conftest.py:


def pytest_runtest_call(self, item): 
        inputdict= item.callspec.params["test_case"]
        test_key=inputdict.test_key
        if not test_key == "":
            item.add_marker(pytest.mark.xray(f'{test_key}'))