codeclimate / test-reporter

Code Climate Test Reporter
MIT License
156 stars 76 forks source link

XML syntax error on cobertura.ser file #362

Closed toymachiner62 closed 6 years ago

toymachiner62 commented 6 years ago

Trying to report code coverage of a cobertura.ser file when running Jenkins from a multi-stage docker build and it's reporting XML syntax error. I'm no expert in cobertura or .ser files, but is this an expected error?

Step 27/31 : RUN ls -al /home/gradle/project/build/cobertura
 ---> Running in c76a43c2268d
total 1032
drwxr-sr-x    2 gradle   root            53 Sep 18 16:59 .
drwxr-sr-x   12 gradle   root           167 Sep 18 16:59 ..
-rw-r--r--    1 gradle   root        520058 Sep 18 16:59 cobertura.ser
-rw-r--r--    1 gradle   root        534618 Sep 18 16:58 coberturaInput.ser
Removing intermediate container c76a43c2268d
 ---> 6d0652c3d904
Step 28/31 : RUN ./cc-test-reporter format-coverage -d -t cobertura /home/gradle/project/build/cobertura/cobertura.ser
 ---> Running in b0642fb954cd
time="2018-09-18T16:59:47Z" level=debug msg="coverage path /home/gradle/project/build/cobertura/cobertura.ser" 
time="2018-09-18T16:59:47Z" level=debug msg="using formatter cobertura" 
time="2018-09-18T16:59:47Z" level=debug msg="checking search path /home/gradle/project/build/cobertura/cobertura.ser for cobertura formatter" 
Error: XML syntax error on line 1: invalid UTF-8
Usage:
  cc-test-reporter format-coverage [coverage file] [flags]

Flags:
      --add-prefix string   add this prefix to file paths
  -t, --input-type string   type of input source to use [clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, simplecov]
  -o, --output string       output path (default "coverage/codeclimate.json")
  -p, --prefix string       the root directory where the coverage analysis was performed (default "/home/gradle/project")

Global Flags:
  -d, --debug   run in debug mode

The command '/bin/sh -c ./cc-test-reporter format-coverage -d -t cobertura /home/gradle/project/build/cobertura/cobertura.ser' returned a non-zero code: 255
make: *** [build] Error 255
ale7714 commented 6 years ago

@toymachiner62 👋 thank you for reaching and sorry that you're encountering this error. It's not expected. I suspect this could be a parsing error since under the hood the test-reporter is transforming the Cobertura file into the JSON format of our test reports. It's hard to guess what's exactly causing that error without knowing the content of the file /home/gradle/project/build/cobertura/cobertura.ser. Would it be possible to send us that information? You can send it over our support form. Thanks!

toymachiner62 commented 6 years ago

I just submitted a ticket with my cobertura.ser file.

ale7714 commented 6 years ago

Thanks! I'm gonna close this issue and we will be following up on your ticket soon.

efueger commented 6 years ago

Quick follow-up: