0

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 "file=@output.xml" 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 "file=@output.xml" -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?

Guy
  • 666
  • 1
  • 10
  • 34
  • Can you please share a screenshot of a Test issue and of a Test Execution issue in Jira in that project TGP? Maybe the project was not property setup . – Sérgio Feb 13 '22 at 22:53
  • @Sérgio - I added the screenshots. Also, I noted that the customfield in question is hidden on the Test page and that I did not find it at all on the Test Execution page. What is this field 11033? – Guy Feb 14 '22 at 07:28
  • the 11033 is the id of the custom field (CF); it's generated automatically whenever someone creates a CF by hand or a plugin creates it. So that id is dynamic. We need to know the CF name (for that you either ask your Jira admin or you can do a REST API call to Jira API http://yourjiraserverl/rest/api/latest/customFields ) – Sérgio Feb 14 '22 at 09:47
  • I tried the REST call, but it says I don't have permissions, so I will ask the admin. – Guy Feb 14 '22 at 13:04
  • you need to use a valid Jira user with basic auth. Let's see what the Jira admin provides then – Sérgio Feb 14 '22 at 15:00
  • were you able to solve this? – Sérgio Feb 16 '22 at 13:59
  • Sorry to drag this on. I'll rattle the cage to see if I can get a quick answer. Still stuck – Guy Feb 16 '22 at 18:42
  • @Sérgio - I think that what I posted in the original post has the information. I'll add a bit more for context. – Guy Feb 22 '22 at 07:58

1 Answers1

1

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.

Sérgio
  • 1,777
  • 2
  • 10
  • 12