fastlane-community / xcov

Nice code coverage reporting without hassle
MIT License
556 stars 107 forks source link

Does not work when output folder is set on scan #142

Open jineshqa opened 5 years ago

jineshqa commented 5 years ago

Hi there,

I am currently using test_center plugin to run my tests, It is like an extension of scan. Both the tools allow users to specify output directory. When a output directory is specified the coverage files are also stored under the same but this line of code always checks for coverage files under derived data.

  1. How to specify location of coverage files?
  2. Can tool handle more than one coverage files?

Thanks, Jinesh

gbero commented 5 years ago

hey @jineshqa I'm facing the same issue, did you manage to solve it ?

jineshqa commented 5 years ago

@gbero Nope, let me know if you solve it.

gbero commented 5 years ago

@nakiostudio Could you help on this issue ?

this is where the xccovreport, is outputted:

/Users/Shared/Jenkins/Home/workspace/my-kit_PR-1/output/MYKIT.test_result/3_Test/action.xccovreport

https://docs.fastlane.tools/actions/setup_jenkins/ --> default output to "/.output" and default derived data to "/.derivedData"

Since there's hardcoded path "Logs/Test/" this should never work... ?

setup_jenkins()
scan(
        project: './MYKIT.xcodeproj',
        device: 'iPhone XS',
        scheme: options[:scheme],
        clean: true,
        code_coverage:true,
        formatter: "xcpretty-json-formatter",
        output_types: "html,junit,json-compilation-database",
        result_bundle: true
    )
xcov(
       project: 'MYKIT.xcodeproj',
       scheme: options[:scheme],
       html_report: true,
       skip_slack: true,
       derived_data_path: './derivedData'
    )
amelendezSGY commented 5 years ago

One (lame) way I've found to work around this is simply to copy my resulting .xccovreport from its known output location from Scan (that "3_Test" folder) to a stubbed out version of the location that xcov is expecting (e.g. /Logs/Test/). xcov seems to pick up all the right coverage data with that hack in place.

sanju-naik commented 4 years ago

Any update from fastlane or fastlane-community to fix this? I am also facing same issue.

reshadf commented 2 years ago

@joshdholtz could you have a look at this? I believe it broke down somewhere. I have been researching for a few days and this issue https://github.com/fastlane/fastlane/issues/19824 helped me out fixing it partially, however, using the danger-xcov plugin to output it to GitHub still fails with the same error. This all started when I changed the default derived data path.

This is what I have in fastlane:

  xcov(
    workspace: "Target.xcworkspace",
    scheme: "Target",
    output_directory: "xcov_report",
    derived_data_path: "~/Library/Developer/Xcode/DerivedData/"
  )

and this is what I have in my Dangerfile ( tried adding the xccov_file_direct_path with no success )

xcov.report(
   scheme: 'Target',
   workspace: 'Target.xcworkspace',
   derived_data_path: "~/Library/Developer/Xcode/DerivedData/",
   xccov_file_direct_path: "fastlane/test_output/Target.xcresult"
)