Xray: Results Import Task fails with Status:400 Response:{"error":"components: components"}

Iryna R June 28, 2021

I use Xray for JIRA Jenkins Plugin to upload test results to Jira  as a post-build action

Console output in Jenkins provides error below:

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:17 min
[INFO] Finished at: 2021-06-28T19:21:23Z
[INFO] ------------------------------------------------------------------------
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **/target/surefire-reports/testng-results.xml
Saving reports...
Processing '/data/jenkins/home/jobs/tests/builds/4/testng/testng-results.xml'
TestNG Reports Processing: FINISH
Starting XRAY: Results Import Task...
##########################################################
####     Xray is importing the execution results      ####
##########################################################
File found: /var/lib/jenkins/workspace/tests/target/surefire-reports/testng-results.xml
Starting to import results from testng-results.xml
ERROR: Step ‘Xray: Results Import Task’ failed: Unable to confirm Result of the upload..... Upload Failed! Status:400 Response:{"error":"components: components"}
Finished: FAILURE

 XRay result import task Format: TextNG XML

Project Key: HIS (the name of my Jira project)

1 answer

1 vote
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.
June 29, 2021

Hi @Iryna R 

This error means that the Components custom field is not present in your project HIS.

Please edit the fields in the Project Settings and add the Components to your project.

Kind regards,
Rogério Paiva [Xray Support Team]

Pedro Garcia Sanchez October 6, 2021

Hi @Rogério Paiva - Xray Xporter . I get the same error (not from jenkins, but from Postman) :

{"error":"components: components"}

I see that, in the JIRA ticket with the feature that in the end generates my json (the one with the results), I have a "Component" custom field with a value. I guess this mean I already have "Components" added to my project.

I`m using this method (Xray for Jira Sever): https://docs.getxray.app/display/XRAY/Import+Execution+Results+-+REST#ImportExecutionResultsREST-CucumberJSONresults

and I don´t see in the example input any "Component" field, so I don't understand where the problem is... Am I missing something? Thanks!

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.
October 19, 2021

Hi @Pedro Garcia Sanchez 

Would you please add a screenshot of the "Component" custom field with a value?

If you don't want to show your information here, please reach out to the Xray Support (http://xraysupport.getxray.app) to share your configuration so that the support team can troubleshoot the cause.

Thank you.

Kind regards,
Rogério Paiva [Xray Support Team]

Pedro Garcia Sanchez October 20, 2021

Hi, @Rogério Paiva - Xray Xporter . I finally resolved this problem by using the "Cucumber JSON results Multipart" endpoint, which requires one json with the results and another one with the info of the field(s) that is required and the project ID, like this:

 

{
  "fields": {
    "project": {
      "id""ID of my project"
  },
  "summary""Cucumber Test Execution",
      "components" : [
          {
          "name":"Name of my component"
          }
      ]
  }
}
I've seen in the example of the doc that you can add more info, like the issuetype, custom fields...
Thanks!
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.
October 27, 2021

Hi @Pedro Garcia Sanchez 

Excellent! Great news!

Yes, indeed, the multipart is a good alternative when you have mandatory fields.

Thank you.

Kind regards,
Rogério Paiva [Xray Support Team]

Suggest an answer

Log in or Sign up to answer