0

I am currently configuring a Jenkins job to run a suite of unit tests for an iOS project and publish code coverage results with Cobertura. I am using Slather to generate the .xml coverage report for Cobertura. The problem I am running into is that the slather coverage does not appear to actually be outputting anything to the listed --output-directory.

Jenkins Execute Shell:

/usr/local/bin/slather coverage \
--cobertura-xml -x --output-directory ${WORKSPACE}/MyProject/test-reports/coveragereport \
--source-files MyProject/WebServices \
--verbose \
-s \
--scheme MyProjectTests \
--binary-file MyProject/artifacts/MyProject.app/MyProject \
MyProject/MyProject.xcodeproj

I have tried a couple different variations of the syntax for the output:

  • --cobertura-xml ${WORKSPACE}/MyProject/test-reports/coveragereport
  • -x --output-directory ${WORKSPACE}/MyProject/test-reports/coveragereport

I have tried these with various output directories with and without using the workspace variable in case it was having trouble with the default root.

Jenkins Console:

Test Coverage: 26.72%
Slathered
Recording test results
[Cobertura] Publishing Cobertura coverage report...
[Cobertura] No coverage results were found using the pattern 'MyProject/test-reports/coveragereport/*.xml' relative to '/Users/jenkins/workspace/iOS/myproject/Unit_Tests'.  Did you enter a pattern relative to the correct directory?  Did you generate the XML report(s) for Cobertura?
Build step 'Publish Cobertura Coverage Report' changed build result to FAILURE

We can see that the slather coverage is working indicated by the test coverage result, however Cobertura cannot find the report. This is of course because the .xml it is looking for is not being generated/output.

TLDR:

Any idea what I can do to guarantee the .xml report that Cobertura is looking for is actually generated/output?

moonboy
  • 1,296
  • 4
  • 16
  • 29
  • I had the same issue. The issue is with the --output-directory. You shouldn't specify the absolute path. Just specify the relative path of .xml file generated in workspace – V V May 17 '18 at 20:52
  • The output xml file has to be in the same folder as where coverage is run – V V May 21 '18 at 21:16

0 Answers0