Guy
Guy

Reputation: 820

Importing JUnit XML to XRay using the REST API - What is the Root Cause for "Error assembling issue data: Field customfield_11033"

Based on documentation here, I tried to import my JUnit-style XML using the following inputs. curl -H "Content-Type:multipart/form-data" -u mylogin:mypassword -F "[email protected]" https://jira.nayax.com/rest/raven/1.0/import/execution/junit?projectKey=TGP&testPlanKey=TGP-25

I used this article to convert my JMeter XML output to JUnit format using XSL. The output is:

output.xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
   <testsuite>
      <testcase classname="httpSample" name="Set-up Thread: loginUsingPOST - Success"
                time="0.789">
         <failure/>
      </testcase>
      <testcase classname="httpSample" name="Set-up Thread: loginUsingPOST - Success"
                time="0.631">
         <failure/>
      </testcase>
      <testcase classname="httpSample" name="createNfcTagUsingPOST - Success" time="0.282">
         <failure/>
      </testcase>
      <testcase classname="httpSample" name="handleTagDetectionUsingPOST - Success"
                time="0.311">
         <failure>Test failed: code expected to equal /

****** received  : [[[403]]]

****** comparison: [[[200]]]

/</failure>
      </testcase>
   </testsuite>
</testsuites>

The output was:

{"error":"Error assembling issue data: Field \u0027customfield_11033\u0027 cannot be set. It is not on the appropriate screen, or unknown."}

When I looked at a Test in the source-code view in the browser, that field was hidden:

    <input type="hidden" name="raven-testexec-test-customFieldId" 
id="raven-testexec-test-customFieldId" value="customfield_11033"/>
    <input type="hidden" name="raven-testexec-test-customFieldEnv" 
id="raven-testexec-test-customFieldEnv" value="14440"/>
    <input type="hidden" name="raven-testexec-test-revisionId" 
id="raven-testexec-test-revisionId" value="customfield_14437"/>
    <input type="hidden" name="raven-testexec-test-sprintId" 
id="raven-testexec-test-sprintId" value="customfield_10105"/>

So it looks like customfield_11033 is mapped to this generic thing called customFieldId, just as (for example) customfield_10105 is mapped to sprintId.

So what is this customFieldId??

When I looked at a Test Execution in the source-code view and searched for 11033, I did not find it at all.

Other Attempts

I read on XRay's documentation site that one can use the multipart variety of the API, but I get the same result.

curl -H "Content-Type:multipart/form-data" -u login:password -F "[email protected]" -F "testInfo=@test_info.json" -F "info=@test_exec_info.json" https://jira.nayax.com/rest/raven/1.0/import/execution/junit/multipart
test_exec_info.json
{
    "fields": {
        "project": {
            "id": "12900",
            "key": "TGP"
        },
        "summary": "Test Execution for JMeter Execution"
    }
}
test_info.json
{
    "fields": {
        "description": "Game Activation"
    }
}
Here is a screenshot of a test issue

enter image description here enter image description here

Here is a screenshot of a test execution in the project

enter image description here enter image description here enter image description here

I do not have admin permissions on the Jira layout. Is it a sine qua non that the Jira admins expose this custom field for my import to work?

Upvotes: 0

Views: 1684

Answers (1)

S&#233;rgio
S&#233;rgio

Reputation: 2129

First, thanks for providing all that info. After some investigation, it looks like your Jira administrator hasn't configured properly the issue screens or may have changed them. That customfield that gives you the error is the "Tests association with a Test Execution". That field needs to be on the edit screen of the Test Execution issue (i.e. on the edit screen used for the Test Execution accordingly with your project configurations).

More on that here and here.

configuration of the custom field named Tests association with a Test Execution

If your Jira admin needs help, please feel free to reach out Xray support team.

Upvotes: 1

Related Questions