test-reporter icon indicating copy to clipboard operation
test-reporter copied to clipboard

Travis Jacoco setup: Error: could not find any viable formatter

Open efueger opened this issue 6 years ago • 2 comments

  • oss repo: https://github.com/alkal-io/kalium
  • using Travis
  • jacoco

Customer using jacoco and couldn't figure out how to set it up. They were able to point it to the xml file. But then it complaints about the source.

image
  • gradlew: https://github.com/alkal-io/kalium/blob/master/gradlew

  • Travis output: https://travis-ci.org/alkal-io/kalium/jobs/531032809

image

efueger avatar May 17 '19 14:05 efueger

See the callout on using JaCoCo at https://docs.codeclimate.com/docs/configuring-test-coverage and also https://github.com/codeclimate/test-reporter/issues/259#issuecomment-374280649

rhwood avatar Aug 06 '19 19:08 rhwood

@rhwood I am facing the same issue. I followed the documentation and used alternate command.

$ echo "Step Name - after_script"
$ JACOCO_SOURCE_PATH=report/src/main/java ./cc-test-reporter -d format-coverage ./report/target/site/jacoco-aggregate/jacoco.xml --input-type jacoco
time="2020-04-02T21:50:48Z" level=debug msg="coverage path ./report/target/site/jacoco-aggregate/jacoco.xml" 
time="2020-04-02T21:50:48Z" level=debug msg="using formatter jacoco" 
time="2020-04-02T21:50:48Z" level=debug msg="checking search path ./report/target/site/jacoco-aggregate/jacoco.xml for jacoco formatter" 
time="2020-04-02T21:50:48Z" level=debug msg="couldn't load committed at from ENV, trying git..." 
Error: could not find coverage info for source files
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, xccov]
  -o, --output string       output path (default "coverage/codeclimate.json")
  -p, --prefix string       the root directory where the coverage analysis was performed (default "/home/travis/build/WW-Digital/wcp-broadleaf")
Global Flags:
  -d, --debug   run in debug mode
$ ./cc-test-reporter -d upload-coverage
Error: open coverage/codeclimate.json: no such file or directory
Usage:
  cc-test-reporter upload-coverage [flags]
Flags:
  -s, --batch-size int    batch size for source files (default 500)
  -e, --endpoint string   endpoint to upload coverage information to (default "https://api.codeclimate.com/v1/test_reports")
  -r, --id string         reporter identifier (default "[secure]")
  -i, --input string      input path (default "coverage/codeclimate.json")
      --insecure          send coverage insecurely (without HTTPS)

There are multiple modules in the project and an aggregate jacoco.xml file is generated. But rest-reporter is not able to find it. Though the build is running in TravisCI but when I run the build in my local than I get almost 3.49MB file jacoco.xml at report/target/site/jacoco-aggregate/. I am pretty sure the file is there. There are 4 files at report/target/site/jacoco-aggregate/:

index.html
jacoco.csv
jacoco.xml
jacoco-sessions.html

@efueger did you find any solution to this issue. Pls share.

khatkarr avatar Apr 02 '20 21:04 khatkarr