Giter Site home page Giter Site logo

fastlane-community / xcov Goto Github PK

View Code? Open in Web Editor NEW
550.0 15.0 106.0 2.9 MB

Nice code coverage reporting without hassle

License: MIT License

Ruby 82.45% JavaScript 0.53% CSS 9.30% HTML 7.72%
coverage-report fastlane coverage command-line-tool xcode xccoverage html-report continuous-integration ci

xcov's Introduction

xcov Logo


Twitter: @nakiostudio License Gem Gem Downloads

xcov is a friendly visualizer for Xcode's code coverage files.

Maintainers needed

Installation

sudo gem install xcov

Features

  • Built on top of fastlane, you can easily plug it on to your CI environment.
  • Blacklisting of those files which coverage you want to ignore.
  • Minimum acceptable coverage percentage.
  • Compatible with Coveralls.
  • Nice HTML, JSON and Markdown reports.

  • Slack integration.

Requirements

In order to make xcov run you must:

  • Use Xcode 7 or above.
  • Have the latest version of Xcode command line tools.
  • Set your project scheme as shared.
  • Enable the Gather coverage data setting available on your scheme settings window.

Usage

xcov analyzes the .xccoverage and .xccovreport files created after running your tests therefore, before executing xcov, you need to run your tests with either Xcode, xcodebuild or scan. Once completed, obtain your coverage report by providing a few parameters:

xcov -w LystSDK.xcworkspace -s LystSDK -o xcov_output

Parameters allowed

  • --workspace -w: Path of your xcworkspace file.
  • --project -p: Path of your xcodeproj file (optional).
  • --scheme -s: Scheme of the project to analyze.
  • --configuration -q: The configuration used when building the app. Defaults to 'Release' (optional).
  • --output_directory -o: Path for the output folder where the report files will be saved.
  • --source_directory -r: The path to project's root directory (optional).
  • --derived_data_path -j: Path of your project Derived Data folder (optional).
  • --xccov_file_direct_path -f: Direct path to the xccoverage/xccovreport file to parse to generate code coverage (optional).
  • --cloned_source_packages_path -C: Sets a custom path for Swift Package Manager dependencies (optional).
  • --minimum_coverage_percentage -m: Raise exception if overall coverage percentage is under this value (ie. 75.0).
  • --include_test_targets: Enables coverage reports for .xctest targets.
  • --ignore_file_path -x: Relative or absolute path to the file containing the list of ignored files.
  • --exclude_targets: Comma separated list of targets to exclude from coverage report.
  • --include_targets: Comma separated list of targets to include in coverage report.
  • --slack_url -i: Incoming WebHook for your Slack group to post results (optional).
  • --slack_channel -e: Slack channel where the results will be posted (optional).
  • --html_report: Enables the creation of a html report. Enabled by default (optional).
  • --json_report: Enables the creation of a json report (optional).
  • --markdown_report: Enables the creation of a markdown report (optional).
  • --skip_slack: Add this flag to avoid publishing results on Slack (optional).
  • --only_project_targets: Display the coverage only for main project targets (e.g. skip Pods targets).
  • --disable_coveralls: Add this flag to disable automatic submission to Coveralls.
  • --coveralls_service_name: Name of the CI service compatible with Coveralls. i.e. travis-ci. This option must be defined along with coveralls_service_job_id (optional).
  • --coveralls_service_job_id: Name of the current job running on a CI service compatible with Coveralls. This option must be defined along with coveralls_service_name (optional).
  • --coveralls_repo_token: Repository token to be used by integrations not compatible with Coveralls (optional).
  • --slack_username: The username which is used to publish to slack (optional).
  • --slack_message: The message which is published together with a successful report (optional).
  • --xcconfig: Use an extra XCCONFIG file to build your app (optional).
  • --ideFoundationPath: Absolute path to the IDEFoundation.framework binary (optional).
  • --legacy_support: Enables parsing coverage reports generated by Xcode 9.2 or previous versions.
  • --is_swift_package: Enables generating coverage reports for Package.swift derived projects.

Note: All paths you provide should be absolute and unescaped

Ignoring files

You can easily ignore the coverage for a specified set of files by adding their filenames to the ignore file specified with the --ignore_file_path parameter (this file is .xcovignore by default). You can also specify a wildcard expression for matching a group of files.

If you want to ignore all the files from a directory (folder), specify directory's relative path in ignore file. Also, specify source_directory if that differs from working directory (which is the default value).

Each one of the filenames you would like to ignore must be prefixed by the dash symbol -. In addition you can comment lines by prefixing them by #. Example:

# Api files
- LSTSessionApi.swift
- LSTComponentsApi.swift
- LSTNotificationsApi.swift

# Managers
- LSTRequestManager.m
- LSTCookiesManager.m

# Utils
- LSTStateMachine.swift

# Exclude all files ending by "View.swift"
- .*View.swift

# Exclude all dependencies
- Pods
- Carthage/Checkouts

