0

So I'm trying to use the XRAY api to Import a JSON as a test execution. I've tried having the test execution already created and have it in the first tags and the actual TEST issue in the scenario tags. Also the custom field in the error is {"id":"customfield_11714","name":"Tests association with a Test Execution","custom":true,"orderable":true,"navigable":true,"searchable":true,"clauseNames":[],"schema":{"type":"array","custom":"com.xpandit.plugins.xray:testexec-tests-custom-field","customId":11714}},

Before adding the Test Execution as @BP-1084 I would get an error response that the Error assembling issue data: Field 'customfield_11714' cannot be set. It is not on the appropriate screen, or unknown.

JSON:

[
    {
        "uri": "C:\\TestProject\\Magento2-testing\\Source\\Features\\Magento2\\Orders.feature",
        "id": "orders",
        "tags": [
            {
                "name": "@BP-1084"
            }
        ],
        "keyword": "Feature",
        "name": "Orders",
        "line": 0,
        "description": "asd",
        "elements": [
            {
                "id": "orders",
                "tags": [
                    {
                        "name": "@BP-1079"
                    }
                ],
                "keyword": "Scenario",
                "name": "failed order",
                "line": 26,
                "description": "",
                "type": "scenario",
                "steps": [
                    {
                        "keyword": "Given",
                        "name": "I am on \"Home\" Page",
                        "line": 27,
                        "match": {
                            "location": ""
                        },
                        "result": {
                            "status": "passed",
                            "error_message": null,
                            "duration": 21847000000
                        },
                        "arguments": []
                    },
                    {
                        "keyword": "And",
                        "name": "I login with valid user",
                        "line": 28,
                        "match": {
                            "location": ""
                        },
                        "result": {
                            "status": "passed",
                            "error_message": null,
                            "duration": 27863000000
                        },
                        "arguments": []
                    },
                    {
                        "keyword": "And",
                        "name": "I add a physicalProduct to cart with quantity 1",
                        "line": 29,
                        "match": {
                            "location": ""
                        },
                        "result": {
                            "status": "failed",
                            "error_message": "chrome not reachable\n  (Session info: chrome=94.0.4606.71)\n  (Driver info: chromedriver=94.0.4606.61 (418b78f5838ed0b1c69bb4e51ea0252171854915-refs\/branch-heads\/4606@{#1204}),platform=Windows NT 10.0.19042 x86_64)",
                            "duration": 40077000000
                        },
                        "arguments": []
                    }
                ],
                "examples": []
            }
        ]
    }
]

ENDPOINT: POST rest/raven/1.0/import/execution/cucumber

https://docs.getxray.app/display/XRAY/Import+Execution+Results+-+REST#ImportExecutionResultsREST-CucumberJSONresults

Alex Toma
  • 101
  • 1
  • 9

2 Answers2

1

I think this problem is related to the field you are trying to update and is only a problem with how you are trying to interact with Jira. The error suggests that the Custom Field 11714 does not exist on the screen which is assigned to the (dependent on whether the issue already exists) edit or create context of the screen scheme which is assigned to the targeted issue type in the project's issue type screen scheme.

Try checking that the field id is correct, and exists on the right screens, likely the edit, create, or one assigned to the relevant transition based on your workflow.

Tom Gionfriddo
  • 410
  • 2
  • 8
  • 1
    That's correct, it was an issue with the project configuration. The fields were not configured. Also for anyone that might have this issue in the future, remember that you need the scenario on a TEST type issue and have the issue id as a tag in Gherkin scenario – Alex Toma Oct 06 '21 at 11:12
0

I too faced the same error and I am able to resolve based on the hints from Tom Gionfriddo's answer . When you are not providing the existing test execution while importing result, jira will try to create a new test execution and it will look for the associated tests field while creating the test execution. Check your test execution creation screen for the associated tests field. Based on your screen schema configuration, associated tests field may not exist during Test Execution creation and it will be available only during edit. The solution is to add the associated tests field to your test execution creation screen.

Mathan
  • 1
  • 1