jenkinsci / xray-connector-plugin

Xray Test Management Connector for Jenkins
https://plugins.jenkins.io/xray-connector/
MIT License
16 stars 13 forks source link

Upload Failed! Status:400 Response:{"error":"Invalid xml file: Non-whitespace before first tag. Line: 0 Column: 1 Char: ï"} #74

Open YvesL-RVAONEM opened 1 year ago

YvesL-RVAONEM commented 1 year ago

Jenkins and plugins versions report

Environment ```text Paste the output here ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Windows Server 2016 Dadacenter

Reproduction steps

  1. Tests results are stored in a JUNIT XML file:

CEDRIC_UI_20230601_125633.rxlog.junit.xml.zip

  1. This file is exported to Xray CLOUD using the post-build action:

2023-06-08 12_01_11-EXPORT XML TO JIRA CLOUD Config  Jenkins  — Mozilla Firefox

  1. The Jenkins project is executed but the "Xray: Results import task" fails:

2023-06-08 12_11_18-EXPORT XML TO JIRA CLOUD #12 Console  Jenkins  — Mozilla Firefox

Expected Results

Normal log for the plugin is:

_File found: [...] Starting to import results from [...] Response: (200) {"testExecIssue":{"id":"39105","key":"CBK-3595","self":"http://jira/rest/api/2/issue/39105"},"testIssues":{"success": [...] Successfully imported JUnit XML results from [...] XRAY_IS_REQUEST_SUCCESSFUL: true__

Actual Results

Upload Failed! Status:400 Response:{"error":"Invalid xml file: Non-whitespace before first tag. Line: 0 Column: 1 Char: ï"}

Full log is :

09:34:38 Starting XRAY: Results Import Task... 09:34:38 ########################################################## 09:34:38 #### Xray is importing the execution results #### 09:34:38 ########################################################## 09:34:39 File found: C:\Program Files (x86)\Jenkins\workspace\CEDRIC UI - SMOKE AND SANITY - PROD\CEDRIC-UI\bin\Debug\CEDRIC_UI_20230608_075743.rxlog.junit.xml 09:34:39 Starting to import results from CEDRIC_UI_20230608_075743.rxlog.junit.xml 09:34:39 ERROR: Step ?Xray: Results Import Task? failed: Unable to confirm Result of the upload..... Upload Failed! Status:400 Response:{"error":"Invalid xml file: Non-whitespace before first tag. Line: 0 Column: 1 Char: ï"} 09:34:39 Finished: FAILURE

Anything else?

The connection to the Jira Cloud site has been successfully tested In Jenkins. The xml file isn't corrupted; it opens using any capable program.

The export to a Xray SERVER site , using the same xml, doesn't return any error ! This error only occurs when exporting to Xray Cloud !

VERSIONS:

YvesL-RVAONEM commented 1 year ago

It appears that this issue is caused by the presence of a BOM at the beginning of the xml file. While this isn't a problem when exporting to Xray Server, it causes an error while exporting to Xray Cloud.