Note: Ignores are handled case-insensitively. Pods will match any of pods, PODS, or Pods.

Fastlane 1.61.0 includes xcov as a custom action. You can easily create your coverage reports as follows:

xcov(
  workspace: "YourWorkspace.xcworkspace",
  scheme: "YourScheme",
  output_directory: "xcov_output"
)  

With the Danger plugin you can receive your coverage reports directly on your pull requests. You can find more information on the plugin repository available here.

If you want to keep track of the coverage evolution and get some extra features, xcov allows you to submit coverage reports to Coveralls. To do so, simply create an account and run xcov setting the options coveralls_service_name and coveralls_service_job_id for compatible CI environments. However, if you want to post to Coveralls from the console or any custom environment simply set the coveralls_repo_token option.

Contributors

nakiostudio opfeffer stevenreinisch hds michaelharro thelvis4 KrauseFx BennX initFabian revolter chrisballinger ngs aaroncrespo cmarchal

License

This project is licensed under the terms of the MIT license. See the LICENSE file.

xcov's People

Contributors

aaroncrespo avatar adamprice avatar aksvenk avatar be-meyer avatar cconstable avatar cdzombak avatar chrisballinger avatar cmarchal avatar getaaron avatar hds avatar hellghost avatar imaginaris avatar joshdholtz avatar krausefx avatar lonnyantunes avatar manicmaniac avatar mininny avatar mt-hodaka avatar nakiostudio avatar ngs avatar revolter avatar skyfoxa avatar stevenreinisch avatar tapi avatar thelvis4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xcov's Issues

The operation requires a selected developer portal team

Xcode version: 8.2.1
Mac OS: 10.11.6
xcov version: xcov 0.12.5

$ xcodebuild -workspace Vodka.xcworkspace -scheme Vodka -destination 'platform=iOS Simulator,name=iPhone 6 Plus' -configuration Debug -derivedDataPath 'build' test
.....
Executed 2 tests, with 0 failures (0 unexpected) in 411.383 (411.388) seconds
** TEST SUCCEEDED **

$ xcov -w Vodka.xcworkspace -s Vodka --configuration Debug -o xcov_output
[11:42:58]: $ xcodebuild -list -workspace Vodka.xcworkspace -configuration Debug
[11:42:59]: Skipping file blacklisting as no ignore file was found at path ./.xcovignore

+-----------------------------+-------------------+
| Summary for xcov 0.12.5 |
+-----------------------------+-------------------+
| workspace | Vodka.xcworkspace |
| scheme | Vodka |
| configuration | Debug |
| output_directory | xcov_output |
| html_report | true |
| markdown_report | false |
| json_report | false |
| minimum_coverage_percentage | 0 |
| ignore_file_path | ./.xcovignore |
| include_test_targets | false |
| skip_slack | false |
+-----------------------------+-------------------+

[11:42:59]: $ xcodebuild clean -showBuildSettings -workspace Vodka.xcworkspace -scheme Vodka -configuration Debug
2016-12-27 11:43:01.010 xcodebuild[17247:761697] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-11758/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/ProjectModel/Capabilities/Xcode3TargetCapabilitiesContext.m:292
Details: Failed to expand identifiers "{(
"group.com.beastbikes.ios"
)}": Error Domain=IDECapabilitiesErrorDomain Code=1 "The operation requires a selected developer portal team." UserInfo={NSLocalizedDescription=The operation requires a selected developer portal team., NSLocalizedRecoverySuggestion=}
Object: <Xcode3TargetCapabilitiesContext: 0x7f9d8dc7f6a0>
Method: -_appIDFeatureStateIncludingEntitlements:
Thread: <NSThread: 0x7f9d8a50f020>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2016-12-27 11:43:01.014 xcodebuild[17247:761697] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-11758/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/ProjectModel/Capabilities/Xcode3TargetCapabilitiesContext.m:292
Details: Failed to expand identifiers "{(
"group.com.beastbikes.ios"
)}": Error Domain=IDECapabilitiesErrorDomain Code=1 "The operation requires a selected developer portal team." UserInfo={NSLocalizedDescription=The operation requires a selected developer portal team., NSLocalizedRecoverySuggestion=}
Object: <Xcode3TargetCapabilitiesContext: 0x7f9d8dc7f6a0>
Method: -_appIDFeatureStateIncludingEntitlements:
Thread: <NSThread: 0x7f9d8a50f020>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
[11:43:01]: Unable to find any .xccoverage file.
[11:43:01]: Make sure you have enabled 'Gather code coverage' setting on your scheme settings.
[11:43:01]: Alternatively you can provide the full path to your .xccoverage file.

Looking for related GitHub issues on fastlane/fastlane...

Found no similar issues. To create a new issue, please visit:
https://github.com/fastlane/fastlane/issues/new
Run fastlane env to append the fastlane environment to your issue

image

Unable to find any .xccoverage file

Hey there,

I got this issue today. I just set the Xcode version to 9.3 and it seemed they changed some settings concerning the code coverage. The screen now looks like this:

