fastlane-community / xcov

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

xcov does not generate any report file #148

Open le-cardinal opened 5 years ago

le-cardinal commented 5 years ago

Hi,

i've installed xcov 1.5.0 but unfortunately it won't work on my project. Since i'm quite new on iOS development, let me try to describe you the steps i did. i'm running tests from xcode 10 and getting some code coverage report within Xcode. The corresponding file .xcresult is located /Users/myname/Library/Developer/Xcode/DerivedData/product_name_xxxx/Logs/Test folder. I would like to use xcov mainly to exclude some files which not should be part of the final report. i'm running xcov in command line, select project name and scheme. Then summary is displayed on the Terminal without any error and according xcov report file is successfully generated at path /Users/myname/.fastlane/xcov_report/tmp/report/report.json-YYY (see below):

[14:47:45]: ▸ Loading...
[14:47:45]: ▸ Opening .xccoverage file at path: /Users/daniel/Library/Developer/Xcode/DerivedData/pdt_sdk-ffdunarfmbsujrdapvysztgqveop/Logs/Test/Test-pdt-external-Nominal-2019.03.15_14-46-16-+0100.xcresult/1_Test/action.xccovreport
[14:47:45]: ▸ Parsing .xccoverage file...
[14:47:45]: ▸ File successfully parsed
[14:47:45]: ▸ Serializing coverage report...
[14:47:45]: ▸ Report successfully serialized
[14:47:45]: ▸ Writing report on disk...
[14:47:45]: ▸ Coverage report successfully created at path: /Users/daniel/Downloads/xcov_report/tmp/report.json20190315-1049-fpi7sb
++
| xcov Coverage Report |
++
++ .

Unfortunately i'm not able to find any file on this path. There is a index.html generated under xcov_report with 0.00%.

Any idea on what can happen ? Regards /daniel

cmarchal commented 5 years ago

Hi Daniel,

Does the index.html generated file contain classes from your project when you expand it ? Or is it totally empty ? Moreover, can you show your command line and your ignored_files file ?

le-cardinal commented 5 years ago

hi ,

the command line i use is /Users/daniel/.gem/ruby/2.3.0/bin/xcov -s pdt-external-Nominal -p ./pdt_sdk.xcodeproj/ -o xcov_report

An index.html is generated under xcov_report folder with following content

<!DOCTYPE html>
<!--
xcov - Xcode code coverage without hassle
A tool developed by Carlos Vidal @carlostify
-->
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>xcov - Code coverage report</title>
  <link rel="stylesheet" media="screen" href="resources/bootstrap.min.css" />
  <link rel="stylesheet" media="screen" href="resources/opensans.css" />
  <link rel="stylesheet" media="all" href="resources/main.css" />
  <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
  <script src="resources/jquery.min.js"></script>
  <script src="resources/bootstrap.min.js"></script>
  <script src="resources/main.js"></script>
</head>
<body>
  <!-- NavBar template starts here -->
  <nav class="navbar navbar-fixed-top navbar-inverse" style=" border-bottom-width: 0px;">
    <div class="container-fluid">
      <div class="row">
        <div class="col-xs-12 col-md-offset-1 col-md-10 col-lg-offset-2 col-lg-8 text-left">
          <img class="logo" src="resources/xcov_logo.png"/>
        </div>
      </div>
    </div>
  </nav>
  <!-- NavBar template ends here -->
  <!-- Body template starts here -->
  <div class="container-fluid container-body">
    <!-- Coverage resume starts here -->
    <div class="row coverage-summary">
        <div class="col-md-12 text-center">
          <div class="summary-counter">
            0.00%
          </div>
          <div class="summary-description" style="color: #FF0000;">
            Keep calm and leave the boat
          </div>
        </div>
    </div>
    <!-- Coverage resume ends here -->

    <!-- Footer starts here -->
    <div class="row footer">
      <div class="col-xs-12 col-md-offset-1 col-md-10 col-lg-offset-2 col-lg-8 text-center">
        xcov - Xcode coverage reports without hassle - A tool developed by
        <a href="https://github.com/nakiostudio" target="_blank">Carlos Vidal</a> -
        <a href="https://twitter.com/carlostify" target="_blank">@carlostify</a>
      </div>
    </div>
    <!-- Footer ends here -->
  </div>
  <!-- Body template ends here -->
</body>
</html>

i didn't yet try the --ignore_file_path option since nothing is generated.

cmarchal commented 5 years ago

It seems good to me. Are you sure the scheme is well-named ? No typo or case error ? Do you run your tests right before xcov ?

le-cardinal commented 5 years ago

Hi, yes the scheme is correct. Tests have been run on real device from Xcode. Right now as i said, i'm able to get the report in Xcode but it contains some files i need to remove from coverage data.

cmarchal commented 5 years ago

Try running tests on simulator and let me know if it works. By the way, the ignored files feature seems not to work anymore since 1.4.3 according to other open issues.

le-cardinal commented 5 years ago

the fact is that tests are failing on simulator because some of my dependencies are only working on real device so far :( But if the ignored files feature is not working anymore, i'm not going to spend more time on that. Anyway, thanks for your help