0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Parse xccov JSON format and get particular formatted hash
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14
~> 5.0
~> 10.0
 Project Readme

Xccov::Parse

Installation

Add this line to your application's Gemfile:

gem 'xccov-parse'

And then execute:

$ bundle

Or install it yourself as:

$ gem install xccov-parse

Usage

  1. Generate the json result by xcrun xccov view --only-targets --json
    # target: https://github.com/KazuCocoa/test.examples
    $ git clone https://github.com/KazuCocoa/test.examples && cd test.examples
    $ xcodebuild -workspace test.examples.xcworkspace -scheme test.examples -derivedDataPath Build/ -destination 'platform=iOS Simulator,OS=11.3,name=iPhone 7' -enableCodeCoverage YES clean build test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
  2. Read the JSON and get a particular line coverage
    xccov = Xccov.new
    xccov.help
    json = xccov.view '--only-targets', '--json', 'Build/Logs/Test/*.xccovreport'
    parsed = Xccov::Parse.new(json: json)
    parsed.targets_line_coverage["test.examples.app"] #=> 0.35
    
    # or
    # $ xcrun xccov view --only-targets --json Build/Logs/Test/*.xccovreport > result.json
    parsed = Xccov::Parse.new(file: './result.json')
    parsed.targets_line_coverage["test.examples.app"] #=> 0.35

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/KazuCocoa/xccov-parse.

License

The gem is available as open source under the terms of the MIT License.