screen shot 2018-04-03 at 14 09 47

And also when I have a look in the DerivedData folder I can find these files:

screen shot 2018-04-03 at 14 07 56

But there is no xccoverage anymore. Maybe they changed the name/format of the coverage file.

Can you confirm this?

🙀 Emjoji in table not working in Github Enterprise

For some reason, the unknown boxes come up for all the emojis in the table:
screen shot 2016-08-19 at 5 45 47 pm

Emojis for no changes work fine:
screen shot 2016-08-19 at 5 48 16 pm

The emojis display correct in the comment editor:
screen shot 2016-08-19 at 5 51 14 pm

And obviously I can replace the emojis and they work fine.

This is using GH Enterprise 2.6. HTML appears to be the same and the emoji is there when I inspect the source. Just won't display properly the first time when coming from CI 😢

-bash: xcov: command not found

Hi,
I have installed gem xcov. But when i run the command xcov -w LystSDK.xcworkspace -s LystSDK -o xcov_output it gives -bash: xcov: command not found.

Please help.

Can't generate the report

Hello, I am currently trying to use xcov as a post execution script on a Xcode bot for CI.

The xcov script works well on my local machine, but when Xcode runs it on the server I get the following result:

[10:10:18]: �[4m�[36m$ xcodebuild -list -workspace Next\ App.xcworkspace�[0m�[0m

+-----------------------------+------------------------------------------------------------------------------------------+
| �[32mSummary for xcov 1.2.0�[0m |
+-----------------------------+------------------------------------------------------------------------------------------+
| workspace | Next App.xcworkspace |
| scheme | Next App |
| output_directory | /Users/ifood/Public/Drop Box |
| derived_data_path | /Users/ifood/Library/Caches/XCSBuilder/Bots/316d4af48eb74f57c380c88679ad949a/DerivedData |
| html_report | true |
| markdown_report | false |
| json_report | false |
| minimum_coverage_percentage | 0 |
| skip_slack | false |
| slack_username | xcov |
| slack_message | Your xcov coverage report |
| ignore_file_path | ./.xcovignore |
| include_test_targets | false |
| only_project_targets | false |
+-----------------------------+------------------------------------------------------------------------------------------+

[10:10:20]: �[4m�[36m$ /Library/Ruby/Gems/2.0.0/gems/xcov-1.2.0/lib/xcov-core/bin/xcov-core -s /Users/ifood/Library/Caches/XCSBuilder/Bots/316d4af48eb74f57c380c88679ad949a/DerivedData/Logs/Test/256EEBA4-D03A-4B13-8504-C41443936587.xccoverage -o /var/folders/v4/qz1fqlhd6kzd6v5d5wcskv0w0000gn/T/report.json20170420-56524-1wex3x9 --include-lines-info�[0m�[0m
[10:10:20]: ▸ �[35mLoading...�[0m
[10:10:20]: ▸ �[35m------ xcov-core ------�[0m
[10:10:20]: ▸ �[35mOpening .xccoverage file at path: /Users/ifood/Library/Caches/XCSBuilder/Bots/316d4af48eb74f57c380c88679ad949a/DerivedData/Logs/Test/256EEBA4-D03A-4B13-8504-C41443936587.xccoverage�[0m
[10:10:20]: ▸ �[35mParsing .xccoverage file...�[0m
[10:10:20]: ▸ �[35mFile successfully parsed�[0m
[10:10:20]: ▸ �[35mSerializing coverage report...�[0m
[10:10:20]: ▸ �[35mReport successfully serialized�[0m
[10:10:20]: ▸ �[35mWriting report on disk...�[0m
[10:10:20]: ▸ �[35mCoverage report successfully created at path: /var/folders/v4/qz1fqlhd6kzd6v5d5wcskv0w0000gn/T/report.json20170420-56524-1wex3x9�[0m

Looking for related GitHub issues on fastlane/fastlane...

Found no similar issues. To create a new issue, please visit:
https://github.com/fastlane/fastlane/issues/new
Run fastlane env to append the fastlane environment to your issue
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in encode': �[31m[!] "\xC2" on US-ASCII�[0m (Encoding::InvalidByteSequenceError) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in initialize'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in new' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in parse'
from /Library/Ruby/Gems/2.0.0/gems/xcov-1.2.0/lib/xcov-core.rb:20:in parse' from /Library/Ruby/Gems/2.0.0/gems/xcov-1.2.0/lib/xcov/manager.rb:46:in parse_xccoverage'
from /Library/Ruby/Gems/2.0.0/gems/xcov-1.2.0/lib/xcov/manager.rb:30:in run' from /Library/Ruby/Gems/2.0.0/gems/xcov-1.2.0/lib/xcov/commands_generator.rb:41:in block (2 levels) in run'
from /Library/Ruby/Gems/2.0.0/gems/commander-fastlane-4.4.4/lib/commander/command.rb:178:in call' from /Library/Ruby/Gems/2.0.0/gems/commander-fastlane-4.4.4/lib/commander/command.rb:178:in call'
from /Library/Ruby/Gems/2.0.0/gems/commander-fastlane-4.4.4/lib/commander/command.rb:153:in run' from /Library/Ruby/Gems/2.0.0/gems/commander-fastlane-4.4.4/lib/commander/runner.rb:476:in run_active_command'
from /Library/Ruby/Gems/2.0.0/gems/fastlane-2.27.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:40:in run!' from /Library/Ruby/Gems/2.0.0/gems/commander-fastlane-4.4.4/lib/commander/delegates.rb:15:in run!'
from /Library/Ruby/Gems/2.0.0/gems/xcov-1.2.0/lib/xcov/commands_generator.rb:46:in run' from /Library/Ruby/Gems/2.0.0/gems/xcov-1.2.0/lib/xcov/commands_generator.rb:15:in start'
from /Library/Ruby/Gems/2.0.0/gems/xcov-1.2.0/bin/xcov:6:in <top (required)>' from /usr/local/bin/xcov:23:in load'
from /usr/local/bin/xcov:23:in `

'


How can I resolve this issue?

Thank you

--derived_data_path option not being used

The --derived_data_path option is not being respected, in lib/xcov/runner.rb it attempts to find .xccoverage files only by looking at the .xcodeproj files, Source

Searching for derived_data_path and even XCOV_DERIVED_DATA_PATH in the codebase only yields the setting in lib/xcov/options.rb

This currently interferes with fastlane's setup_jenkins action which sets the derived data path to a jenkins workspace relative path, so that when running xcov it fails with the following:

ERROR [2016-03-10 00:02:50.02]: Unable to find any .xccoverage file.
ERROR [2016-03-10 00:02:50.02]: Make sure you have enabled 'Gather code coverage' setting on your scheme settings.
ERROR [2016-03-10 00:02:50.02]: Alternatively you can provide the full path to your .xccoverage file.

Order is inconsistent

On some runs I get:

| MTDates.framework                 | 12% |
| OMGHTTPURLRQ.framework            | 0%  |
| AFNetworking.framework            | 6%  |

On other runs I get:

| OMGHTTPURLRQ.framework            | 0%  |
| AFNetworking.framework            | 6%  |
| MTDates.framework                 | 12% |

It would be nice if there were a consistent (and customizable) sort order. For example, first by percentage of coverage, then by alphabetical order.

Silent option

1st: Great work. Looks awesome 👍

I was thinking about including this in a pre-push hook, and using the return code to prevent the hook if the coverage percentage is below the given threshold.
In this use case it'd be handy to have a silent switch, which only prints the covered %.

Files ignored in .xcovignore, but appearing in coverage report

Hi @nakiostudio
Like statet in the title, one of my team mates discovered something odd: files which were added into .xcovignore were also ignored during the coverage calculation (I can see this in the console which files were ignored), but they appear in the .html coverage report (and everywhere is 0%). Is this by intent?

only_project_targets option not working on 0.12.5

Despite of description done in README.md, --only_project_targets is not available in xcov options.

Run xcov -p MyApp.xcodeproj --only_project_targets returns :

invalid option : --only_project_targets

Improve integration with fastlane

Hi,

it would be nice to be able to get the code coverage from a Fastlane lane. A quick'n'dirty way to do it can be seen in this gist

But this is just the unfolding of the gem inside the action. It could break at any update. A simple way to do it would be for the gem to have the option to be called fastlane style so that it returns all the infos needed in a result object.

I'm sorry I won't have time to propose any PR for this. But maybe someone is interested or already working on a similar case.

Xcov Slack Notification doesn't read parameters anymore.

I'm sorry, we use Fastlane version 2.83 with Xcov version 1.3.2 and slack-notifier plugin 2.3.2.

Since updating to fastlane version 2.83, our Xcov Slack Notification ignores the "slack_username" and "slack_channel" properties.

Do you have any ideas, how to fix this problem?

Ignoring folders doesn't work

This is my setup:

Fastfile

desc "Coveralls"
lane :coveralls do
  xcov(
    project: "Project.xcodeproj",
    scheme: ENV["BITRISE_SCHEME"],
    coveralls_repo_token: ENV["COVERAGE_ACCESS_TOKEN"],
    ignore_file_path: "./.xcovignore"
  )  
end

.xcovignore

# .xcovignore.yml

# Ignore files
- PROJECT/folder/
- PROJECT/folder/*
- PROJECT/folder/*.swift

Is not ignoring the files at that folder, is that right? Or I'm doing it wrong

Output directory is now required

With the 1.3.0 release suddenly all our CI dependent on Xcov broke.
After investigating the issue it turned out we had to define the output directory as in Xcov.config[:output_directory].

This seems to be required after 1.3.0 and could be something you want to either make optional or more required by adjusting the docs.

wrong number of arguments (given 0, expected 1)

Hi there,

Since upgrading to xcov 1.1.1, I have started getting this error from fastlane:
wrong number of arguments (given 0, expected 1)

I am not sure what if it's something to do with how fastlane launch xcov or xcov directly.

Same issue as described here: fastlane/fastlane#8407

Also, everything works on xcov 1.0.1

Issues running on Fastlane >= 1.105.0

We're seeing the following error coming up when running the xcov action:

Could not find option for key :configuration. Available keys: workspace, project, scheme, derived_data_path, output_directory, html_report, markdown_report, json_report, minimum_coverage_percentage, ignore_file_path, include_test_targets, slack_url, slack_channel, skip_slack, exclude_targets

The stacktrace indicates that this is happening in https://github.com/nakiostudio/xcov/blob/master/lib/xcov.rb#L25 when it's verifying the options bundle.

This appears to happen when fastlane_core is upgraded to 0.57.0 as an internal dependency of Fastlane.

Do you have any pointers?

updated fastlane-core dependency

A project using xcov cannot install the latest version of fastlane 1.101.0 because of the hard dependency on fastlanecore.

A solution would be to update this dependency:
spec.add_dependency 'fastlane_core', '>= 0.44.0', '< 1.0.0'

Hipchat addon

I really love this gem, unfortunately we use hipchat at my new company, no I am not able to receive those nice notifications anymore. Is it hard, to port the slack messages to hip chat?

Ignore Folder

is this possible to Ignore list of classes located in folder by reference folder without add name of classes

empty `slack_url` causes crash

Hello,

I use xcov as apart of the Fastlane suite in both personal and work projects. In the case of my work projects, we use a generic Fastlane setup and simply switch out some environment variables inbetween all our projects, one of which is slack_url. If we do not have a value for that variable, we just leave it empty(incase we want to provide one later). This causes xcov to throw when trying to ping slack.

After following the stacktrace, I found the issue being the following line inside of slack_poster.rb:

def run(report)
  return if Xcov.config[:skip_slack]
  return if Xcov.config[:slack_url].nil? #  <-- This one

I feel it should be replaced with .to_s.empty? in order to prevent falsy values from being used

return if Xcov.config[:slack_url].to_s.empty?

Lastly, I realized that notifier.ping() throws if the url provided is no longer valid. My suggestion, is to wrap that code with a begin rescue statement.

...

begin
  result = notifier.ping(
    Xcov.config[:slack_message],
    icon_url: 'https://s3-eu-west-1.amazonaws.com/fastlane.tools/fastlane.png',
    attachments: attachments
  )

  UI.message 'Successfully sent Slack notification'.green

rescue Exception => e
  UI.error "xcov failed to upload results to slack. error: #{e.to_s}"
end

Here is a PR that fixes these issues: #99

  /Users/fabian/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/slack-notifier-1.5.1/lib/slack-notifier/default_http_client.rb:27:in `request_obj'
/Users/fabian/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/slack-notifier-1.5.1/lib/slack-notifier/default_http_client.rb:21:in `call'
/Users/fabian/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/slack-notifier-1.5.1/lib/slack-notifier/default_http_client.rb:8:in `post'
/Users/fabian/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/slack-notifier-1.5.1/lib/slack-notifier.rb:41:in `ping'
/Users/fabian/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/xcov-1.3.0/lib/xcov/slack_poster.rb:28:in `run'
/Users/fabian/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/xcov-1.3.0/lib/xcov/manager.rb:107:in `generate_xcov_report'
/Users/fabian/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/xcov-1.3.0/lib/xcov/manager.rb:31:in `run'
/Users/fabian/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.68.0/fastlane/lib/fastlane/actions/xcov.rb:8:in `run'

updated fastlane-core dependency

A project using xcov cannot install the latest version of fastlane 1.111.0 because of the hard dependency on fastlanecore.

A solution would be to update this dependency:
spec.add_dependency 'fastlane_core', '>= 0.44.0', '< 1.0.0'

same as #38

Xcov not picking up .xcovignore file

Hi,

I created a .xcovignore file in the default path for xcov (.fastlane/.xcovignore) but I keep getting this warning when I run my test suite:

Skipping file blacklisting as no ignore file was found at path ./fastlane/.xcovignore

This creates a problem as I have a number of files I need to ignore to get accurate coverage report. Is this a bug or am I missing something in my setup?

I am using xcov 1.3.1 and fastlane 2.70.3

Thanks for your help.

Files/Folder names added in .xcovignore is not updating in HTML coverage report still showing 100%

I have added this lines in .xcovignore file

- iOSXYZApp/main.m
- Pods
- Applications
- ../Supporting Files

I am using fastlane , adding this in my fastlane file:-

xcov(
      workspace: "./iOSXYZApp.xcworkspace",
      scheme: ENV['SCHEME'],
      output_directory: "xcov_output",
      include_test_targets: false
}

But in the coverage report the "main.m" is showing 100% code coverage.

Please find a solution for it.
screen shot 2018-04-05 at 2 24 06 am

ZeroDivisionError

Hello,

I got a ZeroDivisionError. The crash report has been submitted. The number is dbaf0b8d5f8062731ccd1b662620d467.

best,

steven

Coveralls upload error

Please, why I'm getting this error:

/Library/Ruby/Gems/2.0.0/gems/xcov-1.3.0/lib/xcov/coveralls_handler.rb:75:in initialize': No such file or directory - xcov_output/tmp/coveralls_report.json20170928-55649-1dyhfu0 (Errno::ENOENT)
from /Library/Ruby/Gems/2.0.0/gems/xcov-1.3.0/lib/xcov/coveralls_handler.rb:75:in new' from /Library/Ruby/Gems/2.0.0/gems/xcov-1.3.0/lib/xcov/coveralls_handler.rb:75:in perform_request'
from /Library/Ruby/Gems/2.0.0/gems/xcov-1.3.0/lib/xcov/coveralls_handler.rb:11:in submit' from /Library/Ruby/Gems/2.0.0/gems/xcov-1.3.0/lib/xcov/manager.rb:134:in submit_to_coveralls'
from /Library/Ruby/Gems/2.0.0/gems/xcov-1.3.0/lib/xcov/manager.rb:33:in run' from /Library/Ruby/Gems/2.0.0/gems/xcov-1.3.0/lib/xcov/commands_generator.rb:41:in block (2 levels) in run'
from /Library/Ruby/Gems/2.0.0/gems/commander-fastlane-4.4.5/lib/commander/command.rb:178:in call' from /Library/Ruby/Gems/2.0.0/gems/commander-fastlane-4.4.5/lib/commander/command.rb:178:in call'
from /Library/Ruby/Gems/2.0.0/gems/commander-fastlane-4.4.5/lib/commander/command.rb:153:in run' from /Library/Ruby/Gems/2.0.0/gems/commander-fastlane-4.4.5/lib/commander/runner.rb:476:in run_active_command'
from /Library/Ruby/Gems/2.0.0/gems/fastlane-2.58.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:64:in run!' from /Library/Ruby/Gems/2.0.0/gems/commander-fastlane-4.4.5/lib/commander/delegates.rb:15:in run!'
from /Library/Ruby/Gems/2.0.0/gems/xcov-1.3.0/lib/xcov/commands_generator.rb:46:in run' from /Library/Ruby/Gems/2.0.0/gems/xcov-1.3.0/lib/xcov/commands_generator.rb:15:in start'
from /Library/Ruby/Gems/2.0.0/gems/xcov-1.3.0/bin/xcov:6:in <top (required)>' from /usr/local/bin/xcov:23:in load'
from /usr/local/bin/xcov:23:in <main>'

Exception when using xcov 0.12 from Danger 4.0

Im using danger-xcov 0.2.2 not sure if this should be filed there or here. When running xcov with very minimal options I'm seeing an exception. It appears to be related to the changes in #48

Stacktrace

 #  from Dangerfile:14
 #  -------------------------------------------
 #  # Add test coverage reports
 >  xcov.report(
 #    scheme: "Debug",
 #  -------------------------------------------
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/xcov-0.12/lib/xcov/ignore_handler.rb:51:in `new'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/xcov-0.12/lib/xcov/ignore_handler.rb:51:in `relative_path'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/xcov-0.12/lib/xcov/ignore_handler.rb:25:in `should_ignore_file_at_path'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/xcov-0.12/lib/xcov/model/source.rb:19:in `initialize'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/xcov-0.12/lib/xcov/model/source.rb:72:in `new'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/xcov-0.12/lib/xcov/model/source.rb:72:in `map'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/xcov-0.12/lib/xcov/model/target.rb:57:in `block in map'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/xcov-0.12/lib/xcov/model/target.rb:57:in `map'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/xcov-0.12/lib/xcov/model/target.rb:57:in `map'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/xcov-0.12/lib/xcov/model/report.rb:61:in `block in map'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/xcov-0.12/lib/xcov/model/report.rb:61:in `map'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/xcov-0.12/lib/xcov/model/report.rb:61:in `map'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/danger-xcov-0.2.2/lib/danger_plugin.rb:57:in `report'
	from Dangerfile:14:in `block in parse'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/danger-4.0.0/lib/danger/danger_core/dangerfile.rb:199:in `eval'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/danger-4.0.0/lib/danger/danger_core/dangerfile.rb:199:in `block in parse'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/danger-4.0.0/lib/danger/danger_core/dangerfile.rb:195:in `instance_eval'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/danger-4.0.0/lib/danger/danger_core/dangerfile.rb:195:in `parse'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/danger-4.0.0/lib/danger/commands/local.rb:109:in `run'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/gems/danger-4.0.0/bin/danger:5:in `<top (required)>'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/bin/danger:23:in `load'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/bin/danger:23:in `<main>'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
	from /Users/pobrien/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'

Dangerfile

xcov.report(
  scheme: "Debug",
  workspace: "MyApp.xcworkspace",
)

It sort of looks as though the default value for source_directory isn't being populated. Specifying it explicitly appears to work.

Fastlane >= 2.76.1 with slack-notifier 2.3.2 conflict

Hey,

seems the latest (as of writing this) Fastlane version 2.76.1 needs slack-notifier 2.3.2 but xcov 1.3.x still depends on slack-notifier ~> 1.3.

Could you please update that dependency so slack notifications work again? Thanks!

Ignore files doesn't work

Hi I have the following configuration:

lane :unit_tests do
            scan(
                scheme: get_project_name,
                destination: 'platform=iOS Simulator,name=iPhone 6,OS=9.0',
                code_coverage: true,
                output_directory: "fastlane/test_results/"
            )


            xcov(
                workspace: "TestProject.xcworkspace",
                scheme: "TestProject",
                html_report: true,
                skip_slack: true,
                ignore_file_path: "./fastlane/.xcovignore",
                output_directory: "xcov_output"
            )  
    end

How do I ignore an entire folder?

Case sensitivity needs to be handled in .xcovignore

I am running this on macOS. xcov version 1.0.0.

On my system, I have a directory named Common. It was renamed from common a while ago, and I had also updated the index on git. I want this directory to be ignored when using xcov. In .xcovignore, adding Common doesn't work. Strangely, adding common makes it work.
I think this issue is because the file system on macOS is case insensitive.

I intend to commit .xcovignore, but doing that would likely break ignore functionality on other systems as the directory created for them would be Common.

Unable to find any .xccoverage file.

xCov 0.5

command: xcov -w WORKSPACE.xcworkspace -s SCHEME

return:
Unable to find any .xccoverage file.
Make sure you have enabled 'Gather code coverage' setting on your scheme settings.
Alternatively you can provide the full path to your .xccoverage file.

Gather coverage data option :
screenshot 2016-03-15 10 05 50

As we can see, we have result from coverage
screenshot 2016-03-15 10 07 02

File is present in /DerivedData/ folder
screenshot 2016-03-15 10 07 47

This configuration was working on older version

.xcovignore does not allow wildcard

Hej,

if I add a file name with a wildcard like this:

- *View.swift

no file listed in .xcovignore is not ignored.

Is it possible to use wildcards?

cheers,

steven

You cannot ignore a subproject

Expectation
I don't want to see the sub project in the code coverage report.

Setup
I have a project with an imported subproject

What I've Tried

  • Adding all the source files that the subproject contains to the .xcovignore ignore file, or the project name, or the base folder the project is still shown.
  • There doesn't seem to be another option to ignore subprojects

undefined method `log' for FastlaneCore::Helper:Module

hey there and thank you for xcov:
scan completes successfully, and then with the following call:

  xcov(
    workspace: MyWorkspace.xcworkspace",
    scheme: "MyScheme",
    output_directory: "xcov_output",
    slack_url: 'https://hooks.slack.com/services/MyKey'
  )

I get:
undefined method 'log' for FastlaneCore::Helper:Module

xcov 0.7
scan 0.7.0

Not included Pods always displayed in report

I try to exclude my Pods folders in .xcovignore but frameworks associated with are still displayed in HTML. This is only a layout issue because these frameworks are not included in total coverage percent.

Maybe --exclude_target and --include_target should be more appropriated for this kind of purpose but it doesn't seem to be working as expected.

Indeed, I have no result when I do something like this :
xcov -w MyApp.xcworkspace -s 'SCHEME' --output_directory xcov_output --include_targets 'TARGET'.

Maybe I misunderstand something 🤔.

No results!

The code coverage for the app is not generated.

Project's code coverage should respect number of lines per framework.

First of all, I really like this project. However I think calculating project's code coverage by simply averaging libraries' code coverages can be misleading. In my opinion it should be calculated using formula total number of lines covered / total number of lines.

Furthermore I would love to see [number of lines covered] / [number of lines] in reports as well.

Request for --hide-ignored-files option

Currently files ignored via .xcovignore are not really ignored — they appear as 0% coverage.

For example:

image

+-----------------------------------+----+
|          xcov Coverage Report          |
+-----------------------------------+----+
                – snip ✂️ –
| AFNetworking.framework            | 0% |
| OMGHTTPURLRQ.framework            | 0% |
+-----------------------------------+----+

However, I don't want to see these files at all.

Would be nice if there was a --hide-ignored-files option to completely remove this irrelevant stuff from the report.

Always 0%

Everyone I run xcov I am getting 0%

  • I have code coverage enabled in the Test Config
  • Ensured the Scheme shared

I created a new Project with some quick code and Xcode is showing the count beside each function inside the IDE.

My Command
`xcov -s AutoTest -p ./AutoTest.xcodeproj -o ./build/reports/xcov_output

I get the following Output

[14:47:22]: xcrun xcodebuild -list -project './AutoTest.xcodeproj'
[14:47:23]: Skipping file blacklisting as no ignore file was found at path ./.xcovignore

+-----------------------------+------------------------------------------+
| Summary for xcov 0.7 |
+-----------------------------+------------------------------------------+
| scheme | AutoTest |
| project | ./AutoTest.xcodeproj |
| output_directory | ./build/reports/xcov_output |
| derived_data_path | /Users/christopher.streel/Desktop/Build/ |
| minimum_coverage_percentage | 0.0 |
| ignore_file_path | ./.xcovignore |
| include_test_targets | false |
| skip_slack | false |
+-----------------------------+------------------------------------------+

[14:47:23]: $ /Library/Ruby/Gems/2.0.0/gems/xcov-0.7/lib/xcov-core/bin/xcov-core -s /Users/christopher.streel/Desktop/Build/Logs/Test/42D0D29B-E7A5-4A7D-B5BF-36058F0AE62E.xccoverage -o /var/folders/wz/p18ghh6561v49_s7mgdsvhg1lyr51y/T/report.json20160419-48755-1yu5l3q
[14:47:23]: ▸ Loading...
[14:47:23]: ▸ ------ xCov-Core ------
[14:47:23]: ▸ Opening .xccoverage file at path: /Users/christopher.streel/Desktop/Build/Logs/Test/42D0D29B-E7A5-4A7D-B5BF-36058F0AE62E.xccoverage
[14:47:23]: ▸ Parsing .xccoverage file...
[14:47:23]: ▸ File successfully parsed
[14:47:23]: ▸ Serializing coverage report...
[14:47:23]: ▸ Report successfully serialized
[14:47:23]: ▸ Writing report on disk...
[14:47:23]: ▸ Coverage report successfully created at path: /var/folders/wz/p18ghh6561v49_s7mgdsvhg1lyr51y/T/report.json20160419-48755-1yu5l3q
+--------------+-----------+
| xcov Coverage Report |
+--------------+-----------+
| AutoTest.app | 0% |
+--------------+-----------+

I've attached a screenshot, if you need any more info let me know.

I love the html output, just hope the Cover Coverage gets corrected

screen shot 2016-04-19 at 2 53 12 pm

Many projects with lots of targets

Hi amigos! Thanks for this amazing tool!

I'm trying to use it with quite big project. It's a massive xcworkspace with more than 10 projects and couple dozen app, library, framework and unit test targets.

What I'd like to do is to generate xcov report for all the targets that were unit tested.

The scenario would be:

  1. I run few unit test targets with "Gather Code Coverage" set to true with xcodebuild.
  2. I run xcov to generate summary report from all xccoverage files in the Logs/Test directory

Is it possible to run the tool this way? I was also trying to pass path to xccoverage files directly to the tool, didn't work.

Last question - why repo contains only binary for xcov-core ? How are you actually parsing xcoverage files?

Coveralls broken on 1.4.0

I'm guessing the report format changed?

bundler: failed to load command: fastlane (/Users/chrisbal/.gem/ruby/2.4.0/bin/fastlane)
NoMethodError: [!] undefined method `each' for nil:NilClass
  /Users/chrisbal/.gem/ruby/2.4.0/gems/xcov-1.4.0/lib/xcov/coveralls_handler.rb:30:in `block (2 levels) in convert_and_store_coveralls_json'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/xcov-1.4.0/lib/xcov/coveralls_handler.rb:25:in `each'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/xcov-1.4.0/lib/xcov/coveralls_handler.rb:25:in `block in convert_and_store_coveralls_json'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/xcov-1.4.0/lib/xcov/coveralls_handler.rb:23:in `each'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/xcov-1.4.0/lib/xcov/coveralls_handler.rb:23:in `convert_and_store_coveralls_json'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/xcov-1.4.0/lib/xcov/coveralls_handler.rb:10:in `submit'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/xcov-1.4.0/lib/xcov/manager.rb:136:in `submit_to_coveralls'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/xcov-1.4.0/lib/xcov/manager.rb:33:in `run'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/actions/xcov.rb:8:in `run'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:257:in `block (2 levels) in execute_action'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:236:in `block in execute_action'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:231:in `chdir'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:231:in `execute_action'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/fast_file.rb:148:in `method_missing'
  Fastfile:51:in `block (2 levels) in parsing_binding'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/lane.rb:33:in `call'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/lane_manager.rb:57:in `cruise_lane'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/commands_generator.rb:108:in `block (2 levels) in run'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in `call'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in `run'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in `run_active_command'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:75:in `run!'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/commands_generator.rb:333:in `run'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/commands_generator.rb:42:in `start'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/fastlane/lib/fastlane/cli_tools_distributor.rb:107:in `take_off'
  /Users/chrisbal/.gem/ruby/2.4.0/gems/fastlane-2.89.0/bin/fastlane:20:in `<top (required)>'
  /Users/chrisbal/.gem/ruby/2.4.0/bin/fastlane:22:in `load'
  /Users/chrisbal/.gem/ruby/2.4.0/bin/fastlane:22:in `<top (required)>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.