XRAY Import Multipart Null Pointer Error

George Goslin Jr_ November 5, 2021

Hi, I'm currently trying to use the XRAY JSON format to import test executions while also creating/updating test issues, and am receiving a null pointer error response: 

{
    "error": "An exception occurred while handling a v2 REST API request: java.lang.NullPointerException"
}

Here's my result json fiile: 


{
  "testExecutionKey": "MHV-24977",
  "info": {
    "summary": "MHV Automated Test"
  },
  "tests": [
    {
      "status": "PASS",
      "testInfo": {
        "summary":"MHV Automated Test",
        "projectKey": "MHV",
        "definition": "MHV Test Creation testing",
        "testType": "Automated",
        "customFields": [
          {
            "id": 15400,
            "value": [
              "MHV Test Automation"
            ]
          }
        ]
      }
    }
  ]
}
Here's my info json file:
{

    "fields": {
    "project": {
        "key": "MHV"
    },
    "summary": "MHV - Test Execution for Jira Automation Testing 1",
    "description": "Creating of an automated test using the Jira REST API",
    "issuetype": {
        "id": "11600"
    },

    "customfield_15400": { "value" : "MHV Test Automation"}

}
}
I've tried many different variations of the json that I've sent through, and have burned many days on this at this point. I've also noticed that there honestly seemingly some inconsistencies within the documentation on formatting and sending XRAY Json formats, and have also found some articles related to this: 

https://community.atlassian.com/t5/Jira-Software-questions/XRay-Import-Execution-Results-Exception-when-importing-test/qaq-p/1803433
I'm unsure of the exact version of our current Xray plugin, as I work as a contractor and the admin team for our Jira server instance is a separate team altogether, so I have to wait for the support ticket to be resolved by them to verify the version, though I do believe it's at least 5. We use Selenium and JUnit, however we use the entire JUnit test class as our "test case", and not the test methods themselves (we essentially treat the test methods as test steps via JUnit test ordering, so the XML report being generated is creating an XRay test item for every method and not the test class). I've looked at trying to customize the JUnit reports, but am not familiar with it enough yet to alter the XML elements to only show test classes and their overall results in the report and not the test methods as well. (This would solve the issue for me). 

Instead, I've resolved to trying to use the XRAY Json format and just use the REST endpoints, however I'm now encountering problems using that. This is causing a complete blocker for me at the moment and I have a deadline fast approaching. Not sure the best way to proceed.....

1 answer

0 votes
Rogério Paiva - Xray Xporter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 9, 2021

Hi @George Goslin Jr_ 

This is a defect that is already reported and fixed since version 5.1.1.
Please check (https://jira.getxray.app/browse/XRAY-8086) and ask your system administrator to update Xray to the latest version to fix this.

Thank you.

Kind regards,
Rogerio Paiva [Xray Support Team]

George Goslin Jr_ December 1, 2021

Hi @Rogério Paiva - Xray Xporter 

I confirmed with my DevOps support team that our current version of XRay is 5.1.4, however I'm still getting a Null Pointer Error when trying to hit the multipart endpoint for Xray REST format. How might I go about diagnosing this further or getting more information on the reason for the error?

George Goslin Jr_ December 1, 2021

@Rogério Paiva - Xray Xporter So in just trying to hit the import/execution path, and not the multipart, I'm currently sending this JSON: 

{
    "testExecutionKey": "MHV-24977",
    "info": {
        "summary": "MHV Automated Test Dec 1"
    },
    "tests": [
        {
            "start": "2014-08-30T11:47:35+01:00",
            "finish": "2014-08-30T11:50:56+01:00",
            "status": "PASS",
            "customFields": [
                {
                    "id": 15400,
                    "value": [
                        "MHV Test Automation"
                    ]
                }
            ],
            "testInfo": {
                "summary": "MHV Automated Test creation - Dec 1",
                "testType": "Generic",
                "projectKey": "MHV",
                "definition": "Test definition"
            }
        }
    ]
}

And I'm currently getting this response: 

{
    "testExecIssue": {
        "id": "1445836",
        "key": "MHV-24977",
    },
    "testIssues": {
        "error": [
            {
                "messages": [
                    "MHV Product Team is required."
                ],
                "testDefinition": "Test definition"
            }
        ]
    },
    "infoMessages": []
}



This is better than I was receiving before after we upgraded our plugin version, however I'm getting a response stating that I need a value for the MHV Product Team, however that is what I'm passing in with the custom field. Here is a screenshot of the create issue Jira UI:

JiraCreateIssue.JPG

Here is the response for that custom field from the Jira REST api to verify the field id:


    {
        "id": "customfield_15400",
        "name": "MHV Product Team",
        "custom": true,
        "orderable": true,
        "navigable": true,
        "searchable": true,
        "clauseNames": [
            "cf[15400]",
            "MHV Product Team"
        ],
        "schema": {
            "type": "option",
            "custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
            "customId": 15400
        }
    },
Here is a screenshot of the element inspection in chrome: 
JiraCustomFieldScreenshot.JPG
I don't rule out that I'm formatting my JSON wrong, however I must admit that the documentation for XRAY can seem to be all over the place, especially between v1 and v2, as well as Jira's REST formatting along with it. Any assistance on correcting my JSON or helping to identify where the problem is would be greatly appreciated. I also don't believe I can reach out to official support as I don't have credentials for that, as I am a contractor and a separate DOTS team manages Jira and the associated plugins.
Rogério Paiva - Xray Xporter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2021

Hi @George Goslin Jr_ 

Please perform a re-index since in some cases it was enough to resolve. Please notice that the re-index can be heavy and so please run these during off-peak hours.

In case the re-index does not solve, then it is a more complex case and it is best to be analyzed directly by the Support Team. Please contact Xray Support (http://Xraysupport.getXray.app) to share your configuration so that the support team can investigate further.

Thank you.

Kind regards,
Rogerio Paiva [Xray Support Team]

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events