README.md in xccov-parse-0.0.1 vs README.md in xccov-parse-0.1.0
- old
+ new
@@ -17,14 +17,24 @@
$ gem install xccov-parse
## Usage
1. Generate the json result by `xcrun xccov view --only-targets --json`
+ ```bash
+ # 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
```
- $ xcrun xccov view --only-targets --json Build/Logs/Test/*.xccovreport > result.json
- ```
2. Read the JSON and get a particular line coverage
```ruby
+ 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